npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

qaci-core

v1.1.9

Published

This submodule assists with handling key business logic functions and processes.

Downloads

3

Readme

qaci-core

This submodule assists with handling key business logic functions and processes.

Overview

One may conceive of MACI as a state machine with 1) data and 2) functions which transform said data. This makes it easier to reason about the system, write tests, and implement functionality. It also allows us to implement the smart contracts in discrete components which are easy to test.

To this end, this submodule exposes a MaciState class and a Poll class. Developers should instantiate objects from these classes to test MACI. For instance, MACI.test.ts creates a MaciState object and every time it interacts with the MACI smart contract, it mirrors said interaction on the MaciState and Poll. As such, the developer can then use their helper functions like maciState.signUp(), poll.publishMessage, poll.processMessages(), and poll.tallyVotes() to step through the various stages of the MACI flow.

MaciState

Key functions

signUp

Accepts a user's public key and creates a new state leaf and ballot leaf.

In testing, whenever a test suite submits a signUp() transaction, it should call maciState.signUp() as well, so that the off-chain representation of MACI is kept up to date.

In production, genMaciStateFromContract() in genMaciState.ts uses this function when it scans a MACI contract's event log for signups, so as to bring its MaciState instance up to date.

deployPoll

Creates a new Poll. This should be done whenever the MACI contract's deployPoll() function is called.

Helper functions

copy

A function that deep-copies an object.

Key data structures

stateAq, stateTree

The Merkle tree of state leaves. stateAq must be merged (subroots and/or main root) whenever the MACI contract's mergeStateAqSubRoots() and mergeStateAq() are invoked.

They should contain the same leaves, even if the stateAq is not yet merged. stateTree exists for developer convenience.

Poll

A Poll is an off-chain representation of a Poll. In testing, Poll instances should mirror their on-chain counterparts.

Key functions

publishMessage

Publishes a message by updating the message tree and message accumulation queue.

processMessages

Processes a batch of messages and returns the inputs to the processMessages circuit which can be used to prove correct execution.

tallyVotes

Tallies a batch of votes and returns the inputs to the tallyVotes circuit which can be used to prove correct execution.

Helper functions

copy

Deep-copies and returns this object.

Key data structures

messageAq, messageTree

The Merkle tree of message leaves. messageAq must be merged (subroots and/or main root) whenever the MACI contract's mergeMessageAqSubRoots() and mergeMessageAq() are invoked.

They should contain the same leaves, even if the messageAq is not yet merged. messageTree exists for developer convenience.