diff --git a/.gitignore b/.gitignore index cc1530b6b7..9bcc767c3e 100644 --- a/.gitignore +++ b/.gitignore @@ -153,7 +153,4 @@ circuits/circom/test # mdBook rendered files publish -# typedoc -docs/typedoc/* - **/ts/__benchmarks__/results/** diff --git a/website/.gitignore b/website/.gitignore index 6ea485ae8d..e34dbc9f6b 100644 --- a/website/.gitignore +++ b/website/.gitignore @@ -19,9 +19,5 @@ npm-debug.log* yarn-debug.log* yarn-error.log* -versioned_docs/version-v1.2/solidity-docs -versioned_docs/version-v1.2/typedoc versioned_docs/version-v1.3_alpha/typedoc/ versioned_docs/version-v1.3_alpha/solidity-docs/ - -typedoc diff --git a/website/versioned_docs/version-v1.2/circuits.md b/website/versioned_docs/version-v1.2/circuits.md index 8a16aeef4d..a17081e457 100644 --- a/website/versioned_docs/version-v1.2/circuits.md +++ b/website/versioned_docs/version-v1.2/circuits.md @@ -443,7 +443,7 @@ pnpm build-test-circuits-c pnpm build-test-circuits-wasm ``` -Please note that the circuits are configured with testing purpose parameters, which means it can only handle a limited amount of messages (up to 25 messages). For more information on the parameters and how to configure them, please refer to the individual circuit documentation within this page. Also, within the [configure-circomkit](https://maci.pse.dev/docs/installation#configure-circomkit) section of the `installation` page, you'll see how you can update the config file with new params. +Please note that the circuits are configured with testing purpose parameters, which means it can only handle a limited amount of messages (up to 25 messages). For more information on the parameters and how to configure them, please refer to the individual circuit documentation within this page. Also, within the [configure-circomkit](/docs/v1.2/installation#configure-circomkit) section of the `installation` page, you'll see how you can update the config file with new params. To compile a single circuit, you can run: @@ -505,4 +505,4 @@ To run individual tests, you can use the following commands (for all other circu - `pnpm run test:processMessages` to run the tests for the `processMessages` circuit. - `pnpm run test:tallyVotes` to run the tests for the `tallyVotes` circuit. -More details on testing are provided in the [testing section](/docs/testing) of the documentation. +More details on testing are provided in the [testing section](/docs/v1.2/testing) of the documentation. diff --git a/website/versioned_docs/version-v1.2/cli.md b/website/versioned_docs/version-v1.2/cli.md index 0b4b9ff7e1..5ac701b5dd 100644 --- a/website/versioned_docs/version-v1.2/cli.md +++ b/website/versioned_docs/version-v1.2/cli.md @@ -30,14 +30,14 @@ pnpm run hardhat | Command | Description | Options | | -------------------- | ------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `create` | Deploy the contracts | `-i, --initialVoiceCredits `: The initial voice credits
`-p, --initialVoiceCreditsProxyAddress `: The initial voice credits proxy contract address
`-g, --signupGatekeeperAddress `: The signup gatekeeper contract address
`-ph3, --poseidonT3Address `: The PoseidonT3 contract address
`-ph4, --poseidonT4Address `: The PoseidonT4 contract address
`-ph5, --poseidonT5Address `: The PoseidonT5 contract address
`-ph6, --poseidonT6Address `: The PoseidonT6 contract address
`-q, --quiet`: Whether to print values to the console
`-s, --stateTreeDepth `: The state tree depth
`-r, --rpc-provider `: The rpc provider URL | -| `checkVerifyingKeys` | Check that the verifying keys in the contract match the local ones | `-q, --quiet`: Whether to print values to the console
`-vk, --vk-contract `: The VkRegistry contract address
`-s, --state-tree-depth `: The state tree depth
`-i, --int-state-tree-depth `: The intermediate state tree depth
`-m, --msg-tree-depth `: The message tree depth
`-v, --vote-option-tree-depth `: The vote option tree depth
`-b, --msg-batch-depth `: The message batch depth
`-p, --process-messages-zkey `: The process messages zkey path (see different options to use specific circuits [Trusted setup](https://maci.pse.dev/docs/trusted-setup) or [Testing](https://maci.pse.dev/docs/testing/#pre-compiled-artifacts-for-testing))
`-t, --tally-votes-zkey `: The tally votes zkey path (see different options to use specific circuits [Trusted setup](https://maci.pse.dev/docs/trusted-setup) or [Testing](https://maci.pse.dev/docs/testing/#pre-compiled-artifacts-for-testing))
`-ss, --subsidy-zkey `: The subsidy zkey path (see different options to use specific circuits [Trusted setup](https://maci.pse.dev/docs/trusted-setup) or [Testing](https://maci.pse.dev/docs/testing/#pre-compiled-artifacts-for-testing)) | +| `checkVerifyingKeys` | Check that the verifying keys in the contract match the local ones | `-q, --quiet`: Whether to print values to the console
`-vk, --vk-contract `: The VkRegistry contract address
`-s, --state-tree-depth `: The state tree depth
`-i, --int-state-tree-depth `: The intermediate state tree depth
`-m, --msg-tree-depth `: The message tree depth
`-v, --vote-option-tree-depth `: The vote option tree depth
`-b, --msg-batch-depth `: The message batch depth
`-p, --process-messages-zkey `: The process messages zkey path (see different options to use specific circuits [Trusted setup](/docs/v1.2/trusted-setup) or [Testing](/docs/v1.2/testing/#pre-compiled-artifacts-for-testing))
`-t, --tally-votes-zkey `: The tally votes zkey path (see different options to use specific circuits [Trusted setup](/docs/v1.2/trusted-setup) or [Testing](/docs/v1.2/testing/#pre-compiled-artifacts-for-testing))
`-ss, --subsidy-zkey `: The subsidy zkey path (see different options to use specific circuits [Trusted setup](/docs/v1.2/trusted-setup) or [Testing](/docs/v1.2/testing/#pre-compiled-artifacts-for-testing)) | | `genMaciPubKey` | Generate a new MACI public key | `-sk, --privkey `: The private key | | `genMaciKeyPair` | Generate a new MACI key pair | `-sp, --seed seed value for keypair` | | `airdrop` | Airdrop topup credits to the coordinator | `-a, --amount `: The amount of topup
`-x, --maci-address `: The MACI contract address
`-o, --poll-id `: Poll id
`-t, --token-address `: The token address
`-q, --quiet`: Whether to print values to the console | | `deployVkRegistry` | Deploy a new verification key registry contract | `-q, --quiet`: Whether to print values to the console | | `show` | Show the deployed contract addresses | No options | | `deployPoll` | Deploy a new poll | `-t, --duration `: The poll duration
`-i, --int-state-tree-depth `: The int state tree depth
`-b, --msg-batch-depth `: The message tree sub depth
`-m, --msg-tree-depth `: The message tree depth
`-v, --vote-option-tree-depth `: The vote option tree depth
`-pk, --pubkey `: The coordinator public key
`-x, --maci-address `: The MACI contract address
`-q, --quiet`: Whether to print values to the console
"-vk, `--vkRegistryAddress `: The vk registry contract address | -| `setVerifyingKeys` | Set the verifying keys | `-s, --state-tree-depth `: The state tree depth
`-i, --int-state-tree-depth `: The intermediate state tree depth
`-m, --msg-tree-depth `: The message tree depth
`-v, --vote-option-tree-depth `: The vote option tree depth
`-b, --msg-batch-depth `: The message batch depth
`-p, --process-messages-zkey `: The process messages zkey path (see different options to use specific circuits [Trusted setup](https://maci.pse.dev/docs/trusted-setup) or [Testing](https://maci.pse.dev/docs/testing/#pre-compiled-artifacts-for-testing))
`-t, --tally-votes-zkey `: The tally votes zkey path (see different options to use specific circuits [Trusted setup](https://maci.pse.dev/docs/trusted-setup) or [Testing](https://maci.pse.dev/docs/testing/#pre-compiled-artifacts-for-testing))
`-k, --vk-registry `: The vk registry contract address
`-q, --quiet`: Whether to print values to the console
`-ss, --subsidy-zkey `: The subsidy zkey path (see different options to use specific circuits [Trusted setup](https://maci.pse.dev/docs/trusted-setup) or [Testing](https://maci.pse.dev/docs/testing/#pre-compiled-artifacts-for-testing)) | +| `setVerifyingKeys` | Set the verifying keys | `-s, --state-tree-depth `: The state tree depth
`-i, --int-state-tree-depth `: The intermediate state tree depth
`-m, --msg-tree-depth `: The message tree depth
`-v, --vote-option-tree-depth `: The vote option tree depth
`-b, --msg-batch-depth `: The message batch depth
`-p, --process-messages-zkey `: The process messages zkey path (see different options to use specific circuits [Trusted setup](/docs/v1.2/trusted-setup) or [Testing](/docs/v1.2/testing/#pre-compiled-artifacts-for-testing))
`-t, --tally-votes-zkey `: The tally votes zkey path (see different options to use specific circuits [Trusted setup](/docs/v1.2/trusted-setup) or [Testing](/docs/v1.2/testing/#pre-compiled-artifacts-for-testing))
`-k, --vk-registry `: The vk registry contract address
`-q, --quiet`: Whether to print values to the console
`-ss, --subsidy-zkey `: The subsidy zkey path (see different options to use specific circuits [Trusted setup](/docs/v1.2/trusted-setup) or [Testing](/docs/v1.2/testing/#pre-compiled-artifacts-for-testing)) | | `publish` | Publish a new message to a MACI Poll contract | `-p, --pubkey `: The MACI public key which should replace the user's public key in the state tree
`-x, --maci-address `: The MACI contract address
`-sk, --privkey `: Your serialized MACI private key
`-i, --state-index `: The user's state index
`-v, --vote-option-index `: The vote option index
`-n, --nonce `: The message nonce
`-s, --salt `: The message salt
`-o, --poll-id `: The poll id
`-w, --new-vote-weight `: The new vote weight
`-q, --quiet`: Whether to print values to the console | | `mergeMessages` | Merge the message accumulator queue | `-q, --quiet`: Whether to print values to the console
`-x, --maci-address `: The MACI contract address
`-o, --poll-id `: The poll id
`-n, --num-queue-ops `: The number of queue operations | | `mergeSignups` | Merge the signups accumulator queue | `-q, --quiet`: Whether to print values to the console
`-x, --maci-address `: The MACI contract address
`-o, --poll-id `: The poll id
`-n, --num-queue-ops `: The number of queue operations | diff --git a/website/versioned_docs/version-v1.2/deployment.md b/website/versioned_docs/version-v1.2/deployment.md index 0eaa232993..f0addee060 100644 --- a/website/versioned_docs/version-v1.2/deployment.md +++ b/website/versioned_docs/version-v1.2/deployment.md @@ -29,9 +29,9 @@ In order, these are the steps for contract deployment: ### Note on ZKey artifacts -For testing purposes, you can use the test zkeys and artifacts that you can download using `pnpm download:test-zkeys`. For production use, you can download the most recent artifacts that have undergone a trusted setup. Please refer to the [Trusted Setup](/docs/trusted-setup) section for more information. To download those, please use `pnpm download:ceremony-zkeys`. +For testing purposes, you can use the test zkeys and artifacts that you can download using `pnpm download:test-zkeys`. For production use, you can download the most recent artifacts that have undergone a trusted setup. Please refer to the [Trusted Setup](/docs/v1.2/trusted-setup) section for more information. To download those, please use `pnpm download:ceremony-zkeys`. -Please do not use test artifacts in production. If you do require zKeys configured for larger param sizes, please reach out to us if you will be using them in production and we'll discuss running a new ceremony for those parameters. To build new circuits artifacts for testing purposes, please refer to the [installation page](/docs/installation/#configure-circomkit) and to the [circuits](/docs/circuits) section. +Please do not use test artifacts in production. If you do require zKeys configured for larger param sizes, please reach out to us if you will be using them in production and we'll discuss running a new ceremony for those parameters. To build new circuits artifacts for testing purposes, please refer to the [installation page](/docs/v1.2/installation/#configure-circomkit) and to the [circuits](/docs/v1.2/circuits) section. ### Deployment using `maci-cli` @@ -118,5 +118,5 @@ Should you wish to deploy on a different network, you will need to update the [c 6. You will find all of the deployed contracts addresses and configs in the `deployed-contracts.json` file inside the contracts folder. :::info -You can find more information on integration and usage in the [Integrating MACI](/docs/integrating) section. +You can find more information on integration and usage in the [Integrating MACI](/docs/v1.2/integrating) section. ::: diff --git a/website/versioned_docs/version-v1.2/installation.md b/website/versioned_docs/version-v1.2/installation.md index d183fc0d30..7691522782 100644 --- a/website/versioned_docs/version-v1.2/installation.md +++ b/website/versioned_docs/version-v1.2/installation.md @@ -158,7 +158,7 @@ MACI has two main zk-SNARK circuits (plus an optional Subsidy circuit). Each cir Unless you wish to generate a fresh set of `.zkey` files, you should obtain them from someone who has performed a multi-party trusted setup for said -circuits. For more details on which artifacts have undergone a trusted setup, please refer to the [Trusted Setup](/docs/trusted-setup) page. +circuits. For more details on which artifacts have undergone a trusted setup, please refer to the [Trusted Setup](/docs/v1.2/trusted-setup) page. Note the locations of the `.zkey` files as the CLI requires them as command-line flags. diff --git a/website/versioned_docs/version-v1.2/overview.md b/website/versioned_docs/version-v1.2/overview.md index b549eba010..8dfc022805 100644 --- a/website/versioned_docs/version-v1.2/overview.md +++ b/website/versioned_docs/version-v1.2/overview.md @@ -22,7 +22,7 @@ in [Circom](https://iden3.io/circom). The MACI circuits are released through the [`@maci-circuits`](https://www.npmjs.com/package/maci-circuits) NPM package. -[Learn more about MACI circuits](/docs/circuits) +[Learn more about MACI circuits](/docs/v1.2/circuits) ## Smart contracts @@ -32,7 +32,7 @@ The MACI smart contracts are written in [Solidity](https://soliditylang.org/). Contracts are released through the [`@maci-contracts`](https://www.npmjs.com/package/maci-contracts) NPM package. -[Learn more about MACI contracts](/docs/contracts) +[Learn more about MACI contracts](/docs/v1.2/contracts) ## TypeScript libraries diff --git a/website/versioned_docs/version-v1.2/solidity-docs/MACI.md b/website/versioned_docs/version-v1.2/solidity-docs/MACI.md new file mode 100644 index 0000000000..17b38e374b --- /dev/null +++ b/website/versioned_docs/version-v1.2/solidity-docs/MACI.md @@ -0,0 +1,345 @@ +# MACI + +A contract which allows users to sign up, and deploy new polls + +### stateTreeDepth + +```solidity +uint8 stateTreeDepth +``` + +The state tree depth is fixed. As such it should be as large as feasible +so that there can be as many users as possible. i.e. 5 \*\* 10 = 9765625 +this should also match the parameter of the circom circuits. + +### STATE_TREE_SUBDEPTH + +```solidity +uint8 STATE_TREE_SUBDEPTH +``` + +IMPORTANT: remember to change the ballot tree depth +in contracts/ts/genEmptyBallotRootsContract.ts file +if we change the state tree depth! + +### TREE_ARITY + +```solidity +uint8 TREE_ARITY +``` + +### BLANK_STATE_LEAF_HASH + +```solidity +uint256 BLANK_STATE_LEAF_HASH +``` + +The hash of a blank state leaf + +### nextPollId + +```solidity +uint256 nextPollId +``` + +Each poll has an incrementing ID + +### polls + +```solidity +mapping(uint256 => address) polls +``` + +A mapping of poll IDs to Poll contracts. + +### subtreesMerged + +```solidity +bool subtreesMerged +``` + +Whether the subtrees have been merged (can merge root before new signup) + +### numSignUps + +```solidity +uint256 numSignUps +``` + +The number of signups + +### topupCredit + +```solidity +contract TopupCredit topupCredit +``` + +ERC20 contract that hold topup credits + +### pollFactory + +```solidity +contract IPollFactory pollFactory +``` + +Factory contract that deploy a Poll contract + +### messageProcessorFactory + +```solidity +contract IMessageProcessorFactory messageProcessorFactory +``` + +Factory contract that deploy a MessageProcessor contract + +### tallyFactory + +```solidity +contract ITallySubsidyFactory tallyFactory +``` + +Factory contract that deploy a Tally contract + +### subsidyFactory + +```solidity +contract ITallySubsidyFactory subsidyFactory +``` + +Factory contract that deploy a Subsidy contract + +### stateAq + +```solidity +contract AccQueue stateAq +``` + +The state AccQueue. Represents a mapping between each user's public key +and their voice credit balance. + +### signUpGatekeeper + +```solidity +contract SignUpGatekeeper signUpGatekeeper +``` + +Address of the SignUpGatekeeper, a contract which determines whether a +user may sign up to vote + +### initialVoiceCreditProxy + +```solidity +contract InitialVoiceCreditProxy initialVoiceCreditProxy +``` + +The contract which provides the values of the initial voice credit +balance per user + +### PollContracts + +```solidity +struct PollContracts { + address poll; + address messageProcessor; + address tally; + address subsidy; +} +``` + +### SignUp + +```solidity +event SignUp(uint256 _stateIndex, uint256 _userPubKeyX, uint256 _userPubKeyY, uint256 _voiceCreditBalance, uint256 _timestamp) +``` + +### DeployPoll + +```solidity +event DeployPoll(uint256 _pollId, uint256 _coordinatorPubKeyX, uint256 _coordinatorPubKeyY, struct MACI.PollContracts pollAddr) +``` + +### onlyPoll + +```solidity +modifier onlyPoll(uint256 _pollId) +``` + +Only allow a Poll contract to call the modified function. + +### CallerMustBePoll + +```solidity +error CallerMustBePoll(address _caller) +``` + +custom errors + +### PoseidonHashLibrariesNotLinked + +```solidity +error PoseidonHashLibrariesNotLinked() +``` + +### TooManySignups + +```solidity +error TooManySignups() +``` + +### MaciPubKeyLargerThanSnarkFieldSize + +```solidity +error MaciPubKeyLargerThanSnarkFieldSize() +``` + +### PreviousPollNotCompleted + +```solidity +error PreviousPollNotCompleted(uint256 pollId) +``` + +### PollDoesNotExist + +```solidity +error PollDoesNotExist(uint256 pollId) +``` + +### SignupTemporaryBlocked + +```solidity +error SignupTemporaryBlocked() +``` + +### constructor + +```solidity +constructor(contract IPollFactory _pollFactory, contract IMessageProcessorFactory _messageProcessorFactory, contract ITallySubsidyFactory _tallyFactory, contract ITallySubsidyFactory _subsidyFactory, contract SignUpGatekeeper _signUpGatekeeper, contract InitialVoiceCreditProxy _initialVoiceCreditProxy, contract TopupCredit _topupCredit, uint8 _stateTreeDepth) public payable +``` + +Create a new instance of the MACI contract. + +#### Parameters + +| Name | Type | Description | +| ------------------------- | --------------------------------- | ------------------------------------ | +| \_pollFactory | contract IPollFactory | The PollFactory contract | +| \_messageProcessorFactory | contract IMessageProcessorFactory | The MessageProcessorFactory contract | +| \_tallyFactory | contract ITallySubsidyFactory | The TallyFactory contract | +| \_subsidyFactory | contract ITallySubsidyFactory | The SubsidyFactory contract | +| \_signUpGatekeeper | contract SignUpGatekeeper | The SignUpGatekeeper contract | +| \_initialVoiceCreditProxy | contract InitialVoiceCreditProxy | The InitialVoiceCreditProxy contract | +| \_topupCredit | contract TopupCredit | The TopupCredit contract | +| \_stateTreeDepth | uint8 | The depth of the state tree | + +### signUp + +```solidity +function signUp(struct DomainObjs.PubKey _pubKey, bytes _signUpGatekeeperData, bytes _initialVoiceCreditProxyData) public virtual +``` + +Allows any eligible user sign up. The sign-up gatekeeper should prevent +double sign-ups or ineligible users from doing so. This function will +only succeed if the sign-up deadline has not passed. It also enqueues a +fresh state leaf into the state AccQueue. + +#### Parameters + +| Name | Type | Description | +| ----------------------------- | ------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| \_pubKey | struct DomainObjs.PubKey | The user's desired public key. | +| \_signUpGatekeeperData | bytes | Data to pass to the sign-up gatekeeper's register() function. For instance, the POAPGatekeeper or SignUpTokenGatekeeper requires this value to be the ABI-encoded token ID. | +| \_initialVoiceCreditProxyData | bytes | Data to pass to the InitialVoiceCreditProxy, which allows it to determine how many voice credits this user should have. | + +### deployPoll + +```solidity +function deployPoll(uint256 _duration, struct Params.TreeDepths _treeDepths, struct DomainObjs.PubKey _coordinatorPubKey, address _verifier, address _vkRegistry, bool useSubsidy) public virtual returns (struct MACI.PollContracts pollAddr) +``` + +Deploy a new Poll contract. + +#### Parameters + +| Name | Type | Description | +| ------------------- | ------------------------ | ----------------------------------------------- | +| \_duration | uint256 | How long should the Poll last for | +| \_treeDepths | struct Params.TreeDepths | The depth of the Merkle trees | +| \_coordinatorPubKey | struct DomainObjs.PubKey | The coordinator's public key | +| \_verifier | address | The Verifier Contract | +| \_vkRegistry | address | The VkRegistry Contract | +| useSubsidy | bool | If true, the Poll will use the Subsidy contract | + +#### Return Values + +| Name | Type | Description | +| -------- | ------------------------- | --------------------------- | +| pollAddr | struct MACI.PollContracts | a new Poll contract address | + +### mergeStateAqSubRoots + +```solidity +function mergeStateAqSubRoots(uint256 _numSrQueueOps, uint256 _pollId) public +``` + +Allow Poll contracts to merge the state subroots + +#### Parameters + +| Name | Type | Description | +| --------------- | ------- | ------------------------- | +| \_numSrQueueOps | uint256 | Number of operations | +| \_pollId | uint256 | The ID of the active Poll | + +### mergeStateAq + +```solidity +function mergeStateAq(uint256 _pollId) public returns (uint256 root) +``` + +Allow Poll contracts to merge the state root + +#### Parameters + +| Name | Type | Description | +| -------- | ------- | ------------------ | +| \_pollId | uint256 | The active Poll ID | + +#### Return Values + +| Name | Type | Description | +| ---- | ------- | -------------------------- | +| root | uint256 | The calculated Merkle root | + +### getStateAqRoot + +```solidity +function getStateAqRoot() public view returns (uint256 root) +``` + +Return the main root of the StateAq contract + +#### Return Values + +| Name | Type | Description | +| ---- | ------- | --------------- | +| root | uint256 | The Merkle root | + +### getPoll + +```solidity +function getPoll(uint256 _pollId) public view returns (address poll) +``` + +Get the Poll details + +#### Parameters + +| Name | Type | Description | +| -------- | ------- | -------------------------------------- | +| \_pollId | uint256 | The identifier of the Poll to retrieve | + +#### Return Values + +| Name | Type | Description | +| ---- | ------- | ------------------------ | +| poll | address | The Poll contract object | diff --git a/website/versioned_docs/version-v1.2/solidity-docs/MessageProcessor.md b/website/versioned_docs/version-v1.2/solidity-docs/MessageProcessor.md new file mode 100644 index 0000000000..8b7a087ee5 --- /dev/null +++ b/website/versioned_docs/version-v1.2/solidity-docs/MessageProcessor.md @@ -0,0 +1,266 @@ +# MessageProcessor + +_MessageProcessor is used to process messages published by signup users. +It will process message by batch due to large size of messages. +After it finishes processing, the sbCommitment will be used for Tally and Subsidy contracts._ + +### NoMoreMessages + +```solidity +error NoMoreMessages() +``` + +custom errors + +### StateAqNotMerged + +```solidity +error StateAqNotMerged() +``` + +### MessageAqNotMerged + +```solidity +error MessageAqNotMerged() +``` + +### InvalidProcessMessageProof + +```solidity +error InvalidProcessMessageProof() +``` + +### VkNotSet + +```solidity +error VkNotSet() +``` + +### MaxVoteOptionsTooLarge + +```solidity +error MaxVoteOptionsTooLarge() +``` + +### NumSignUpsTooLarge + +```solidity +error NumSignUpsTooLarge() +``` + +### CurrentMessageBatchIndexTooLarge + +```solidity +error CurrentMessageBatchIndexTooLarge() +``` + +### BatchEndIndexTooLarge + +```solidity +error BatchEndIndexTooLarge() +``` + +### TREE_ARITY + +```solidity +uint256 TREE_ARITY +``` + +### processingComplete + +```solidity +bool processingComplete +``` + +Get the result of whether there are unprocessed messages left + +#### Return Values + +| Name | Type | Description | +| ---- | ---- | ----------- | + +### numBatchesProcessed + +```solidity +uint256 numBatchesProcessed +``` + +The number of batches processed + +### currentMessageBatchIndex + +```solidity +uint256 currentMessageBatchIndex +``` + +The current message batch index. When the coordinator runs +processMessages(), this action relates to messages +currentMessageBatchIndex to currentMessageBatchIndex + messageBatchSize. + +### sbCommitment + +```solidity +uint256 sbCommitment +``` + +Get the commitment to the state and ballot roots + +#### Return Values + +| Name | Type | Description | +| ---- | ---- | ----------- | + +### poll + +```solidity +contract IPoll poll +``` + +### verifier + +```solidity +contract IVerifier verifier +``` + +### vkRegistry + +```solidity +contract IVkRegistry vkRegistry +``` + +### constructor + +```solidity +constructor(address _verifier, address _vkRegistry, address _poll) public payable +``` + +Create a new instance + +#### Parameters + +| Name | Type | Description | +| ------------ | ------- | ------------------------------- | +| \_verifier | address | The Verifier contract address | +| \_vkRegistry | address | The VkRegistry contract address | +| \_poll | address | The Poll contract address | + +### processMessages + +```solidity +function processMessages(uint256 _newSbCommitment, uint256[8] _proof) external +``` + +Update the Poll's currentSbCommitment if the proof is valid. + +#### Parameters + +| Name | Type | Description | +| ----------------- | ---------- | ------------------------------------------------------------------------------ | +| \_newSbCommitment | uint256 | The new state root and ballot root commitment after all messages are processed | +| \_proof | uint256[8] | The zk-SNARK proof | + +### verifyProcessProof + +```solidity +function verifyProcessProof(uint256 _currentMessageBatchIndex, uint256 _messageRoot, uint256 _currentSbCommitment, uint256 _newSbCommitment, uint8 _messageTreeSubDepth, uint8 _messageTreeDepth, uint8 _voteOptionTreeDepth, uint256[8] _proof) internal view returns (bool isValid) +``` + +Verify the proof for processMessage + +_used to update the sbCommitment_ + +#### Parameters + +| Name | Type | Description | +| -------------------------- | ---------- | ------------------------------------------------------- | +| \_currentMessageBatchIndex | uint256 | The batch index of current message batch | +| \_messageRoot | uint256 | The message tree root | +| \_currentSbCommitment | uint256 | The current sbCommitment (state and ballot) | +| \_newSbCommitment | uint256 | The new sbCommitment after we update this message batch | +| \_messageTreeSubDepth | uint8 | The message tree subdepth | +| \_messageTreeDepth | uint8 | The message tree depth | +| \_voteOptionTreeDepth | uint8 | The vote option tree depth | +| \_proof | uint256[8] | The zk-SNARK proof | + +#### Return Values + +| Name | Type | Description | +| ------- | ---- | -------------------------- | +| isValid | bool | Whether the proof is valid | + +### genProcessMessagesPublicInputHash + +```solidity +function genProcessMessagesPublicInputHash(uint256 _currentMessageBatchIndex, uint256 _messageRoot, uint256 _numSignUps, uint256 _numMessages, uint256 _currentSbCommitment, uint256 _newSbCommitment, uint8 _messageTreeSubDepth, uint8 _voteOptionTreeDepth) public view returns (uint256 inputHash) +``` + +Returns the SHA256 hash of the packed values (see +genProcessMessagesPackedVals), the hash of the coordinator's public key, +the message root, and the commitment to the current state root and +ballot root. By passing the SHA256 hash of these values to the circuit +as a single public input and the preimage as private inputs, we reduce +its verification gas cost though the number of constraints will be +higher and proving time will be longer. + +#### Parameters + +| Name | Type | Description | +| -------------------------- | ------- | ------------------------------------------------------- | +| \_currentMessageBatchIndex | uint256 | The batch index of current message batch | +| \_messageRoot | uint256 | | +| \_numSignUps | uint256 | The number of users that signup | +| \_numMessages | uint256 | The number of messages | +| \_currentSbCommitment | uint256 | The current sbCommitment (state and ballot root) | +| \_newSbCommitment | uint256 | The new sbCommitment after we update this message batch | +| \_messageTreeSubDepth | uint8 | The message tree subdepth | +| \_voteOptionTreeDepth | uint8 | | + +#### Return Values + +| Name | Type | Description | +| --------- | ------- | -------------------------------------------- | +| inputHash | uint256 | Returns the SHA256 hash of the packed values | + +### genProcessMessagesPackedVals + +```solidity +function genProcessMessagesPackedVals(uint256 _currentMessageBatchIndex, uint256 _numSignUps, uint256 _numMessages, uint8 _messageTreeSubDepth, uint8 _voteOptionTreeDepth) public pure returns (uint256 result) +``` + +One of the inputs to the ProcessMessages circuit is a 250-bit +representation of four 50-bit values. This function generates this +250-bit value, which consists of the maximum number of vote options, the +number of signups, the current message batch index, and the end index of +the current batch. + +#### Parameters + +| Name | Type | Description | +| -------------------------- | ------- | ------------------------------------ | +| \_currentMessageBatchIndex | uint256 | batch index of current message batch | +| \_numSignUps | uint256 | number of users that signup | +| \_numMessages | uint256 | number of messages | +| \_messageTreeSubDepth | uint8 | message tree subdepth | +| \_voteOptionTreeDepth | uint8 | vote option tree depth | + +#### Return Values + +| Name | Type | Description | +| ------ | ------- | ---------------- | +| result | uint256 | The packed value | + +### updateMessageProcessingData + +```solidity +function updateMessageProcessingData(uint256 _newSbCommitment, uint256 _currentMessageBatchIndex, bool _processingComplete) internal +``` + +update message processing state variables + +#### Parameters + +| Name | Type | Description | +| -------------------------- | ------- | ------------------------------------------------------- | +| \_newSbCommitment | uint256 | sbCommitment to be updated | +| \_currentMessageBatchIndex | uint256 | currentMessageBatchIndex to be updated | +| \_processingComplete | bool | update flag that indicate processing is finished or not | diff --git a/website/versioned_docs/version-v1.2/solidity-docs/MessageProcessorFactory.md b/website/versioned_docs/version-v1.2/solidity-docs/MessageProcessorFactory.md new file mode 100644 index 0000000000..83647631b1 --- /dev/null +++ b/website/versioned_docs/version-v1.2/solidity-docs/MessageProcessorFactory.md @@ -0,0 +1,26 @@ +# MessageProcessorFactory + +A factory contract which deploys MessageProcessor contracts. + +### deploy + +```solidity +function deploy(address _verifier, address _vkRegistry, address _poll, address _owner) public returns (address messageProcessorAddr) +``` + +Deploy a new MessageProcessor contract and return the address. + +#### Parameters + +| Name | Type | Description | +| ------------ | ------- | -------------------------------------- | +| \_verifier | address | Verifier contract | +| \_vkRegistry | address | VkRegistry contract | +| \_poll | address | Poll contract | +| \_owner | address | Owner of the MessageProcessor contract | + +#### Return Values + +| Name | Type | Description | +| -------------------- | ------- | -------------------------------------- | +| messageProcessorAddr | address | The deployed MessageProcessor contract | diff --git a/website/versioned_docs/version-v1.2/solidity-docs/Poll.md b/website/versioned_docs/version-v1.2/solidity-docs/Poll.md new file mode 100644 index 0000000000..df231a4631 --- /dev/null +++ b/website/versioned_docs/version-v1.2/solidity-docs/Poll.md @@ -0,0 +1,381 @@ +# Poll + +A Poll contract allows voters to submit encrypted messages +which can be either votes, key change messages or topup messages. + +_Do not deploy this directly. Use PollFactory.deploy() which performs some +checks on the Poll constructor arguments._ + +### isInit + +```solidity +bool isInit +``` + +Whether the Poll has been initialized + +### coordinatorPubKey + +```solidity +struct DomainObjs.PubKey coordinatorPubKey +``` + +The coordinator's public key + +### coordinatorPubKeyHash + +```solidity +uint256 coordinatorPubKeyHash +``` + +Hash of the coordinator's public key + +### mergedStateRoot + +```solidity +uint256 mergedStateRoot +``` + +the state root of the state merkle tree + +### deployTime + +```solidity +uint256 deployTime +``` + +### duration + +```solidity +uint256 duration +``` + +### stateAqMerged + +```solidity +bool stateAqMerged +``` + +Whether the MACI contract's stateAq has been merged by this contract + +### currentSbCommitment + +```solidity +uint256 currentSbCommitment +``` + +Get the commitment to the state leaves and the ballots. This is +hash3(stateRoot, ballotRoot, salt). +Its initial value should be +hash(maciStateRootSnapshot, emptyBallotRoot, 0) +Each successful invocation of processMessages() should use a different +salt to update this value, so that an external observer cannot tell in +the case that none of the messages are valid. + +### numMessages + +```solidity +uint256 numMessages +``` + +The number of messages that have been published + +### numSignups + +```solidity +uint256 numSignups +``` + +The number of signups that have been processed +before the Poll ended (stateAq merged) + +### maxValues + +```solidity +struct Params.MaxValues maxValues +``` + +Max values for the poll + +### treeDepths + +```solidity +struct Params.TreeDepths treeDepths +``` + +Depths of the merkle trees + +### extContracts + +```solidity +struct Params.ExtContracts extContracts +``` + +The contracts used by the Poll + +### VotingPeriodOver + +```solidity +error VotingPeriodOver() +``` + +### VotingPeriodNotOver + +```solidity +error VotingPeriodNotOver() +``` + +### PollAlreadyInit + +```solidity +error PollAlreadyInit() +``` + +### TooManyMessages + +```solidity +error TooManyMessages() +``` + +### MaciPubKeyLargerThanSnarkFieldSize + +```solidity +error MaciPubKeyLargerThanSnarkFieldSize() +``` + +### StateAqAlreadyMerged + +```solidity +error StateAqAlreadyMerged() +``` + +### StateAqSubtreesNeedMerge + +```solidity +error StateAqSubtreesNeedMerge() +``` + +### InvalidBatchLength + +```solidity +error InvalidBatchLength() +``` + +### PublishMessage + +```solidity +event PublishMessage(struct DomainObjs.Message _message, struct DomainObjs.PubKey _encPubKey) +``` + +### TopupMessage + +```solidity +event TopupMessage(struct DomainObjs.Message _message) +``` + +### MergeMaciStateAqSubRoots + +```solidity +event MergeMaciStateAqSubRoots(uint256 _numSrQueueOps) +``` + +### MergeMaciStateAq + +```solidity +event MergeMaciStateAq(uint256 _stateRoot, uint256 _numSignups) +``` + +### MergeMessageAqSubRoots + +```solidity +event MergeMessageAqSubRoots(uint256 _numSrQueueOps) +``` + +### MergeMessageAq + +```solidity +event MergeMessageAq(uint256 _messageRoot) +``` + +### constructor + +```solidity +constructor(uint256 _duration, struct Params.MaxValues _maxValues, struct Params.TreeDepths _treeDepths, struct DomainObjs.PubKey _coordinatorPubKey, struct Params.ExtContracts _extContracts) public payable +``` + +Each MACI instance can have multiple Polls. +When a Poll is deployed, its voting period starts immediately. + +#### Parameters + +| Name | Type | Description | +| ------------------- | -------------------------- | ----------------------------------------------- | +| \_duration | uint256 | The duration of the voting period, in seconds | +| \_maxValues | struct Params.MaxValues | The maximum number of messages and vote options | +| \_treeDepths | struct Params.TreeDepths | The depths of the merkle trees | +| \_coordinatorPubKey | struct DomainObjs.PubKey | The coordinator's public key | +| \_extContracts | struct Params.ExtContracts | The external contracts | + +### isAfterVotingDeadline + +```solidity +modifier isAfterVotingDeadline() +``` + +A modifier that causes the function to revert if the voting period is +not over. + +### isWithinVotingDeadline + +```solidity +modifier isWithinVotingDeadline() +``` + +A modifier that causes the function to revert if the voting period is +over + +### init + +```solidity +function init() public +``` + +The initialization function. + +_Should be called immediately after Poll creation +and messageAq ownership transferred_ + +### topup + +```solidity +function topup(uint256 stateIndex, uint256 amount) public virtual +``` + +Allows to publish a Topup message + +#### Parameters + +| Name | Type | Description | +| ---------- | ------- | ------------------------------------ | +| stateIndex | uint256 | The index of user in the state queue | +| amount | uint256 | The amount of credits to topup | + +### publishMessage + +```solidity +function publishMessage(struct DomainObjs.Message _message, struct DomainObjs.PubKey _encPubKey) public virtual +``` + +Allows anyone to publish a message (an encrypted command and signature). +This function also enqueues the message. + +#### Parameters + +| Name | Type | Description | +| ----------- | ------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- | +| \_message | struct DomainObjs.Message | The message to publish | +| \_encPubKey | struct DomainObjs.PubKey | An epheremal public key which can be combined with the coordinator's private key to generate an ECDH shared key with which to encrypt the message. | + +### publishMessageBatch + +```solidity +function publishMessageBatch(struct DomainObjs.Message[] _messages, struct DomainObjs.PubKey[] _encPubKeys) external +``` + +submit a message batch + +_Can only be submitted before the voting deadline_ + +#### Parameters + +| Name | Type | Description | +| ------------ | --------------------------- | ------------------------- | +| \_messages | struct DomainObjs.Message[] | the messages | +| \_encPubKeys | struct DomainObjs.PubKey[] | the encrypted public keys | + +### mergeMaciStateAqSubRoots + +```solidity +function mergeMaciStateAqSubRoots(uint256 _numSrQueueOps, uint256 _pollId) public +``` + +The first step of merging the MACI state AccQueue. This allows the +ProcessMessages circuit to access the latest state tree and ballots via +currentSbCommitment. + +#### Parameters + +| Name | Type | Description | +| --------------- | ------- | ------------------------- | +| \_numSrQueueOps | uint256 | Number of operations | +| \_pollId | uint256 | The ID of the active Poll | + +### mergeMaciStateAq + +```solidity +function mergeMaciStateAq(uint256 _pollId) public +``` + +The second step of merging the MACI state AccQueue. This allows the +ProcessMessages circuit to access the latest state tree and ballots via +currentSbCommitment. + +#### Parameters + +| Name | Type | Description | +| -------- | ------- | ------------------------- | +| \_pollId | uint256 | The ID of the active Poll | + +### mergeMessageAqSubRoots + +```solidity +function mergeMessageAqSubRoots(uint256 _numSrQueueOps) public +``` + +The first step in merging the message AccQueue so that the +ProcessMessages circuit can access the message root. + +#### Parameters + +| Name | Type | Description | +| --------------- | ------- | ------------------------------------------------- | +| \_numSrQueueOps | uint256 | The number of subroot queue operations to perform | + +### mergeMessageAq + +```solidity +function mergeMessageAq() public +``` + +The second step in merging the message AccQueue so that the +ProcessMessages circuit can access the message root. + +### getDeployTimeAndDuration + +```solidity +function getDeployTimeAndDuration() public view returns (uint256 pollDeployTime, uint256 pollDuration) +``` + +Returns the Poll's deploy time and duration + +#### Return Values + +| Name | Type | Description | +| -------------- | ------- | ----------- | +| pollDeployTime | uint256 | | +| pollDuration | uint256 | | + +### numSignUpsAndMessages + +```solidity +function numSignUpsAndMessages() public view returns (uint256 numSUps, uint256 numMsgs) +``` + +The number of messages which have been processed and the number of signups + +#### Return Values + +| Name | Type | Description | +| ------- | ------- | ------------------------------------- | +| numSUps | uint256 | | +| numMsgs | uint256 | The number of messages sent by voters | diff --git a/website/versioned_docs/version-v1.2/solidity-docs/PollFactory.md b/website/versioned_docs/version-v1.2/solidity-docs/PollFactory.md new file mode 100644 index 0000000000..28ed53ef99 --- /dev/null +++ b/website/versioned_docs/version-v1.2/solidity-docs/PollFactory.md @@ -0,0 +1,50 @@ +# PollFactory + +A factory contract which deploys Poll contracts. It allows the MACI contract +size to stay within the limit set by EIP-170. + +### TREE_ARITY + +```solidity +uint256 TREE_ARITY +``` + +### InvalidMaxValues + +```solidity +error InvalidMaxValues() +``` + +### constructor + +```solidity +constructor() public payable +``` + +The PollFactory constructor + +### deploy + +```solidity +function deploy(uint256 _duration, struct Params.MaxValues _maxValues, struct Params.TreeDepths _treeDepths, struct DomainObjs.PubKey _coordinatorPubKey, address _maci, contract TopupCredit _topupCredit, address _pollOwner) public virtual returns (address pollAddr) +``` + +Deploy a new Poll contract and AccQueue contract for messages. + +#### Parameters + +| Name | Type | Description | +| ------------------- | ------------------------ | ------------------------------------- | +| \_duration | uint256 | The duration of the poll | +| \_maxValues | struct Params.MaxValues | The max values for the poll | +| \_treeDepths | struct Params.TreeDepths | The depths of the merkle trees | +| \_coordinatorPubKey | struct DomainObjs.PubKey | The coordinator's public key | +| \_maci | address | The MACI contract interface reference | +| \_topupCredit | contract TopupCredit | The TopupCredit contract | +| \_pollOwner | address | The owner of the poll | + +#### Return Values + +| Name | Type | Description | +| -------- | ------- | -------------------------- | +| pollAddr | address | The deployed Poll contract | diff --git a/website/versioned_docs/version-v1.2/solidity-docs/SignUpToken.md b/website/versioned_docs/version-v1.2/solidity-docs/SignUpToken.md new file mode 100644 index 0000000000..0e9d9ac44f --- /dev/null +++ b/website/versioned_docs/version-v1.2/solidity-docs/SignUpToken.md @@ -0,0 +1,27 @@ +# SignUpToken + +This contract is an ERC721 token contract which +can be used to allow users to sign up for a poll. + +### constructor + +```solidity +constructor() public payable +``` + +The constructor which calls the ERC721 constructor + +### giveToken + +```solidity +function giveToken(address to, uint256 curTokenId) public +``` + +Gives an ERC721 token to an address + +#### Parameters + +| Name | Type | Description | +| ---------- | ------- | -------------------------------- | +| to | address | The address to give the token to | +| curTokenId | uint256 | The token id to give | diff --git a/website/versioned_docs/version-v1.2/solidity-docs/Subsidy.md b/website/versioned_docs/version-v1.2/solidity-docs/Subsidy.md new file mode 100644 index 0000000000..0517d67aa5 --- /dev/null +++ b/website/versioned_docs/version-v1.2/solidity-docs/Subsidy.md @@ -0,0 +1,218 @@ +# Subsidy + +This contract is used to verify that the subsidy calculations +are correct. It is also used to update the subsidy commitment if the +proof is valid. + +### rbi + +```solidity +uint256 rbi +``` + +### cbi + +```solidity +uint256 cbi +``` + +### sbCommitment + +```solidity +uint256 sbCommitment +``` + +### subsidyCommitment + +```solidity +uint256 subsidyCommitment +``` + +### verifier + +```solidity +contract IVerifier verifier +``` + +### vkRegistry + +```solidity +contract IVkRegistry vkRegistry +``` + +### poll + +```solidity +contract IPoll poll +``` + +### mp + +```solidity +contract IMessageProcessor mp +``` + +### ProcessingNotComplete + +```solidity +error ProcessingNotComplete() +``` + +### InvalidSubsidyProof + +```solidity +error InvalidSubsidyProof() +``` + +### AllSubsidyCalculated + +```solidity +error AllSubsidyCalculated() +``` + +### VkNotSet + +```solidity +error VkNotSet() +``` + +### NumSignUpsTooLarge + +```solidity +error NumSignUpsTooLarge() +``` + +### RbiTooLarge + +```solidity +error RbiTooLarge() +``` + +### CbiTooLarge + +```solidity +error CbiTooLarge() +``` + +### constructor + +```solidity +constructor(address _verifier, address _vkRegistry, address _poll, address _mp) public payable +``` + +Create a new Subsidy contract + +#### Parameters + +| Name | Type | Description | +| ------------ | ------- | ----------------------------- | +| \_verifier | address | The Verifier contract | +| \_vkRegistry | address | The VkRegistry contract | +| \_poll | address | The Poll contract | +| \_mp | address | The MessageProcessor contract | + +### updateSbCommitment + +```solidity +function updateSbCommitment() public +``` + +Update the currentSbCommitment if the proof is valid. + +_currentSbCommitment is the commitment to the state and ballot roots_ + +### genSubsidyPackedVals + +```solidity +function genSubsidyPackedVals(uint256 _numSignUps) public view returns (uint256 result) +``` + +Generate the packed values for the subsidy proof + +#### Parameters + +| Name | Type | Description | +| ------------ | ------- | --------------------- | +| \_numSignUps | uint256 | The number of signups | + +#### Return Values + +| Name | Type | Description | +| ------ | ------- | ----------------- | +| result | uint256 | The packed values | + +### genSubsidyPublicInputHash + +```solidity +function genSubsidyPublicInputHash(uint256 _numSignUps, uint256 _newSubsidyCommitment) public view returns (uint256 inputHash) +``` + +Generate the public input hash for the subsidy proof + +#### Parameters + +| Name | Type | Description | +| ---------------------- | ------- | -------------------------- | +| \_numSignUps | uint256 | The number of signups | +| \_newSubsidyCommitment | uint256 | The new subsidy commitment | + +#### Return Values + +| Name | Type | Description | +| --------- | ------- | --------------------- | +| inputHash | uint256 | The public input hash | + +### updateSubsidy + +```solidity +function updateSubsidy(uint256 _newSubsidyCommitment, uint256[8] _proof) external +``` + +Update the subsidy commitment if the proof is valid + +#### Parameters + +| Name | Type | Description | +| ---------------------- | ---------- | -------------------------- | +| \_newSubsidyCommitment | uint256 | The new subsidy commitment | +| \_proof | uint256[8] | The proof | + +### increaseSubsidyIndex + +```solidity +function increaseSubsidyIndex(uint256 batchSize, uint256 numLeaves) internal +``` + +Increase the subsidy batch index (rbi, cbi) to next, +it will try to cbi++ if the whole batch can fit into numLeaves +otherwise it will increase row index: rbi++. +Each batch for subsidy calculation is 2 dimensional: batchSize\*batchSize + +#### Parameters + +| Name | Type | Description | +| --------- | ------- | ---------------------------------------------------------------- | +| batchSize | uint256 | the size of 1 dimensional batch over the signup users | +| numLeaves | uint256 | total number of leaves in stateTree, i.e. number of signup users | + +### verifySubsidyProof + +```solidity +function verifySubsidyProof(uint256[8] _proof, uint256 _numSignUps, uint256 _newSubsidyCommitment) public view returns (bool isValid) +``` + +Verify the subsidy proof using the Groth16 on chain verifier + +#### Parameters + +| Name | Type | Description | +| ---------------------- | ---------- | -------------------------- | +| \_proof | uint256[8] | The proof | +| \_numSignUps | uint256 | The number of signups | +| \_newSubsidyCommitment | uint256 | The new subsidy commitment | + +#### Return Values + +| Name | Type | Description | +| ------- | ---- | -------------------------- | +| isValid | bool | True if the proof is valid | diff --git a/website/versioned_docs/version-v1.2/solidity-docs/SubsidyFactory.md b/website/versioned_docs/version-v1.2/solidity-docs/SubsidyFactory.md new file mode 100644 index 0000000000..9af20d6baa --- /dev/null +++ b/website/versioned_docs/version-v1.2/solidity-docs/SubsidyFactory.md @@ -0,0 +1,27 @@ +# SubsidyFactory + +A factory contract which deploys Subsidy contracts. + +### deploy + +```solidity +function deploy(address _verifier, address _vkRegistry, address _poll, address _messageProcessor, address _owner) public returns (address subsidyAddr) +``` + +Deploy a new Tally or Subsidy contract and return the address. + +#### Parameters + +| Name | Type | Description | +| ------------------ | ------- | ------------------------- | +| \_verifier | address | Verifier contract | +| \_vkRegistry | address | VkRegistry contract | +| \_poll | address | Poll contract | +| \_messageProcessor | address | MessageProcessor contract | +| \_owner | address | Owner of the contract | + +#### Return Values + +| Name | Type | Description | +| ----------- | ------- | --------------------- | +| subsidyAddr | address | The deployed contract | diff --git a/website/versioned_docs/version-v1.2/solidity-docs/Tally.md b/website/versioned_docs/version-v1.2/solidity-docs/Tally.md new file mode 100644 index 0000000000..bc4a272001 --- /dev/null +++ b/website/versioned_docs/version-v1.2/solidity-docs/Tally.md @@ -0,0 +1,311 @@ +# Tally + +The Tally contract is used during votes tallying +and by users to verify the tally results. + +### TREE_ARITY + +```solidity +uint256 TREE_ARITY +``` + +### tallyCommitment + +```solidity +uint256 tallyCommitment +``` + +The commitment to the tally results. Its initial value is 0, but after +the tally of each batch is proven on-chain via a zk-SNARK, it should be +updated to: + +hash3( +hashLeftRight(merkle root of current results, salt0) +hashLeftRight(number of spent voice credits, salt1), +hashLeftRight(merkle root of the no. of spent voice credits per vote option, salt2) +) + +Where each salt is unique and the merkle roots are of arrays of leaves +TREE_ARITY \*\* voteOptionTreeDepth long. + +### tallyBatchNum + +```solidity +uint256 tallyBatchNum +``` + +### sbCommitment + +```solidity +uint256 sbCommitment +``` + +### verifier + +```solidity +contract IVerifier verifier +``` + +### vkRegistry + +```solidity +contract IVkRegistry vkRegistry +``` + +### poll + +```solidity +contract IPoll poll +``` + +### messageProcessor + +```solidity +contract IMessageProcessor messageProcessor +``` + +### ProcessingNotComplete + +```solidity +error ProcessingNotComplete() +``` + +custom errors + +### InvalidTallyVotesProof + +```solidity +error InvalidTallyVotesProof() +``` + +### AllBallotsTallied + +```solidity +error AllBallotsTallied() +``` + +### NumSignUpsTooLarge + +```solidity +error NumSignUpsTooLarge() +``` + +### BatchStartIndexTooLarge + +```solidity +error BatchStartIndexTooLarge() +``` + +### TallyBatchSizeTooLarge + +```solidity +error TallyBatchSizeTooLarge() +``` + +### constructor + +```solidity +constructor(address _verifier, address _vkRegistry, address _poll, address _mp) public payable +``` + +Create a new Tally contract + +#### Parameters + +| Name | Type | Description | +| ------------ | ------- | ----------------------------- | +| \_verifier | address | The Verifier contract | +| \_vkRegistry | address | The VkRegistry contract | +| \_poll | address | The Poll contract | +| \_mp | address | The MessageProcessor contract | + +### genTallyVotesPackedVals + +```solidity +function genTallyVotesPackedVals(uint256 _numSignUps, uint256 _batchStartIndex, uint256 _tallyBatchSize) public pure returns (uint256 result) +``` + +Pack the batch start index and number of signups into a 100-bit value. + +#### Parameters + +| Name | Type | Description | +| ----------------- | ------- | ----------- | +| \_numSignUps | uint256 | | +| \_batchStartIndex | uint256 | | +| \_tallyBatchSize | uint256 | | + +#### Return Values + +| Name | Type | Description | +| ------ | ------- | ---------------------------------------------------- | +| result | uint256 | an uint256 representing the 3 inputs packed together | + +### isTallied + +```solidity +function isTallied() public view returns (bool tallied) +``` + +Check if all ballots are tallied + +#### Return Values + +| Name | Type | Description | +| ------- | ---- | ------------------------------- | +| tallied | bool | whether all ballots are tallied | + +### genTallyVotesPublicInputHash + +```solidity +function genTallyVotesPublicInputHash(uint256 _numSignUps, uint256 _batchStartIndex, uint256 _tallyBatchSize, uint256 _newTallyCommitment) public view returns (uint256 inputHash) +``` + +generate hash of public inputs for tally circuit + +#### Parameters + +| Name | Type | Description | +| -------------------- | ------- | ----------- | +| \_numSignUps | uint256 | | +| \_batchStartIndex | uint256 | | +| \_tallyBatchSize | uint256 | | +| \_newTallyCommitment | uint256 | | + +#### Return Values + +| Name | Type | Description | +| --------- | ------- | --------------------- | +| inputHash | uint256 | hash of public inputs | + +### updateSbCommitment + +```solidity +function updateSbCommitment() public +``` + +Update the state and ballot root commitment + +### tallyVotes + +```solidity +function tallyVotes(uint256 _newTallyCommitment, uint256[8] _proof) public +``` + +Verify the result of a tally batch + +#### Parameters + +| Name | Type | Description | +| -------------------- | ---------- | --------------------------------------------- | +| \_newTallyCommitment | uint256 | the new tally commitment to be verified | +| \_proof | uint256[8] | the proof generated after tallying this batch | + +### verifyTallyProof + +```solidity +function verifyTallyProof(uint256[8] _proof, uint256 _numSignUps, uint256 _batchStartIndex, uint256 _tallyBatchSize, uint256 _newTallyCommitment) public view returns (bool isValid) +``` + +Verify the tally proof using the verifying key + +#### Parameters + +| Name | Type | Description | +| -------------------- | ---------- | ---------------------------------------------------------- | +| \_proof | uint256[8] | the proof generated after processing all messages | +| \_numSignUps | uint256 | number of signups for a given poll | +| \_batchStartIndex | uint256 | the number of batches multiplied by the size of the batch | +| \_tallyBatchSize | uint256 | batch size for the tally | +| \_newTallyCommitment | uint256 | the tally commitment to be verified at a given batch index | + +#### Return Values + +| Name | Type | Description | +| ------- | ---- | -------------------------- | +| isValid | bool | whether the proof is valid | + +### computeMerkleRootFromPath + +```solidity +function computeMerkleRootFromPath(uint8 _depth, uint256 _index, uint256 _leaf, uint256[][] _pathElements) internal pure returns (uint256 current) +``` + +Compute the merkle root from the path elements +and a leaf + +#### Parameters + +| Name | Type | Description | +| -------------- | ----------- | ------------------------------------------------ | +| \_depth | uint8 | the depth of the merkle tree | +| \_index | uint256 | the index of the leaf | +| \_leaf | uint256 | the leaf | +| \_pathElements | uint256[][] | the path elements to reconstruct the merkle root | + +#### Return Values + +| Name | Type | Description | +| ------- | ------- | --------------- | +| current | uint256 | The merkle root | + +### verifySpentVoiceCredits + +```solidity +function verifySpentVoiceCredits(uint256 _totalSpent, uint256 _totalSpentSalt, uint256 _resultCommitment, uint256 _perVOSpentVoiceCreditsHash) public view returns (bool isValid) +``` + +Verify the number of spent voice credits from the tally.json + +#### Parameters + +| Name | Type | Description | +| ---------------------------- | ------- | -------------------------------------------------------------------------------- | +| \_totalSpent | uint256 | spent field retrieved in the totalSpentVoiceCredits object | +| \_totalSpentSalt | uint256 | the corresponding salt in the totalSpentVoiceCredit object | +| \_resultCommitment | uint256 | hashLeftRight(merkle root of the results.tally, results.salt) in tally.json file | +| \_perVOSpentVoiceCreditsHash | uint256 | hashLeftRight(merkle root of the no spent voice credits per vote option, salt) | + +#### Return Values + +| Name | Type | Description | +| ------- | ---- | ------------------------------------- | +| isValid | bool | Whether the provided values are valid | + +### verifyPerVOSpentVoiceCredits + +```solidity +function verifyPerVOSpentVoiceCredits(uint256 _voteOptionIndex, uint256 _spent, uint256[][] _spentProof, uint256 _spentSalt, uint8 _voteOptionTreeDepth, uint256 _spentVoiceCreditsHash, uint256 _resultCommitment) public view returns (bool isValid) +``` + +#### Return Values + +| Name | Type | Description | +| ------- | ---- | ----------------------------------- | +| isValid | bool | Whether the provided proof is valid | + +### verifyTallyResult + +```solidity +function verifyTallyResult(uint256 _voteOptionIndex, uint256 _tallyResult, uint256[][] _tallyResultProof, uint256 _tallyResultSalt, uint8 _voteOptionTreeDepth, uint256 _spentVoiceCreditsHash, uint256 _perVOSpentVoiceCreditsHash) public view returns (bool isValid) +``` + +Verify the result generated from the tally.json + +#### Parameters + +| Name | Type | Description | +| ---------------------------- | ----------- | ----------------------------------------------------------------------------------------------------- | +| \_voteOptionIndex | uint256 | the index of the vote option to verify the correctness of the tally | +| \_tallyResult | uint256 | Flattened array of the tally | +| \_tallyResultProof | uint256[][] | Corresponding proof of the tally result | +| \_tallyResultSalt | uint256 | the respective salt in the results object in the tally.json | +| \_voteOptionTreeDepth | uint8 | depth of the vote option tree | +| \_spentVoiceCreditsHash | uint256 | hashLeftRight(number of spent voice credits, spent salt) | +| \_perVOSpentVoiceCreditsHash | uint256 | hashLeftRight(merkle root of the no spent voice credits per vote option, perVOSpentVoiceCredits salt) | + +#### Return Values + +| Name | Type | Description | +| ------- | ---- | ----------------------------------- | +| isValid | bool | Whether the provided proof is valid | diff --git a/website/versioned_docs/version-v1.2/solidity-docs/TallyFactory.md b/website/versioned_docs/version-v1.2/solidity-docs/TallyFactory.md new file mode 100644 index 0000000000..1cefd45f0a --- /dev/null +++ b/website/versioned_docs/version-v1.2/solidity-docs/TallyFactory.md @@ -0,0 +1,27 @@ +# TallyFactory + +A factory contract which deploys Tally contracts. + +### deploy + +```solidity +function deploy(address _verifier, address _vkRegistry, address _poll, address _messageProcessor, address _owner) public virtual returns (address tallyAddr) +``` + +Deploy a new Tally or Subsidy contract and return the address. + +#### Parameters + +| Name | Type | Description | +| ------------------ | ------- | ------------------------- | +| \_verifier | address | Verifier contract | +| \_vkRegistry | address | VkRegistry contract | +| \_poll | address | Poll contract | +| \_messageProcessor | address | MessageProcessor contract | +| \_owner | address | Owner of the contract | + +#### Return Values + +| Name | Type | Description | +| --------- | ------- | --------------------- | +| tallyAddr | address | The deployed contract | diff --git a/website/versioned_docs/version-v1.2/solidity-docs/TallyNonQv.md b/website/versioned_docs/version-v1.2/solidity-docs/TallyNonQv.md new file mode 100644 index 0000000000..1197012e16 --- /dev/null +++ b/website/versioned_docs/version-v1.2/solidity-docs/TallyNonQv.md @@ -0,0 +1,296 @@ +# TallyNonQv + +The TallyNonQv contract is used during votes tallying +and by users to verify the tally results. + +### TREE_ARITY + +```solidity +uint256 TREE_ARITY +``` + +### tallyCommitment + +```solidity +uint256 tallyCommitment +``` + +The commitment to the tally results. Its initial value is 0, but after +the tally of each batch is proven on-chain via a zk-SNARK, it should be +updated to: + +hash2( +hashLeftRight(merkle root of current results, salt0) +hashLeftRight(number of spent voice credits, salt1), +) + +Where each salt is unique and the merkle roots are of arrays of leaves +TREE_ARITY \*\* voteOptionTreeDepth long. + +### tallyBatchNum + +```solidity +uint256 tallyBatchNum +``` + +### sbCommitment + +```solidity +uint256 sbCommitment +``` + +### verifier + +```solidity +contract IVerifier verifier +``` + +### vkRegistry + +```solidity +contract IVkRegistry vkRegistry +``` + +### poll + +```solidity +contract IPoll poll +``` + +### messageProcessor + +```solidity +contract IMessageProcessor messageProcessor +``` + +### ProcessingNotComplete + +```solidity +error ProcessingNotComplete() +``` + +custom errors + +### InvalidTallyVotesProof + +```solidity +error InvalidTallyVotesProof() +``` + +### AllBallotsTallied + +```solidity +error AllBallotsTallied() +``` + +### NumSignUpsTooLarge + +```solidity +error NumSignUpsTooLarge() +``` + +### BatchStartIndexTooLarge + +```solidity +error BatchStartIndexTooLarge() +``` + +### TallyBatchSizeTooLarge + +```solidity +error TallyBatchSizeTooLarge() +``` + +### constructor + +```solidity +constructor(address _verifier, address _vkRegistry, address _poll, address _mp) public payable +``` + +Create a new Tally contract + +#### Parameters + +| Name | Type | Description | +| ------------ | ------- | ----------------------------- | +| \_verifier | address | The Verifier contract | +| \_vkRegistry | address | The VkRegistry contract | +| \_poll | address | The Poll contract | +| \_mp | address | The MessageProcessor contract | + +### genTallyVotesPackedVals + +```solidity +function genTallyVotesPackedVals(uint256 _numSignUps, uint256 _batchStartIndex, uint256 _tallyBatchSize) public pure returns (uint256 result) +``` + +Pack the batch start index and number of signups into a 100-bit value. + +#### Parameters + +| Name | Type | Description | +| ----------------- | ------- | ----------- | +| \_numSignUps | uint256 | | +| \_batchStartIndex | uint256 | | +| \_tallyBatchSize | uint256 | | + +#### Return Values + +| Name | Type | Description | +| ------ | ------- | ---------------------------------------------------- | +| result | uint256 | an uint256 representing the 3 inputs packed together | + +### isTallied + +```solidity +function isTallied() public view returns (bool tallied) +``` + +Check if all ballots are tallied + +#### Return Values + +| Name | Type | Description | +| ------- | ---- | ------------------------------- | +| tallied | bool | whether all ballots are tallied | + +### genTallyVotesPublicInputHash + +```solidity +function genTallyVotesPublicInputHash(uint256 _numSignUps, uint256 _batchStartIndex, uint256 _tallyBatchSize, uint256 _newTallyCommitment) public view returns (uint256 inputHash) +``` + +generate hash of public inputs for tally circuit + +#### Parameters + +| Name | Type | Description | +| -------------------- | ------- | ----------- | +| \_numSignUps | uint256 | | +| \_batchStartIndex | uint256 | | +| \_tallyBatchSize | uint256 | | +| \_newTallyCommitment | uint256 | | + +#### Return Values + +| Name | Type | Description | +| --------- | ------- | --------------------- | +| inputHash | uint256 | hash of public inputs | + +### updateSbCommitment + +```solidity +function updateSbCommitment() public +``` + +Update the state and ballot root commitment + +### tallyVotes + +```solidity +function tallyVotes(uint256 _newTallyCommitment, uint256[8] _proof) public +``` + +Verify the result of a tally batch + +#### Parameters + +| Name | Type | Description | +| -------------------- | ---------- | --------------------------------------------- | +| \_newTallyCommitment | uint256 | the new tally commitment to be verified | +| \_proof | uint256[8] | the proof generated after tallying this batch | + +### verifyTallyProof + +```solidity +function verifyTallyProof(uint256[8] _proof, uint256 _numSignUps, uint256 _batchStartIndex, uint256 _tallyBatchSize, uint256 _newTallyCommitment) public view returns (bool isValid) +``` + +Verify the tally proof using the verifying key + +#### Parameters + +| Name | Type | Description | +| -------------------- | ---------- | ---------------------------------------------------------- | +| \_proof | uint256[8] | the proof generated after processing all messages | +| \_numSignUps | uint256 | number of signups for a given poll | +| \_batchStartIndex | uint256 | the number of batches multiplied by the size of the batch | +| \_tallyBatchSize | uint256 | batch size for the tally | +| \_newTallyCommitment | uint256 | the tally commitment to be verified at a given batch index | + +#### Return Values + +| Name | Type | Description | +| ------- | ---- | -------------------------- | +| isValid | bool | whether the proof is valid | + +### computeMerkleRootFromPath + +```solidity +function computeMerkleRootFromPath(uint8 _depth, uint256 _index, uint256 _leaf, uint256[][] _pathElements) internal pure returns (uint256 current) +``` + +Compute the merkle root from the path elements +and a leaf + +#### Parameters + +| Name | Type | Description | +| -------------- | ----------- | ------------------------------------------------ | +| \_depth | uint8 | the depth of the merkle tree | +| \_index | uint256 | the index of the leaf | +| \_leaf | uint256 | the leaf | +| \_pathElements | uint256[][] | the path elements to reconstruct the merkle root | + +#### Return Values + +| Name | Type | Description | +| ------- | ------- | --------------- | +| current | uint256 | The merkle root | + +### verifySpentVoiceCredits + +```solidity +function verifySpentVoiceCredits(uint256 _totalSpent, uint256 _totalSpentSalt, uint256 _resultCommitment) public view returns (bool isValid) +``` + +Verify the number of spent voice credits from the tally.json + +#### Parameters + +| Name | Type | Description | +| ------------------ | ------- | -------------------------------------------------------------------------------- | +| \_totalSpent | uint256 | spent field retrieved in the totalSpentVoiceCredits object | +| \_totalSpentSalt | uint256 | the corresponding salt in the totalSpentVoiceCredit object | +| \_resultCommitment | uint256 | hashLeftRight(merkle root of the results.tally, results.salt) in tally.json file | + +#### Return Values + +| Name | Type | Description | +| ------- | ---- | ------------------------------------- | +| isValid | bool | Whether the provided values are valid | + +### verifyTallyResult + +```solidity +function verifyTallyResult(uint256 _voteOptionIndex, uint256 _tallyResult, uint256[][] _tallyResultProof, uint256 _tallyResultSalt, uint8 _voteOptionTreeDepth, uint256 _spentVoiceCreditsHash) public view returns (bool isValid) +``` + +Verify the result generated from the tally.json + +#### Parameters + +| Name | Type | Description | +| ----------------------- | ----------- | ------------------------------------------------------------------- | +| \_voteOptionIndex | uint256 | the index of the vote option to verify the correctness of the tally | +| \_tallyResult | uint256 | Flattened array of the tally | +| \_tallyResultProof | uint256[][] | Corresponding proof of the tally result | +| \_tallyResultSalt | uint256 | the respective salt in the results object in the tally.json | +| \_voteOptionTreeDepth | uint8 | depth of the vote option tree | +| \_spentVoiceCreditsHash | uint256 | hashLeftRight(number of spent voice credits, spent salt) | + +#### Return Values + +| Name | Type | Description | +| ------- | ---- | ----------------------------------- | +| isValid | bool | Whether the provided proof is valid | diff --git a/website/versioned_docs/version-v1.2/solidity-docs/TallyNonQvFactory.md b/website/versioned_docs/version-v1.2/solidity-docs/TallyNonQvFactory.md new file mode 100644 index 0000000000..e10b887138 --- /dev/null +++ b/website/versioned_docs/version-v1.2/solidity-docs/TallyNonQvFactory.md @@ -0,0 +1,27 @@ +# TallyNonQvFactory + +A factory contract which deploys TallyNonQv contracts. + +### deploy + +```solidity +function deploy(address _verifier, address _vkRegistry, address _poll, address _messageProcessor, address _owner) public virtual returns (address tallyAddr) +``` + +Deploy a new Tally or Subsidy contract and return the address. + +#### Parameters + +| Name | Type | Description | +| ------------------ | ------- | ------------------------- | +| \_verifier | address | Verifier contract | +| \_vkRegistry | address | VkRegistry contract | +| \_poll | address | Poll contract | +| \_messageProcessor | address | MessageProcessor contract | +| \_owner | address | Owner of the contract | + +#### Return Values + +| Name | Type | Description | +| --------- | ------- | --------------------- | +| tallyAddr | address | The deployed contract | diff --git a/website/versioned_docs/version-v1.2/solidity-docs/TopupCredit.md b/website/versioned_docs/version-v1.2/solidity-docs/TopupCredit.md new file mode 100644 index 0000000000..e5c20324be --- /dev/null +++ b/website/versioned_docs/version-v1.2/solidity-docs/TopupCredit.md @@ -0,0 +1,61 @@ +# TopupCredit + +A contract representing a token used to topup a MACI's voter +credits + +### DECIMALS + +```solidity +uint8 DECIMALS +``` + +### MAXIMUM_AIRDROP_AMOUNT + +```solidity +uint256 MAXIMUM_AIRDROP_AMOUNT +``` + +### ExceedLimit + +```solidity +error ExceedLimit() +``` + +custom errors + +### constructor + +```solidity +constructor() public payable +``` + +create a new TopupCredit token + +### airdropTo + +```solidity +function airdropTo(address account, uint256 amount) public +``` + +mint tokens to an account + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | ----------------------------- | +| account | address | the account to mint tokens to | +| amount | uint256 | the amount of tokens to mint | + +### airdrop + +```solidity +function airdrop(uint256 amount) public +``` + +mint tokens to the contract owner + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | ---------------------------- | +| amount | uint256 | the amount of tokens to mint | diff --git a/website/versioned_docs/version-v1.2/solidity-docs/VkRegistry.md b/website/versioned_docs/version-v1.2/solidity-docs/VkRegistry.md new file mode 100644 index 0000000000..4d4777d0ed --- /dev/null +++ b/website/versioned_docs/version-v1.2/solidity-docs/VkRegistry.md @@ -0,0 +1,457 @@ +# VkRegistry + +Stores verifying keys for the circuits. +Each circuit has a signature which is its compile-time constants represented +as a uint256. + +### processVks + +```solidity +mapping(uint256 => struct SnarkCommon.VerifyingKey) processVks +``` + +### processVkSet + +```solidity +mapping(uint256 => bool) processVkSet +``` + +### tallyVks + +```solidity +mapping(uint256 => struct SnarkCommon.VerifyingKey) tallyVks +``` + +### tallyVkSet + +```solidity +mapping(uint256 => bool) tallyVkSet +``` + +### subsidyVks + +```solidity +mapping(uint256 => struct SnarkCommon.VerifyingKey) subsidyVks +``` + +### subsidyVkSet + +```solidity +mapping(uint256 => bool) subsidyVkSet +``` + +### ProcessVkSet + +```solidity +event ProcessVkSet(uint256 _sig) +``` + +### TallyVkSet + +```solidity +event TallyVkSet(uint256 _sig) +``` + +### SubsidyVkSet + +```solidity +event SubsidyVkSet(uint256 _sig) +``` + +### ProcessVkAlreadySet + +```solidity +error ProcessVkAlreadySet() +``` + +### TallyVkAlreadySet + +```solidity +error TallyVkAlreadySet() +``` + +### SubsidyVkAlreadySet + +```solidity +error SubsidyVkAlreadySet() +``` + +### ProcessVkNotSet + +```solidity +error ProcessVkNotSet() +``` + +### TallyVkNotSet + +```solidity +error TallyVkNotSet() +``` + +### SubsidyVkNotSet + +```solidity +error SubsidyVkNotSet() +``` + +### constructor + +```solidity +constructor() public payable +``` + +Create a new instance of the VkRegistry contract + +### isProcessVkSet + +```solidity +function isProcessVkSet(uint256 _sig) public view returns (bool isSet) +``` + +Check if the process verifying key is set + +#### Parameters + +| Name | Type | Description | +| ----- | ------- | ------------- | +| \_sig | uint256 | The signature | + +#### Return Values + +| Name | Type | Description | +| ----- | ---- | -------------------------------- | +| isSet | bool | whether the verifying key is set | + +### isTallyVkSet + +```solidity +function isTallyVkSet(uint256 _sig) public view returns (bool isSet) +``` + +Check if the tally verifying key is set + +#### Parameters + +| Name | Type | Description | +| ----- | ------- | ------------- | +| \_sig | uint256 | The signature | + +#### Return Values + +| Name | Type | Description | +| ----- | ---- | -------------------------------- | +| isSet | bool | whether the verifying key is set | + +### isSubsidyVkSet + +```solidity +function isSubsidyVkSet(uint256 _sig) public view returns (bool isSet) +``` + +Check if the subsidy verifying key is set + +#### Parameters + +| Name | Type | Description | +| ----- | ------- | ------------- | +| \_sig | uint256 | The signature | + +#### Return Values + +| Name | Type | Description | +| ----- | ---- | -------------------------------- | +| isSet | bool | whether the verifying key is set | + +### genProcessVkSig + +```solidity +function genProcessVkSig(uint256 _stateTreeDepth, uint256 _messageTreeDepth, uint256 _voteOptionTreeDepth, uint256 _messageBatchSize) public pure returns (uint256 sig) +``` + +generate the signature for the process verifying key + +#### Parameters + +| Name | Type | Description | +| --------------------- | ------- | -------------------------- | +| \_stateTreeDepth | uint256 | The state tree depth | +| \_messageTreeDepth | uint256 | The message tree depth | +| \_voteOptionTreeDepth | uint256 | The vote option tree depth | +| \_messageBatchSize | uint256 | The message batch size | + +### genTallyVkSig + +```solidity +function genTallyVkSig(uint256 _stateTreeDepth, uint256 _intStateTreeDepth, uint256 _voteOptionTreeDepth) public pure returns (uint256 sig) +``` + +generate the signature for the tally verifying key + +#### Parameters + +| Name | Type | Description | +| --------------------- | ------- | --------------------------------- | +| \_stateTreeDepth | uint256 | The state tree depth | +| \_intStateTreeDepth | uint256 | The intermediate state tree depth | +| \_voteOptionTreeDepth | uint256 | The vote option tree depth | + +#### Return Values + +| Name | Type | Description | +| ---- | ------- | ------------- | +| sig | uint256 | The signature | + +### genSubsidyVkSig + +```solidity +function genSubsidyVkSig(uint256 _stateTreeDepth, uint256 _intStateTreeDepth, uint256 _voteOptionTreeDepth) public pure returns (uint256 sig) +``` + +generate the signature for the subsidy verifying key + +#### Parameters + +| Name | Type | Description | +| --------------------- | ------- | --------------------------------- | +| \_stateTreeDepth | uint256 | The state tree depth | +| \_intStateTreeDepth | uint256 | The intermediate state tree depth | +| \_voteOptionTreeDepth | uint256 | The vote option tree depth | + +#### Return Values + +| Name | Type | Description | +| ---- | ------- | ------------- | +| sig | uint256 | The signature | + +### setVerifyingKeys + +```solidity +function setVerifyingKeys(uint256 _stateTreeDepth, uint256 _intStateTreeDepth, uint256 _messageTreeDepth, uint256 _voteOptionTreeDepth, uint256 _messageBatchSize, struct SnarkCommon.VerifyingKey _processVk, struct SnarkCommon.VerifyingKey _tallyVk) public +``` + +Set the process and tally verifying keys for a certain combination +of parameters + +#### Parameters + +| Name | Type | Description | +| --------------------- | ------------------------------- | --------------------------------- | +| \_stateTreeDepth | uint256 | The state tree depth | +| \_intStateTreeDepth | uint256 | The intermediate state tree depth | +| \_messageTreeDepth | uint256 | The message tree depth | +| \_voteOptionTreeDepth | uint256 | The vote option tree depth | +| \_messageBatchSize | uint256 | The message batch size | +| \_processVk | struct SnarkCommon.VerifyingKey | The process verifying key | +| \_tallyVk | struct SnarkCommon.VerifyingKey | The tally verifying key | + +### setSubsidyKeys + +```solidity +function setSubsidyKeys(uint256 _stateTreeDepth, uint256 _intStateTreeDepth, uint256 _voteOptionTreeDepth, struct SnarkCommon.VerifyingKey _subsidyVk) public +``` + +Set the process verifying key for a certain combination +of parameters + +#### Parameters + +| Name | Type | Description | +| --------------------- | ------------------------------- | --------------------------------- | +| \_stateTreeDepth | uint256 | The state tree depth | +| \_intStateTreeDepth | uint256 | The intermediate state tree depth | +| \_voteOptionTreeDepth | uint256 | The vote option tree depth | +| \_subsidyVk | struct SnarkCommon.VerifyingKey | The verifying key | + +### hasProcessVk + +```solidity +function hasProcessVk(uint256 _stateTreeDepth, uint256 _messageTreeDepth, uint256 _voteOptionTreeDepth, uint256 _messageBatchSize) public view returns (bool isSet) +``` + +Check if the process verifying key is set + +#### Parameters + +| Name | Type | Description | +| --------------------- | ------- | -------------------------- | +| \_stateTreeDepth | uint256 | The state tree depth | +| \_messageTreeDepth | uint256 | The message tree depth | +| \_voteOptionTreeDepth | uint256 | The vote option tree depth | +| \_messageBatchSize | uint256 | The message batch size | + +#### Return Values + +| Name | Type | Description | +| ----- | ---- | -------------------------------- | +| isSet | bool | whether the verifying key is set | + +### getProcessVkBySig + +```solidity +function getProcessVkBySig(uint256 _sig) public view returns (struct SnarkCommon.VerifyingKey vk) +``` + +Get the process verifying key by signature + +#### Parameters + +| Name | Type | Description | +| ----- | ------- | ------------- | +| \_sig | uint256 | The signature | + +#### Return Values + +| Name | Type | Description | +| ---- | ------------------------------- | ----------------- | +| vk | struct SnarkCommon.VerifyingKey | The verifying key | + +### getProcessVk + +```solidity +function getProcessVk(uint256 _stateTreeDepth, uint256 _messageTreeDepth, uint256 _voteOptionTreeDepth, uint256 _messageBatchSize) public view returns (struct SnarkCommon.VerifyingKey vk) +``` + +Get the process verifying key + +#### Parameters + +| Name | Type | Description | +| --------------------- | ------- | -------------------------- | +| \_stateTreeDepth | uint256 | The state tree depth | +| \_messageTreeDepth | uint256 | The message tree depth | +| \_voteOptionTreeDepth | uint256 | The vote option tree depth | +| \_messageBatchSize | uint256 | The message batch size | + +#### Return Values + +| Name | Type | Description | +| ---- | ------------------------------- | ----------------- | +| vk | struct SnarkCommon.VerifyingKey | The verifying key | + +### hasTallyVk + +```solidity +function hasTallyVk(uint256 _stateTreeDepth, uint256 _intStateTreeDepth, uint256 _voteOptionTreeDepth) public view returns (bool isSet) +``` + +Check if the tally verifying key is set + +#### Parameters + +| Name | Type | Description | +| --------------------- | ------- | --------------------------------- | +| \_stateTreeDepth | uint256 | The state tree depth | +| \_intStateTreeDepth | uint256 | The intermediate state tree depth | +| \_voteOptionTreeDepth | uint256 | The vote option tree depth | + +#### Return Values + +| Name | Type | Description | +| ----- | ---- | -------------------------------- | +| isSet | bool | whether the verifying key is set | + +### getTallyVkBySig + +```solidity +function getTallyVkBySig(uint256 _sig) public view returns (struct SnarkCommon.VerifyingKey vk) +``` + +Get the tally verifying key by signature + +#### Parameters + +| Name | Type | Description | +| ----- | ------- | ------------- | +| \_sig | uint256 | The signature | + +#### Return Values + +| Name | Type | Description | +| ---- | ------------------------------- | ----------------- | +| vk | struct SnarkCommon.VerifyingKey | The verifying key | + +### getTallyVk + +```solidity +function getTallyVk(uint256 _stateTreeDepth, uint256 _intStateTreeDepth, uint256 _voteOptionTreeDepth) public view returns (struct SnarkCommon.VerifyingKey vk) +``` + +Get the tally verifying key + +#### Parameters + +| Name | Type | Description | +| --------------------- | ------- | --------------------------------- | +| \_stateTreeDepth | uint256 | The state tree depth | +| \_intStateTreeDepth | uint256 | The intermediate state tree depth | +| \_voteOptionTreeDepth | uint256 | The vote option tree depth | + +#### Return Values + +| Name | Type | Description | +| ---- | ------------------------------- | ----------------- | +| vk | struct SnarkCommon.VerifyingKey | The verifying key | + +### hasSubsidyVk + +```solidity +function hasSubsidyVk(uint256 _stateTreeDepth, uint256 _intStateTreeDepth, uint256 _voteOptionTreeDepth) public view returns (bool isSet) +``` + +Check if the subsidy verifying key is set + +#### Parameters + +| Name | Type | Description | +| --------------------- | ------- | --------------------------------- | +| \_stateTreeDepth | uint256 | The state tree depth | +| \_intStateTreeDepth | uint256 | The intermediate state tree depth | +| \_voteOptionTreeDepth | uint256 | The vote option tree depth | + +#### Return Values + +| Name | Type | Description | +| ----- | ---- | -------------------------------- | +| isSet | bool | whether the verifying key is set | + +### getSubsidyVkBySig + +```solidity +function getSubsidyVkBySig(uint256 _sig) public view returns (struct SnarkCommon.VerifyingKey vk) +``` + +Get the subsidy verifying key by signature + +#### Parameters + +| Name | Type | Description | +| ----- | ------- | ------------- | +| \_sig | uint256 | The signature | + +#### Return Values + +| Name | Type | Description | +| ---- | ------------------------------- | ----------------- | +| vk | struct SnarkCommon.VerifyingKey | The verifying key | + +### getSubsidyVk + +```solidity +function getSubsidyVk(uint256 _stateTreeDepth, uint256 _intStateTreeDepth, uint256 _voteOptionTreeDepth) public view returns (struct SnarkCommon.VerifyingKey vk) +``` + +Get the subsidy verifying key + +#### Parameters + +| Name | Type | Description | +| --------------------- | ------- | --------------------------------- | +| \_stateTreeDepth | uint256 | The state tree depth | +| \_intStateTreeDepth | uint256 | The intermediate state tree depth | +| \_voteOptionTreeDepth | uint256 | The vote option tree depth | + +#### Return Values + +| Name | Type | Description | +| ---- | ------------------------------- | ----------------- | +| vk | struct SnarkCommon.VerifyingKey | The verifying key | diff --git a/website/versioned_docs/version-v1.2/solidity-docs/benchmarks/HasherBenchmarks.md b/website/versioned_docs/version-v1.2/solidity-docs/benchmarks/HasherBenchmarks.md new file mode 100644 index 0000000000..a33fd520c3 --- /dev/null +++ b/website/versioned_docs/version-v1.2/solidity-docs/benchmarks/HasherBenchmarks.md @@ -0,0 +1,44 @@ +# HasherBenchmarks + +A contract used to benchmark the poseidon hash function + +### hash5Benchmark + +```solidity +function hash5Benchmark(uint256[5] array) public pure returns (uint256 result) +``` + +Benchmark the poseidon hash function with 5 inputs + +#### Parameters + +| Name | Type | Description | +| ----- | ---------- | --------------------------- | +| array | uint256[5] | The array of inputs to hash | + +#### Return Values + +| Name | Type | Description | +| ------ | ------- | ---------------------- | +| result | uint256 | The hash of the inputs | + +### hashLeftRightBenchmark + +```solidity +function hashLeftRightBenchmark(uint256 _left, uint256 _right) public pure returns (uint256 result) +``` + +Benchmark the poseidon hash function with 2 inputs + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | ----------------------- | +| \_left | uint256 | The left input to hash | +| \_right | uint256 | The right input to hash | + +#### Return Values + +| Name | Type | Description | +| ------ | ------- | -------------------------- | +| result | uint256 | The hash of the two inputs | diff --git a/website/versioned_docs/version-v1.2/solidity-docs/crypto/Hasher.md b/website/versioned_docs/version-v1.2/solidity-docs/crypto/Hasher.md new file mode 100644 index 0000000000..d46d52c0d0 --- /dev/null +++ b/website/versioned_docs/version-v1.2/solidity-docs/crypto/Hasher.md @@ -0,0 +1,125 @@ +# Hasher + +A SHA256 hash function for any number of input elements, and Poseidon hash +functions for 2, 3, 4, 5, and 12 input elements. + +### sha256Hash + +```solidity +function sha256Hash(uint256[] array) public pure returns (uint256 result) +``` + +Computes the SHA256 hash of an array of uint256 elements. + +#### Parameters + +| Name | Type | Description | +| ----- | --------- | ------------------------------ | +| array | uint256[] | The array of uint256 elements. | + +#### Return Values + +| Name | Type | Description | +| ------ | ------- | ----------------------------- | +| result | uint256 | The SHA256 hash of the array. | + +### hash2 + +```solidity +function hash2(uint256[2] array) public pure returns (uint256 result) +``` + +Computes the Poseidon hash of two uint256 elements. + +#### Parameters + +| Name | Type | Description | +| ----- | ---------- | --------------------------------- | +| array | uint256[2] | An array of two uint256 elements. | + +#### Return Values + +| Name | Type | Description | +| ------ | ------- | -------------------------------------- | +| result | uint256 | The Poseidon hash of the two elements. | + +### hash3 + +```solidity +function hash3(uint256[3] array) public pure returns (uint256 result) +``` + +Computes the Poseidon hash of three uint256 elements. + +#### Parameters + +| Name | Type | Description | +| ----- | ---------- | ----------------------------------- | +| array | uint256[3] | An array of three uint256 elements. | + +#### Return Values + +| Name | Type | Description | +| ------ | ------- | ---------------------------------------- | +| result | uint256 | The Poseidon hash of the three elements. | + +### hash4 + +```solidity +function hash4(uint256[4] array) public pure returns (uint256 result) +``` + +Computes the Poseidon hash of four uint256 elements. + +#### Parameters + +| Name | Type | Description | +| ----- | ---------- | ---------------------------------- | +| array | uint256[4] | An array of four uint256 elements. | + +#### Return Values + +| Name | Type | Description | +| ------ | ------- | --------------------------------------- | +| result | uint256 | The Poseidon hash of the four elements. | + +### hash5 + +```solidity +function hash5(uint256[5] array) public pure returns (uint256 result) +``` + +Computes the Poseidon hash of five uint256 elements. + +#### Parameters + +| Name | Type | Description | +| ----- | ---------- | ---------------------------------- | +| array | uint256[5] | An array of five uint256 elements. | + +#### Return Values + +| Name | Type | Description | +| ------ | ------- | --------------------------------------- | +| result | uint256 | The Poseidon hash of the five elements. | + +### hashLeftRight + +```solidity +function hashLeftRight(uint256 left, uint256 right) public pure returns (uint256 result) +``` + +Computes the Poseidon hash of two uint256 elements. + +#### Parameters + +| Name | Type | Description | +| ----- | ------- | --------------------------- | +| left | uint256 | the first element to hash. | +| right | uint256 | the second element to hash. | + +#### Return Values + +| Name | Type | Description | +| ------ | ------- | -------------------------------------- | +| result | uint256 | The Poseidon hash of the two elements. | diff --git a/website/versioned_docs/version-v1.2/solidity-docs/crypto/IVerifier.md b/website/versioned_docs/version-v1.2/solidity-docs/crypto/IVerifier.md new file mode 100644 index 0000000000..62f8042878 --- /dev/null +++ b/website/versioned_docs/version-v1.2/solidity-docs/crypto/IVerifier.md @@ -0,0 +1,11 @@ +# IVerifier + +an interface for a Groth16 verifier contract + +### verify + +```solidity +function verify(uint256[8], struct SnarkCommon.VerifyingKey, uint256) public view virtual returns (bool) +``` + +Verify a zk-SNARK proof diff --git a/website/versioned_docs/version-v1.2/solidity-docs/crypto/MockVerifier.md b/website/versioned_docs/version-v1.2/solidity-docs/crypto/MockVerifier.md new file mode 100644 index 0000000000..7534ca6168 --- /dev/null +++ b/website/versioned_docs/version-v1.2/solidity-docs/crypto/MockVerifier.md @@ -0,0 +1,17 @@ +# MockVerifier + +a MockVerifier to be used for testing + +### verify + +```solidity +function verify(uint256[8], struct SnarkCommon.VerifyingKey, uint256) public pure returns (bool result) +``` + +Verify a zk-SNARK proof (test only return always true) + +#### Return Values + +| Name | Type | Description | +| ------ | ---- | ------------------------------------------------------------- | +| result | bool | Whether the proof is valid given the verifying key and public | diff --git a/website/versioned_docs/version-v1.2/solidity-docs/crypto/Pairing.md b/website/versioned_docs/version-v1.2/solidity-docs/crypto/Pairing.md new file mode 100644 index 0000000000..c8728fbb25 --- /dev/null +++ b/website/versioned_docs/version-v1.2/solidity-docs/crypto/Pairing.md @@ -0,0 +1,85 @@ +# Pairing + +A library implementing the alt_bn128 elliptic curve operations. + +### PRIME_Q + +```solidity +uint256 PRIME_Q +``` + +### G1Point + +```solidity +struct G1Point { + uint256 x; + uint256 y; +} +``` + +### G2Point + +```solidity +struct G2Point { + uint256[2] x; + uint256[2] y; +} +``` + +### PairingAddFailed + +```solidity +error PairingAddFailed() +``` + +custom errors + +### PairingMulFailed + +```solidity +error PairingMulFailed() +``` + +### PairingOpcodeFailed + +```solidity +error PairingOpcodeFailed() +``` + +### negate + +```solidity +function negate(struct Pairing.G1Point p) internal pure returns (struct Pairing.G1Point) +``` + +The negation of p, i.e. p.plus(p.negate()) should be zero. + +### plus + +```solidity +function plus(struct Pairing.G1Point p1, struct Pairing.G1Point p2) internal view returns (struct Pairing.G1Point r) +``` + +r Returns the sum of two points of G1. + +### scalarMul + +```solidity +function scalarMul(struct Pairing.G1Point p, uint256 s) internal view returns (struct Pairing.G1Point r) +``` + +r Return the product of a point on G1 and a scalar, i.e. +p == p.scalarMul(1) and p.plus(p) == p.scalarMul(2) for all +points p. + +### pairing + +```solidity +function pairing(struct Pairing.G1Point a1, struct Pairing.G2Point a2, struct Pairing.G1Point b1, struct Pairing.G2Point b2, struct Pairing.G1Point c1, struct Pairing.G2Point c2, struct Pairing.G1Point d1, struct Pairing.G2Point d2) internal view returns (bool isValid) +``` + +#### Return Values + +| Name | Type | Description | +| ------- | ---- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| isValid | bool | The result of computing the pairing check e(p1[0], p2[0]) _ .... _ e(p1[n], p2[n]) == 1 For example, pairing([P1(), P1().negate()], [P2(), P2()]) should return true. | diff --git a/website/versioned_docs/version-v1.2/solidity-docs/crypto/PoseidonT3.md b/website/versioned_docs/version-v1.2/solidity-docs/crypto/PoseidonT3.md new file mode 100644 index 0000000000..fd5a4b2031 --- /dev/null +++ b/website/versioned_docs/version-v1.2/solidity-docs/crypto/PoseidonT3.md @@ -0,0 +1,9 @@ +# PoseidonT3 + +A library which provides functions for computing Pedersen hashes. + +### poseidon + +```solidity +function poseidon(uint256[2] input) public pure returns (uint256) +``` diff --git a/website/versioned_docs/version-v1.2/solidity-docs/crypto/PoseidonT4.md b/website/versioned_docs/version-v1.2/solidity-docs/crypto/PoseidonT4.md new file mode 100644 index 0000000000..11532ca22b --- /dev/null +++ b/website/versioned_docs/version-v1.2/solidity-docs/crypto/PoseidonT4.md @@ -0,0 +1,9 @@ +# PoseidonT4 + +A library which provides functions for computing Pedersen hashes. + +### poseidon + +```solidity +function poseidon(uint256[3] input) public pure returns (uint256) +``` diff --git a/website/versioned_docs/version-v1.2/solidity-docs/crypto/PoseidonT5.md b/website/versioned_docs/version-v1.2/solidity-docs/crypto/PoseidonT5.md new file mode 100644 index 0000000000..b162396fdd --- /dev/null +++ b/website/versioned_docs/version-v1.2/solidity-docs/crypto/PoseidonT5.md @@ -0,0 +1,9 @@ +# PoseidonT5 + +A library which provides functions for computing Pedersen hashes. + +### poseidon + +```solidity +function poseidon(uint256[4] input) public pure returns (uint256) +``` diff --git a/website/versioned_docs/version-v1.2/solidity-docs/crypto/PoseidonT6.md b/website/versioned_docs/version-v1.2/solidity-docs/crypto/PoseidonT6.md new file mode 100644 index 0000000000..fa9778f141 --- /dev/null +++ b/website/versioned_docs/version-v1.2/solidity-docs/crypto/PoseidonT6.md @@ -0,0 +1,9 @@ +# PoseidonT6 + +A library which provides functions for computing Pedersen hashes. + +### poseidon + +```solidity +function poseidon(uint256[5] input) public pure returns (uint256) +``` diff --git a/website/versioned_docs/version-v1.2/solidity-docs/crypto/SnarkCommon.md b/website/versioned_docs/version-v1.2/solidity-docs/crypto/SnarkCommon.md new file mode 100644 index 0000000000..d744dbb179 --- /dev/null +++ b/website/versioned_docs/version-v1.2/solidity-docs/crypto/SnarkCommon.md @@ -0,0 +1,16 @@ +# SnarkCommon + +a Contract which holds a struct +representing a Groth16 verifying key + +### VerifyingKey + +```solidity +struct VerifyingKey { + struct Pairing.G1Point alpha1; + struct Pairing.G2Point beta2; + struct Pairing.G2Point gamma2; + struct Pairing.G2Point delta2; + struct Pairing.G1Point[] ic; +} +``` diff --git a/website/versioned_docs/version-v1.2/solidity-docs/crypto/SnarkConstants.md b/website/versioned_docs/version-v1.2/solidity-docs/crypto/SnarkConstants.md new file mode 100644 index 0000000000..9bdc7e8d26 --- /dev/null +++ b/website/versioned_docs/version-v1.2/solidity-docs/crypto/SnarkConstants.md @@ -0,0 +1,40 @@ +# SnarkConstants + +This contract contains constants related to the SNARK +components of MACI. + +### SNARK_SCALAR_FIELD + +```solidity +uint256 SNARK_SCALAR_FIELD +``` + +The scalar field + +### PAD_PUBKEY_X + +```solidity +uint256 PAD_PUBKEY_X +``` + +The public key here is the first Pedersen base +point from iden3's circomlib implementation of the Pedersen hash. +Since it is generated using a hash-to-curve function, we are +confident that no-one knows the private key associated with this +public key. See: +https://github.com/iden3/circomlib/blob/d5ed1c3ce4ca137a6b3ca48bec4ac12c1b38957a/src/pedersen_printbases.js +Its hash should equal 6769006970205099520508948723718471724660867171122235270773600567925038008762. + +### PAD_PUBKEY_Y + +```solidity +uint256 PAD_PUBKEY_Y +``` + +### NOTHING_UP_MY_SLEEVE + +```solidity +uint256 NOTHING_UP_MY_SLEEVE +``` + +The Keccack256 hash of 'Maci' diff --git a/website/versioned_docs/version-v1.2/solidity-docs/crypto/Verifier.md b/website/versioned_docs/version-v1.2/solidity-docs/crypto/Verifier.md new file mode 100644 index 0000000000..6b82159fb8 --- /dev/null +++ b/website/versioned_docs/version-v1.2/solidity-docs/crypto/Verifier.md @@ -0,0 +1,61 @@ +# Verifier + +a Groth16 verifier contract + +### Proof + +```solidity +struct Proof { + struct Pairing.G1Point a; + struct Pairing.G2Point b; + struct Pairing.G1Point c; +} +``` + +### PRIME_Q + +```solidity +uint256 PRIME_Q +``` + +### InvalidProofQ + +```solidity +error InvalidProofQ() +``` + +custom errors + +### InvalidInputVal + +```solidity +error InvalidInputVal() +``` + +### verify + +```solidity +function verify(uint256[8] _proof, struct SnarkCommon.VerifyingKey vk, uint256 input) public view returns (bool isValid) +``` + +Verify a zk-SNARK proof + +#### Parameters + +| Name | Type | Description | +| ------- | ------------------------------- | -------------------------------- | +| \_proof | uint256[8] | The proof | +| vk | struct SnarkCommon.VerifyingKey | The verifying key | +| input | uint256 | The public inputs to the circuit | + +#### Return Values + +| Name | Type | Description | +| ------- | ---- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| isValid | bool | Whether the proof is valid given the verifying key and public input. Note that this function only supports one public input. Refer to the Semaphore source code for a verifier that supports multiple public inputs. | + +### checkPoint + +```solidity +function checkPoint(uint256 point) internal pure +``` diff --git a/website/versioned_docs/version-v1.2/solidity-docs/gatekeepers/EASGatekeeper.md b/website/versioned_docs/version-v1.2/solidity-docs/gatekeepers/EASGatekeeper.md new file mode 100644 index 0000000000..b83042f982 --- /dev/null +++ b/website/versioned_docs/version-v1.2/solidity-docs/gatekeepers/EASGatekeeper.md @@ -0,0 +1,121 @@ +# EASGatekeeper + +A gatekeeper contract which allows users to sign up to MACI +only if they've received an attestation of a specific schema from a trusted attester + +### schema + +```solidity +bytes32 schema +``` + +### attester + +```solidity +address attester +``` + +### maci + +```solidity +address maci +``` + +the reference to the MACI contract + +### registeredAttestations + +```solidity +mapping(bytes32 => bool) registeredAttestations +``` + +### AttestationRevoked + +```solidity +error AttestationRevoked() +``` + +custom errors + +### AlreadyRegistered + +```solidity +error AlreadyRegistered() +``` + +### AttesterNotTrusted + +```solidity +error AttesterNotTrusted() +``` + +### NotYourAttestation + +```solidity +error NotYourAttestation() +``` + +### InvalidSchema + +```solidity +error InvalidSchema() +``` + +### OnlyMACI + +```solidity +error OnlyMACI() +``` + +### ZeroAddress + +```solidity +error ZeroAddress() +``` + +### constructor + +```solidity +constructor(address _eas, address _attester, bytes32 _schema) public payable +``` + +Deploy an instance of EASGatekeeper + +#### Parameters + +| Name | Type | Description | +| ---------- | ------- | -------------------- | +| \_eas | address | The EAS contract | +| \_attester | address | The trusted attester | +| \_schema | bytes32 | The schema UID | + +### setMaciInstance + +```solidity +function setMaciInstance(address _maci) public +``` + +Adds an uninitialised MACI instance to allow for token signups + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | ---------------------------------------- | +| \_maci | address | The MACI contract interface to be stored | + +### register + +```solidity +function register(address _user, bytes _data) public +``` + +Register an user based on their attestation + +_Throw if the attestation is not valid or just complete silently_ + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | -------------------------------------- | +| \_user | address | The user's Ethereum address. | +| \_data | bytes | The ABI-encoded schemaId as a uint256. | diff --git a/website/versioned_docs/version-v1.2/solidity-docs/gatekeepers/FreeForAllSignUpGatekeeper.md b/website/versioned_docs/version-v1.2/solidity-docs/gatekeepers/FreeForAllSignUpGatekeeper.md new file mode 100644 index 0000000000..f4818efeff --- /dev/null +++ b/website/versioned_docs/version-v1.2/solidity-docs/gatekeepers/FreeForAllSignUpGatekeeper.md @@ -0,0 +1,40 @@ +# FreeForAllGatekeeper + +A SignUpGatekeeper which allows anyone to sign up. + +### constructor + +```solidity +constructor() public payable +``` + +Create a new instance of FreeForAllGatekeeper + +### setMaciInstance + +```solidity +function setMaciInstance(address _maci) public +``` + +setMaciInstance does nothing in this gatekeeper + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | ----------------- | +| \_maci | address | The MACI contract | + +### register + +```solidity +function register(address _address, bytes _data) public +``` + +Registers the user without any restrictions. + +#### Parameters + +| Name | Type | Description | +| --------- | ------- | ----------------------- | +| \_address | address | The address of the user | +| \_data | bytes | memory additional data | diff --git a/website/versioned_docs/version-v1.2/solidity-docs/gatekeepers/SignUpGatekeeper.md b/website/versioned_docs/version-v1.2/solidity-docs/gatekeepers/SignUpGatekeeper.md new file mode 100644 index 0000000000..e76138c5e4 --- /dev/null +++ b/website/versioned_docs/version-v1.2/solidity-docs/gatekeepers/SignUpGatekeeper.md @@ -0,0 +1,26 @@ +# SignUpGatekeeper + +A gatekeeper contract which allows users to sign up for a poll. + +### setMaciInstance + +```solidity +function setMaciInstance(address _maci) public virtual +``` + +Allows to set the MACI contract + +### register + +```solidity +function register(address _user, bytes _data) public virtual +``` + +Registers the user + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | ----------------------- | +| \_user | address | The address of the user | +| \_data | bytes | additional data | diff --git a/website/versioned_docs/version-v1.2/solidity-docs/gatekeepers/SignUpTokenGatekeeper.md b/website/versioned_docs/version-v1.2/solidity-docs/gatekeepers/SignUpTokenGatekeeper.md new file mode 100644 index 0000000000..06fb0b63ab --- /dev/null +++ b/website/versioned_docs/version-v1.2/solidity-docs/gatekeepers/SignUpTokenGatekeeper.md @@ -0,0 +1,93 @@ +# SignUpTokenGatekeeper + +This contract allows to gatekeep MACI signups +by requiring new voters to own a certain ERC721 token + +### token + +```solidity +contract SignUpToken token +``` + +the reference to the SignUpToken contract + +### maci + +```solidity +address maci +``` + +the reference to the MACI contract + +### registeredTokenIds + +```solidity +mapping(uint256 => bool) registeredTokenIds +``` + +a mapping of tokenIds to whether they have been used to sign up + +### AlreadyRegistered + +```solidity +error AlreadyRegistered() +``` + +custom errors + +### NotTokenOwner + +```solidity +error NotTokenOwner() +``` + +### OnlyMACI + +```solidity +error OnlyMACI() +``` + +### constructor + +```solidity +constructor(contract SignUpToken _token) public payable +``` + +creates a new SignUpTokenGatekeeper + +#### Parameters + +| Name | Type | Description | +| ------- | -------------------- | --------------------------------------- | +| \_token | contract SignUpToken | the address of the SignUpToken contract | + +### setMaciInstance + +```solidity +function setMaciInstance(address _maci) public +``` + +Adds an uninitialised MACI instance to allow for token signups + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | ---------------------------------------- | +| \_maci | address | The MACI contract interface to be stored | + +### register + +```solidity +function register(address _user, bytes _data) public +``` + +Registers the user if they own the token with the token ID encoded in +\_data. Throws if the user does not own the token or if the token has +already been used to sign up. + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | ------------------------------------- | +| \_user | address | The user's Ethereum address. | +| \_data | bytes | The ABI-encoded tokenId as a uint256. | diff --git a/website/versioned_docs/version-v1.2/solidity-docs/gatekeepers/hatsGatekeepers/HatsGatekeeperBase.md b/website/versioned_docs/version-v1.2/solidity-docs/gatekeepers/hatsGatekeepers/HatsGatekeeperBase.md new file mode 100644 index 0000000000..a7e7274893 --- /dev/null +++ b/website/versioned_docs/version-v1.2/solidity-docs/gatekeepers/hatsGatekeepers/HatsGatekeeperBase.md @@ -0,0 +1,79 @@ +# HatsGatekeeperBase + +Abstract contract containing the base elements of a Hats Gatekeeper contract + +### OnlyMACI + +```solidity +error OnlyMACI() +``` + +### NotWearingCriterionHat + +```solidity +error NotWearingCriterionHat() +``` + +### AlreadyRegistered + +```solidity +error AlreadyRegistered() +``` + +### ZeroAddress + +```solidity +error ZeroAddress() +``` + +### hats + +```solidity +contract IHats hats +``` + +The Hats Protocol contract address + +### maci + +```solidity +address maci +``` + +the reference to the MACI contract + +### registered + +```solidity +mapping(address => bool) registered +``` + +Tracks registered users + +### constructor + +```solidity +constructor(address _hats) internal payable +``` + +Deploy an instance of HatsGatekeeper + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | -------------------------- | +| \_hats | address | The Hats Protocol contract | + +### setMaciInstance + +```solidity +function setMaciInstance(address _maci) public +``` + +Allows to set the MACI contract + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | ---------------------------------------- | +| \_maci | address | The MACI contract interface to be stored | diff --git a/website/versioned_docs/version-v1.2/solidity-docs/gatekeepers/hatsGatekeepers/HatsGatekeeperMultiple.md b/website/versioned_docs/version-v1.2/solidity-docs/gatekeepers/hatsGatekeepers/HatsGatekeeperMultiple.md new file mode 100644 index 0000000000..1168154398 --- /dev/null +++ b/website/versioned_docs/version-v1.2/solidity-docs/gatekeepers/hatsGatekeepers/HatsGatekeeperMultiple.md @@ -0,0 +1,48 @@ +# HatsGatekeeperMultiple + +A gatekeeper contract which allows users to sign up to MACI +only if they are wearing one of the specified hats + +### NotCriterionHat + +```solidity +error NotCriterionHat() +``` + +### criterionHat + +```solidity +mapping(uint256 => bool) criterionHat +``` + +Tracks hats that users must wear to be eligible to register + +### constructor + +```solidity +constructor(address _hats, uint256[] _criterionHats) public payable +``` + +Deploy an instance of HatsGatekeeperMultiple + +#### Parameters + +| Name | Type | Description | +| --------------- | --------- | -------------------------------- | +| \_hats | address | The Hats Protocol contract | +| \_criterionHats | uint256[] | Array of accepted criterion hats | + +### register + +```solidity +function register(address _user, bytes _data) public +``` + +Registers the user + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | ----------------------- | +| \_user | address | The address of the user | +| \_data | bytes | additional data | diff --git a/website/versioned_docs/version-v1.2/solidity-docs/gatekeepers/hatsGatekeepers/HatsGatekeeperSingle.md b/website/versioned_docs/version-v1.2/solidity-docs/gatekeepers/hatsGatekeepers/HatsGatekeeperSingle.md new file mode 100644 index 0000000000..d04b60ec5b --- /dev/null +++ b/website/versioned_docs/version-v1.2/solidity-docs/gatekeepers/hatsGatekeepers/HatsGatekeeperSingle.md @@ -0,0 +1,42 @@ +# HatsGatekeeperSingle + +A gatekeeper contract which allows users to sign up to MACI +only if they are wearing a specified hat + +### criterionHat + +```solidity +uint256 criterionHat +``` + +The hat that users must wear to be eligible to register + +### constructor + +```solidity +constructor(address _hats, uint256 _criterionHat) public payable +``` + +Deploy an instance of HatsGatekeeperSingle + +#### Parameters + +| Name | Type | Description | +| -------------- | ------- | -------------------------- | +| \_hats | address | The Hats Protocol contract | +| \_criterionHat | uint256 | The required hat | + +### register + +```solidity +function register(address _user, bytes) public +``` + +Registers the user + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | ----------------------- | +| \_user | address | The address of the user | +| | bytes | | diff --git a/website/versioned_docs/version-v1.2/solidity-docs/index.md b/website/versioned_docs/version-v1.2/solidity-docs/index.md new file mode 100644 index 0000000000..0efc5a66b8 --- /dev/null +++ b/website/versioned_docs/version-v1.2/solidity-docs/index.md @@ -0,0 +1,4 @@ +--- +title: Solidity Docs +sidebar_label: Solidity Docs +--- diff --git a/website/versioned_docs/version-v1.2/solidity-docs/initialVoiceCreditProxy/ConstantInitialVoiceCreditProxy.md b/website/versioned_docs/version-v1.2/solidity-docs/initialVoiceCreditProxy/ConstantInitialVoiceCreditProxy.md new file mode 100644 index 0000000000..90081b9d68 --- /dev/null +++ b/website/versioned_docs/version-v1.2/solidity-docs/initialVoiceCreditProxy/ConstantInitialVoiceCreditProxy.md @@ -0,0 +1,40 @@ +# ConstantInitialVoiceCreditProxy + +This contract allows to set a constant initial voice credit balance +for MACI's voters. + +### balance + +```solidity +uint256 balance +``` + +the balance to be returned by getVoiceCredits + +### constructor + +```solidity +constructor(uint256 _balance) public payable +``` + +creates a new ConstantInitialVoiceCreditProxy + +#### Parameters + +| Name | Type | Description | +| --------- | ------- | --------------------------------------------- | +| \_balance | uint256 | the balance to be returned by getVoiceCredits | + +### getVoiceCredits + +```solidity +function getVoiceCredits(address, bytes) public view returns (uint256) +``` + +Returns the constant balance for any new MACI's voter + +#### Return Values + +| Name | Type | Description | +| ---- | ------- | ----------- | +| [0] | uint256 | balance | diff --git a/website/versioned_docs/version-v1.2/solidity-docs/initialVoiceCreditProxy/InitialVoiceCreditProxy.md b/website/versioned_docs/version-v1.2/solidity-docs/initialVoiceCreditProxy/InitialVoiceCreditProxy.md new file mode 100644 index 0000000000..b8ae150440 --- /dev/null +++ b/website/versioned_docs/version-v1.2/solidity-docs/initialVoiceCreditProxy/InitialVoiceCreditProxy.md @@ -0,0 +1,26 @@ +# InitialVoiceCreditProxy + +This contract is the base contract for +InitialVoiceCreditProxy contracts. It allows to set a custom initial voice +credit balance for MACI's voters. + +### getVoiceCredits + +```solidity +function getVoiceCredits(address _user, bytes _data) public view virtual returns (uint256) +``` + +Returns the initial voice credit balance for a new MACI's voter + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | ------------------------ | +| \_user | address | the address of the voter | +| \_data | bytes | additional data | + +#### Return Values + +| Name | Type | Description | +| ---- | ------- | ----------- | +| [0] | uint256 | the balance | diff --git a/website/versioned_docs/version-v1.2/solidity-docs/interfaces/IEAS.md b/website/versioned_docs/version-v1.2/solidity-docs/interfaces/IEAS.md new file mode 100644 index 0000000000..9c5c23e25e --- /dev/null +++ b/website/versioned_docs/version-v1.2/solidity-docs/interfaces/IEAS.md @@ -0,0 +1,40 @@ +# IEAS + +An interface to the EAS contract. + +### Attestation + +```solidity +struct Attestation { + bytes32 uid; + bytes32 schema; + uint64 time; + uint64 expirationTime; + uint64 revocationTime; + bytes32 refUID; + address recipient; + address attester; + bool revocable; + bytes data; +} +``` + +### getAttestation + +```solidity +function getAttestation(bytes32 uid) external view returns (struct IEAS.Attestation) +``` + +Get an attestation by its unique identifier. + +#### Parameters + +| Name | Type | Description | +| ---- | ------- | ----------------------------------------- | +| uid | bytes32 | The unique identifier of the attestation. | + +#### Return Values + +| Name | Type | Description | +| ---- | ----------------------- | ---------------------------- | +| [0] | struct IEAS.Attestation | attestation The attestation. | diff --git a/website/versioned_docs/version-v1.2/solidity-docs/interfaces/IHats.md b/website/versioned_docs/version-v1.2/solidity-docs/interfaces/IHats.md new file mode 100644 index 0000000000..a8cebd7d1f --- /dev/null +++ b/website/versioned_docs/version-v1.2/solidity-docs/interfaces/IHats.md @@ -0,0 +1,103 @@ +# IHats + +Minimal interface for the Hats Protocol contract + +_Includes only the functions required for the HatsGatekeepers and associated tests_ + +### mintTopHat + +```solidity +function mintTopHat(address _target, string _details, string _imageURI) external returns (uint256) +``` + +Creates and mints a Hat that is its own admin, i.e. a "topHat" + +_A topHat has no eligibility and no toggle_ + +#### Parameters + +| Name | Type | Description | +| ---------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | +| \_target | address | The address to which the newly created topHat is minted | +| \_details | string | A description of the Hat [optional]. Should not be larger than 7000 bytes (enforced in changeHatDetails) | +| \_imageURI | string | The image uri for this top hat and the fallback for its downstream hats [optional]. Should not be larger than 7000 bytes (enforced in changeHatImageURI) | + +#### Return Values + +| Name | Type | Description | +| ---- | ------- | ------------------------------------------- | +| [0] | uint256 | topHatId The id of the newly created topHat | + +### createHat + +```solidity +function createHat(uint256 _admin, string _details, uint32 _maxSupply, address _eligibility, address _toggle, bool _mutable, string _imageURI) external returns (uint256) +``` + +Creates a new hat. The msg.sender must wear the `_admin` hat. + +_Initializes a new Hat struct, but does not mint any tokens._ + +#### Parameters + +| Name | Type | Description | +| ------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | +| \_admin | uint256 | The id of the Hat that will control who wears the newly created hat | +| \_details | string | A description of the Hat. Should not be larger than 7000 bytes (enforced in changeHatDetails) | +| \_maxSupply | uint32 | The total instances of the Hat that can be worn at once | +| \_eligibility | address | The address that can report on the Hat wearer's status | +| \_toggle | address | The address that can deactivate the Hat | +| \_mutable | bool | Whether the hat's properties are changeable after creation | +| \_imageURI | string | The image uri for this hat and the fallback for its downstream hats [optional]. Should not be larger than 7000 bytes (enforced in changeHatImageURI) | + +#### Return Values + +| Name | Type | Description | +| ---- | ------- | ---------------------------------------- | +| [0] | uint256 | newHatId The id of the newly created Hat | + +### mintHat + +```solidity +function mintHat(uint256 _hatId, address _wearer) external returns (bool success) +``` + +Mints an ERC1155-similar token of the Hat to an eligible recipient, who then "wears" the hat + +_The msg.sender must wear an admin Hat of `_hatId`, and the recipient must be eligible to wear `_hatId`_ + +#### Parameters + +| Name | Type | Description | +| -------- | ------- | -------------------------------------- | +| \_hatId | uint256 | The id of the Hat to mint | +| \_wearer | address | The address to which the Hat is minted | + +#### Return Values + +| Name | Type | Description | +| ------- | ---- | -------------------------- | +| success | bool | Whether the mint succeeded | + +### isWearerOfHat + +```solidity +function isWearerOfHat(address account, uint256 hat) external view returns (bool) +``` + +Checks whether a given address wears a given Hat + +_Convenience function that wraps `balanceOf`_ + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | --------------------------------------------- | +| account | address | The address in question | +| hat | uint256 | The id of the Hat that the `_user` might wear | + +#### Return Values + +| Name | Type | Description | +| ---- | ---- | ------------------------------------------- | +| [0] | bool | isWearer Whether the `_user` wears the Hat. | diff --git a/website/versioned_docs/version-v1.2/solidity-docs/interfaces/IMACI.md b/website/versioned_docs/version-v1.2/solidity-docs/interfaces/IMACI.md new file mode 100644 index 0000000000..948e8ce88d --- /dev/null +++ b/website/versioned_docs/version-v1.2/solidity-docs/interfaces/IMACI.md @@ -0,0 +1,94 @@ +# IMACI + +MACI interface + +### stateTreeDepth + +```solidity +function stateTreeDepth() external view returns (uint8) +``` + +Get the depth of the state tree + +#### Return Values + +| Name | Type | Description | +| ---- | ----- | --------------------------- | +| [0] | uint8 | The depth of the state tree | + +### getStateAqRoot + +```solidity +function getStateAqRoot() external view returns (uint256) +``` + +Return the main root of the StateAq contract + +#### Return Values + +| Name | Type | Description | +| ---- | ------- | --------------- | +| [0] | uint256 | The Merkle root | + +### mergeStateAqSubRoots + +```solidity +function mergeStateAqSubRoots(uint256 _numSrQueueOps, uint256 _pollId) external +``` + +Allow Poll contracts to merge the state subroots + +#### Parameters + +| Name | Type | Description | +| --------------- | ------- | ------------------------- | +| \_numSrQueueOps | uint256 | Number of operations | +| \_pollId | uint256 | The ID of the active Poll | + +### mergeStateAq + +```solidity +function mergeStateAq(uint256 _pollId) external returns (uint256) +``` + +Allow Poll contracts to merge the state root + +#### Parameters + +| Name | Type | Description | +| -------- | ------- | ------------------ | +| \_pollId | uint256 | The active Poll ID | + +#### Return Values + +| Name | Type | Description | +| ---- | ------- | -------------------------- | +| [0] | uint256 | The calculated Merkle root | + +### numSignUps + +```solidity +function numSignUps() external view returns (uint256) +``` + +Get the number of signups + +#### Return Values + +| Name | Type | Description | +| ---- | ------- | -------------------------------- | +| [0] | uint256 | numsignUps The number of signups | + +### stateAq + +```solidity +function stateAq() external view returns (contract AccQueue) +``` + +Get the state AccQueue + +#### Return Values + +| Name | Type | Description | +| ---- | ----------------- | ------------------ | +| [0] | contract AccQueue | The state AccQueue | diff --git a/website/versioned_docs/version-v1.2/solidity-docs/interfaces/IMPFactory.md b/website/versioned_docs/version-v1.2/solidity-docs/interfaces/IMPFactory.md new file mode 100644 index 0000000000..950df5e98e --- /dev/null +++ b/website/versioned_docs/version-v1.2/solidity-docs/interfaces/IMPFactory.md @@ -0,0 +1,26 @@ +# IMessageProcessorFactory + +MessageProcessorFactory interface + +### deploy + +```solidity +function deploy(address _verifier, address _vkRegistry, address _poll, address _owner) external returns (address) +``` + +Deploy a new MessageProcessor contract and return the address. + +#### Parameters + +| Name | Type | Description | +| ------------ | ------- | -------------------------------------- | +| \_verifier | address | Verifier contract | +| \_vkRegistry | address | VkRegistry contract | +| \_poll | address | Poll contract | +| \_owner | address | Owner of the MessageProcessor contract | + +#### Return Values + +| Name | Type | Description | +| ---- | ------- | -------------------------------------- | +| [0] | address | The deployed MessageProcessor contract | diff --git a/website/versioned_docs/version-v1.2/solidity-docs/interfaces/IMessageProcessor.md b/website/versioned_docs/version-v1.2/solidity-docs/interfaces/IMessageProcessor.md new file mode 100644 index 0000000000..7ed3736edd --- /dev/null +++ b/website/versioned_docs/version-v1.2/solidity-docs/interfaces/IMessageProcessor.md @@ -0,0 +1,31 @@ +# IMessageProcessor + +MessageProcessor interface + +### processingComplete + +```solidity +function processingComplete() external view returns (bool) +``` + +Get the result of whether there are unprocessed messages left + +#### Return Values + +| Name | Type | Description | +| ---- | ---- | ------------------------------------------- | +| [0] | bool | Whether there are unprocessed messages left | + +### sbCommitment + +```solidity +function sbCommitment() external view returns (uint256) +``` + +Get the commitment to the state and ballot roots + +#### Return Values + +| Name | Type | Description | +| ---- | ------- | -------------------------------------------- | +| [0] | uint256 | The commitment to the state and ballot roots | diff --git a/website/versioned_docs/version-v1.2/solidity-docs/interfaces/IPoll.md b/website/versioned_docs/version-v1.2/solidity-docs/interfaces/IPoll.md new file mode 100644 index 0000000000..f702bee1d4 --- /dev/null +++ b/website/versioned_docs/version-v1.2/solidity-docs/interfaces/IPoll.md @@ -0,0 +1,217 @@ +# IPoll + +Poll interface + +### numSignUpsAndMessages + +```solidity +function numSignUpsAndMessages() external view returns (uint256 numSignups, uint256 numMsgs) +``` + +The number of messages which have been processed and the number of signups + +#### Return Values + +| Name | Type | Description | +| ---------- | ------- | ------------------------------------- | +| numSignups | uint256 | The number of signups | +| numMsgs | uint256 | The number of messages sent by voters | + +### topup + +```solidity +function topup(uint256 stateIndex, uint256 amount) external +``` + +Allows to publish a Topup message + +#### Parameters + +| Name | Type | Description | +| ---------- | ------- | ------------------------------------ | +| stateIndex | uint256 | The index of user in the state queue | +| amount | uint256 | The amount of credits to topup | + +### publishMessage + +```solidity +function publishMessage(struct DomainObjs.Message _message, struct DomainObjs.PubKey _encPubKey) external +``` + +Allows anyone to publish a message (an encrypted command and signature). +This function also enqueues the message. + +#### Parameters + +| Name | Type | Description | +| ----------- | ------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- | +| \_message | struct DomainObjs.Message | The message to publish | +| \_encPubKey | struct DomainObjs.PubKey | An epheremal public key which can be combined with the coordinator's private key to generate an ECDH shared key with which to encrypt the message. | + +### mergeMaciStateAqSubRoots + +```solidity +function mergeMaciStateAqSubRoots(uint256 _numSrQueueOps, uint256 _pollId) external +``` + +The first step of merging the MACI state AccQueue. This allows the +ProcessMessages circuit to access the latest state tree and ballots via +currentSbCommitment. + +#### Parameters + +| Name | Type | Description | +| --------------- | ------- | ------------------------- | +| \_numSrQueueOps | uint256 | Number of operations | +| \_pollId | uint256 | The ID of the active Poll | + +### mergeMaciStateAq + +```solidity +function mergeMaciStateAq(uint256 _pollId) external +``` + +The second step of merging the MACI state AccQueue. This allows the +ProcessMessages circuit to access the latest state tree and ballots via +currentSbCommitment. + +#### Parameters + +| Name | Type | Description | +| -------- | ------- | ------------------------- | +| \_pollId | uint256 | The ID of the active Poll | + +### mergeMessageAqSubRoots + +```solidity +function mergeMessageAqSubRoots(uint256 _numSrQueueOps) external +``` + +The first step in merging the message AccQueue so that the +ProcessMessages circuit can access the message root. + +#### Parameters + +| Name | Type | Description | +| --------------- | ------- | ------------------------------------------------- | +| \_numSrQueueOps | uint256 | The number of subroot queue operations to perform | + +### mergeMessageAq + +```solidity +function mergeMessageAq() external +``` + +The second step in merging the message AccQueue so that the +ProcessMessages circuit can access the message root. + +### getDeployTimeAndDuration + +```solidity +function getDeployTimeAndDuration() external view returns (uint256 _deployTime, uint256 _duration) +``` + +Returns the Poll's deploy time and duration + +#### Return Values + +| Name | Type | Description | +| ------------ | ------- | ------------------------ | +| \_deployTime | uint256 | The deployment timestamp | +| \_duration | uint256 | The duration of the poll | + +### stateAqMerged + +```solidity +function stateAqMerged() external view returns (bool) +``` + +Get the result of whether the MACI contract's stateAq has been merged by this contract + +#### Return Values + +| Name | Type | Description | +| ---- | ---- | -------------------------------------------------------------------- | +| [0] | bool | Whether the MACI contract's stateAq has been merged by this contract | + +### treeDepths + +```solidity +function treeDepths() external view returns (uint8 intStateTreeDepth, uint8 messageTreeSubDepth, uint8 messageTreeDepth, uint8 voteOptionTreeDepth) +``` + +Get the depths of the merkle trees + +#### Return Values + +| Name | Type | Description | +| ------------------- | ----- | ------------------------------------ | +| intStateTreeDepth | uint8 | The depth of the state tree | +| messageTreeSubDepth | uint8 | The subdepth of the message tree | +| messageTreeDepth | uint8 | The depth of the message tree | +| voteOptionTreeDepth | uint8 | The subdepth of the vote option tree | + +### maxValues + +```solidity +function maxValues() external view returns (uint256 maxMessages, uint256 maxVoteOptions) +``` + +Get the max values for the poll + +#### Return Values + +| Name | Type | Description | +| -------------- | ------- | ---------------------------------- | +| maxMessages | uint256 | The maximum number of messages | +| maxVoteOptions | uint256 | The maximum number of vote options | + +### extContracts + +```solidity +function extContracts() external view returns (contract IMACI maci, contract AccQueue messageAq, contract TopupCredit topupCredit) +``` + +Get the external contracts + +#### Return Values + +| Name | Type | Description | +| ----------- | -------------------- | ------------------------ | +| maci | contract IMACI | The IMACI contract | +| messageAq | contract AccQueue | The AccQueue contract | +| topupCredit | contract TopupCredit | The TopupCredit contract | + +### coordinatorPubKeyHash + +```solidity +function coordinatorPubKeyHash() external view returns (uint256 _coordinatorPubKeyHash) +``` + +Get the hash of coordinator's public key + +#### Return Values + +| Name | Type | Description | +| ----------------------- | ------- | ------------------------------------ | +| \_coordinatorPubKeyHash | uint256 | the hash of coordinator's public key | + +### currentSbCommitment + +```solidity +function currentSbCommitment() external view returns (uint256) +``` + +Get the commitment to the state leaves and the ballots. This is +hash3(stateRoot, ballotRoot, salt). +Its initial value should be +hash(maciStateRootSnapshot, emptyBallotRoot, 0) +Each successful invocation of processMessages() should use a different +salt to update this value, so that an external observer cannot tell in +the case that none of the messages are valid. + +#### Return Values + +| Name | Type | Description | +| ---- | ------- | -------------------------------------------------- | +| [0] | uint256 | The commitment to the state leaves and the ballots | diff --git a/website/versioned_docs/version-v1.2/solidity-docs/interfaces/IPollFactory.md b/website/versioned_docs/version-v1.2/solidity-docs/interfaces/IPollFactory.md new file mode 100644 index 0000000000..901b05c82c --- /dev/null +++ b/website/versioned_docs/version-v1.2/solidity-docs/interfaces/IPollFactory.md @@ -0,0 +1,29 @@ +# IPollFactory + +PollFactory interface + +### deploy + +```solidity +function deploy(uint256 _duration, struct Params.MaxValues _maxValues, struct Params.TreeDepths _treeDepths, struct DomainObjs.PubKey _coordinatorPubKey, address _maci, contract TopupCredit _topupCredit, address _pollOwner) external returns (address) +``` + +Deploy a new Poll contract and AccQueue contract for messages. + +#### Parameters + +| Name | Type | Description | +| ------------------- | ------------------------ | ------------------------------------- | +| \_duration | uint256 | The duration of the poll | +| \_maxValues | struct Params.MaxValues | The max values for the poll | +| \_treeDepths | struct Params.TreeDepths | The depths of the merkle trees | +| \_coordinatorPubKey | struct DomainObjs.PubKey | The coordinator's public key | +| \_maci | address | The MACI contract interface reference | +| \_topupCredit | contract TopupCredit | The TopupCredit contract | +| \_pollOwner | address | The owner of the poll | + +#### Return Values + +| Name | Type | Description | +| ---- | ------- | -------------------------- | +| [0] | address | The deployed Poll contract | diff --git a/website/versioned_docs/version-v1.2/solidity-docs/interfaces/ITallyFactory.md b/website/versioned_docs/version-v1.2/solidity-docs/interfaces/ITallyFactory.md new file mode 100644 index 0000000000..83a6e18f97 --- /dev/null +++ b/website/versioned_docs/version-v1.2/solidity-docs/interfaces/ITallyFactory.md @@ -0,0 +1,28 @@ +# ITallyFactory + +TallyFactory interface + +### deploy + +```solidity +function deploy(address _verifier, address _vkRegistry, address _poll, address _messageProcessor, address _owner, bool _isQv) external returns (address) +``` + +Deploy a new Tally contract and return the address. + +#### Parameters + +| Name | Type | Description | +| ------------------ | ------- | ---------------------------- | +| \_verifier | address | Verifier contract | +| \_vkRegistry | address | VkRegistry contract | +| \_poll | address | Poll contract | +| \_messageProcessor | address | MessageProcessor contract | +| \_owner | address | Owner of the contract | +| \_isQv | bool | Whether to support QV or not | + +#### Return Values + +| Name | Type | Description | +| ---- | ------- | --------------------- | +| [0] | address | The deployed contract | diff --git a/website/versioned_docs/version-v1.2/solidity-docs/interfaces/ITallySubsidyFactory.md b/website/versioned_docs/version-v1.2/solidity-docs/interfaces/ITallySubsidyFactory.md new file mode 100644 index 0000000000..1745905043 --- /dev/null +++ b/website/versioned_docs/version-v1.2/solidity-docs/interfaces/ITallySubsidyFactory.md @@ -0,0 +1,27 @@ +# ITallySubsidyFactory + +TallySubsidyFactory interface + +### deploy + +```solidity +function deploy(address _verifier, address _vkRegistry, address _poll, address _messageProcessor, address _owner) external returns (address) +``` + +Deploy a new Tally or Subsidy contract and return the address. + +#### Parameters + +| Name | Type | Description | +| ------------------ | ------- | ------------------------- | +| \_verifier | address | Verifier contract | +| \_vkRegistry | address | VkRegistry contract | +| \_poll | address | Poll contract | +| \_messageProcessor | address | MessageProcessor contract | +| \_owner | address | Owner of the contract | + +#### Return Values + +| Name | Type | Description | +| ---- | ------- | --------------------- | +| [0] | address | The deployed contract | diff --git a/website/versioned_docs/version-v1.2/solidity-docs/interfaces/IVerifier.md b/website/versioned_docs/version-v1.2/solidity-docs/interfaces/IVerifier.md new file mode 100644 index 0000000000..07229784f2 --- /dev/null +++ b/website/versioned_docs/version-v1.2/solidity-docs/interfaces/IVerifier.md @@ -0,0 +1,25 @@ +# IVerifier + +an interface for a Groth16 verifier contract + +### verify + +```solidity +function verify(uint256[8] _proof, struct SnarkCommon.VerifyingKey vk, uint256 input) external view returns (bool) +``` + +Verify a zk-SNARK proof + +#### Parameters + +| Name | Type | Description | +| ------- | ------------------------------- | -------------------------------- | +| \_proof | uint256[8] | The proof | +| vk | struct SnarkCommon.VerifyingKey | The verifying key | +| input | uint256 | The public inputs to the circuit | + +#### Return Values + +| Name | Type | Description | +| ---- | ---- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| [0] | bool | Whether the proof is valid given the verifying key and public input. Note that this function only supports one public input. Refer to the Semaphore source code for a verifier that supports multiple public inputs. | diff --git a/website/versioned_docs/version-v1.2/solidity-docs/interfaces/IVkRegistry.md b/website/versioned_docs/version-v1.2/solidity-docs/interfaces/IVkRegistry.md new file mode 100644 index 0000000000..1e11fd55e4 --- /dev/null +++ b/website/versioned_docs/version-v1.2/solidity-docs/interfaces/IVkRegistry.md @@ -0,0 +1,70 @@ +# IVkRegistry + +VkRegistry interface + +### getTallyVk + +```solidity +function getTallyVk(uint256 _stateTreeDepth, uint256 _intStateTreeDepth, uint256 _voteOptionTreeDepth) external view returns (struct SnarkCommon.VerifyingKey) +``` + +Get the tally verifying key + +#### Parameters + +| Name | Type | Description | +| --------------------- | ------- | --------------------------------- | +| \_stateTreeDepth | uint256 | The state tree depth | +| \_intStateTreeDepth | uint256 | The intermediate state tree depth | +| \_voteOptionTreeDepth | uint256 | The vote option tree depth | + +#### Return Values + +| Name | Type | Description | +| ---- | ------------------------------- | ----------------- | +| [0] | struct SnarkCommon.VerifyingKey | The verifying key | + +### getProcessVk + +```solidity +function getProcessVk(uint256 _stateTreeDepth, uint256 _messageTreeDepth, uint256 _voteOptionTreeDepth, uint256 _messageBatchSize) external view returns (struct SnarkCommon.VerifyingKey) +``` + +Get the process verifying key + +#### Parameters + +| Name | Type | Description | +| --------------------- | ------- | -------------------------- | +| \_stateTreeDepth | uint256 | The state tree depth | +| \_messageTreeDepth | uint256 | The message tree depth | +| \_voteOptionTreeDepth | uint256 | The vote option tree depth | +| \_messageBatchSize | uint256 | The message batch size | + +#### Return Values + +| Name | Type | Description | +| ---- | ------------------------------- | ----------------- | +| [0] | struct SnarkCommon.VerifyingKey | The verifying key | + +### getSubsidyVk + +```solidity +function getSubsidyVk(uint256 _stateTreeDepth, uint256 _intStateTreeDepth, uint256 _voteOptionTreeDepth) external view returns (struct SnarkCommon.VerifyingKey) +``` + +Get the subsidy verifying key + +#### Parameters + +| Name | Type | Description | +| --------------------- | ------- | --------------------------------- | +| \_stateTreeDepth | uint256 | The state tree depth | +| \_intStateTreeDepth | uint256 | The intermediate state tree depth | +| \_voteOptionTreeDepth | uint256 | The vote option tree depth | + +#### Return Values + +| Name | Type | Description | +| ---- | ------------------------------- | ----------------- | +| [0] | struct SnarkCommon.VerifyingKey | The verifying key | diff --git a/website/versioned_docs/version-v1.2/solidity-docs/mocks/MockHatsProtocol.md b/website/versioned_docs/version-v1.2/solidity-docs/mocks/MockHatsProtocol.md new file mode 100644 index 0000000000..bb8a6deda9 --- /dev/null +++ b/website/versioned_docs/version-v1.2/solidity-docs/mocks/MockHatsProtocol.md @@ -0,0 +1,133 @@ +# MockHatsProtocol + +A mock contract to test the HatsGatekeeper + +### hats + +```solidity +contract IHats hats +``` + +### lastTopHat + +```solidity +uint256 lastTopHat +``` + +### lastHat + +```solidity +uint256 lastHat +``` + +### constructor + +```solidity +constructor(address _hats) public payable +``` + +Deploy an instance of MockHatsProtocol + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | -------------------------- | +| \_hats | address | The Hats Protocol contract | + +### mintTopHat + +```solidity +function mintTopHat(address _target, string _details, string _imageURI) external returns (uint256) +``` + +Creates and mints a Hat that is its own admin, i.e. a "topHat" + +_A topHat has no eligibility and no toggle_ + +#### Parameters + +| Name | Type | Description | +| ---------- | ------- | -------------------------------------------------------------------------------------------------------------------------------------------------------- | +| \_target | address | The address to which the newly created topHat is minted | +| \_details | string | A description of the Hat [optional]. Should not be larger than 7000 bytes (enforced in changeHatDetails) | +| \_imageURI | string | The image uri for this top hat and the fallback for its downstream hats [optional]. Should not be larger than 7000 bytes (enforced in changeHatImageURI) | + +#### Return Values + +| Name | Type | Description | +| ---- | ------- | ------------------------------------------- | +| [0] | uint256 | topHatId The id of the newly created topHat | + +### createHat + +```solidity +function createHat(uint256 _admin, string _details, uint32 _maxSupply, address _eligibility, address _toggle, bool _mutable, string _imageURI) external returns (uint256) +``` + +Creates a new hat. The msg.sender must wear the `_admin` hat. + +_Initializes a new Hat struct, but does not mint any tokens._ + +#### Parameters + +| Name | Type | Description | +| ------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------- | +| \_admin | uint256 | The id of the Hat that will control who wears the newly created hat | +| \_details | string | A description of the Hat. Should not be larger than 7000 bytes (enforced in changeHatDetails) | +| \_maxSupply | uint32 | The total instances of the Hat that can be worn at once | +| \_eligibility | address | The address that can report on the Hat wearer's status | +| \_toggle | address | The address that can deactivate the Hat | +| \_mutable | bool | Whether the hat's properties are changeable after creation | +| \_imageURI | string | The image uri for this hat and the fallback for its downstream hats [optional]. Should not be larger than 7000 bytes (enforced in changeHatImageURI) | + +#### Return Values + +| Name | Type | Description | +| ---- | ------- | ---------------------------------------- | +| [0] | uint256 | newHatId The id of the newly created Hat | + +### mintHat + +```solidity +function mintHat(uint256 _hatId, address _wearer) external returns (bool) +``` + +Mints an ERC1155-similar token of the Hat to an eligible recipient, who then "wears" the hat + +_The msg.sender must wear an admin Hat of `_hatId`, and the recipient must be eligible to wear `_hatId`_ + +#### Parameters + +| Name | Type | Description | +| -------- | ------- | -------------------------------------- | +| \_hatId | uint256 | The id of the Hat to mint | +| \_wearer | address | The address to which the Hat is minted | + +#### Return Values + +| Name | Type | Description | +| ---- | ---- | ----------- | +| [0] | bool | | + +### isWearerOfHat + +```solidity +function isWearerOfHat(address account, uint256 hat) external view returns (bool) +``` + +Checks whether a given address wears a given Hat + +_Convenience function that wraps `balanceOf`_ + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | --------------------------------------------- | +| account | address | The address in question | +| hat | uint256 | The id of the Hat that the `_user` might wear | + +#### Return Values + +| Name | Type | Description | +| ---- | ---- | ------------------------------------------- | +| [0] | bool | isWearer Whether the `_user` wears the Hat. | diff --git a/website/versioned_docs/version-v1.2/solidity-docs/trees/AccQueue.md b/website/versioned_docs/version-v1.2/solidity-docs/trees/AccQueue.md new file mode 100644 index 0000000000..55bab3e64d --- /dev/null +++ b/website/versioned_docs/version-v1.2/solidity-docs/trees/AccQueue.md @@ -0,0 +1,464 @@ +# AccQueue + +This contract defines a Merkle tree where each leaf insertion only updates a +subtree. To obtain the main tree root, the contract owner must merge the +subtrees together. Merging subtrees requires at least 2 operations: +mergeSubRoots(), and merge(). To get around the gas limit, +the mergeSubRoots() can be performed in multiple transactions. + +### MAX_DEPTH + +```solidity +uint256 MAX_DEPTH +``` + +### Queue + +```solidity +struct Queue { + uint256[4][33] levels; + uint256[33] indices; +} +``` + +### subDepth + +```solidity +uint256 subDepth +``` + +### hashLength + +```solidity +uint256 hashLength +``` + +### subTreeCapacity + +```solidity +uint256 subTreeCapacity +``` + +### isBinary + +```solidity +bool isBinary +``` + +### currentSubtreeIndex + +```solidity +uint256 currentSubtreeIndex +``` + +### leafQueue + +```solidity +struct AccQueue.Queue leafQueue +``` + +### subRootQueue + +```solidity +struct AccQueue.Queue subRootQueue +``` + +### subRoots + +```solidity +mapping(uint256 => uint256) subRoots +``` + +### mainRoots + +```solidity +uint256[33] mainRoots +``` + +### subTreesMerged + +```solidity +bool subTreesMerged +``` + +### treeMerged + +```solidity +bool treeMerged +``` + +### smallSRTroot + +```solidity +uint256 smallSRTroot +``` + +### nextSubRootIndex + +```solidity +uint256 nextSubRootIndex +``` + +### numLeaves + +```solidity +uint256 numLeaves +``` + +### SubDepthCannotBeZero + +```solidity +error SubDepthCannotBeZero() +``` + +custom errors + +### SubdepthTooLarge + +```solidity +error SubdepthTooLarge(uint256 _subDepth, uint256 max) +``` + +### InvalidHashLength + +```solidity +error InvalidHashLength() +``` + +### DepthCannotBeZero + +```solidity +error DepthCannotBeZero() +``` + +### SubTreesAlreadyMerged + +```solidity +error SubTreesAlreadyMerged() +``` + +### NothingToMerge + +```solidity +error NothingToMerge() +``` + +### SubTreesNotMerged + +```solidity +error SubTreesNotMerged() +``` + +### DepthTooLarge + +```solidity +error DepthTooLarge(uint256 _depth, uint256 max) +``` + +### DepthTooSmall + +```solidity +error DepthTooSmall(uint256 _depth, uint256 min) +``` + +### InvalidIndex + +```solidity +error InvalidIndex(uint256 _index) +``` + +### InvalidLevel + +```solidity +error InvalidLevel() +``` + +### constructor + +```solidity +constructor(uint256 _subDepth, uint256 _hashLength) internal payable +``` + +Create a new AccQueue + +#### Parameters + +| Name | Type | Description | +| ------------ | ------- | --------------------------------------- | +| \_subDepth | uint256 | The depth of each subtree. | +| \_hashLength | uint256 | The number of leaves per node (2 or 5). | + +### hashLevel + +```solidity +function hashLevel(uint256 _level, uint256 _leaf) internal virtual returns (uint256 _hash) +``` + +Hash the contents of the specified level and the specified leaf. +This is a virtual function as the hash function which the overriding +contract uses will be either hashLeftRight or hash5, which require +different input array lengths. + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | -------------------------------- | +| \_level | uint256 | The level to hash. | +| \_leaf | uint256 | The leaf include with the level. | + +#### Return Values + +| Name | Type | Description | +| ------ | ------- | ------------------------------- | +| \_hash | uint256 | The hash of the level and leaf. | + +### hashLevelLeaf + +```solidity +function hashLevelLeaf(uint256 _level, uint256 _leaf) public view virtual returns (uint256 _hash) +``` + +Hash the contents of the specified level and the specified leaf. +This is a virtual function as the hash function which the overriding +contract uses will be either hashLeftRight or hash5, which require +different input array lengths. + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | -------------------------------- | +| \_level | uint256 | The level to hash. | +| \_leaf | uint256 | The leaf include with the level. | + +#### Return Values + +| Name | Type | Description | +| ------ | ------- | ------------------------------- | +| \_hash | uint256 | The hash of the level and leaf. | + +### getZero + +```solidity +function getZero(uint256 _level) internal virtual returns (uint256 zero) +``` + +Returns the zero leaf at a specified level. +This is a virtual function as the hash function which the overriding +contract uses will be either hashLeftRight or hash5, which will produce +different zero values (e.g. hashLeftRight(0, 0) vs +hash5([0, 0, 0, 0, 0]). Moreover, the zero value may be a +nothing-up-my-sleeve value. + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | ------------------------------------------- | +| \_level | uint256 | The level at which to return the zero leaf. | + +#### Return Values + +| Name | Type | Description | +| ---- | ------- | ------------------------------------- | +| zero | uint256 | The zero leaf at the specified level. | + +### enqueue + +```solidity +function enqueue(uint256 _leaf) public returns (uint256 leafIndex) +``` + +Add a leaf to the queue for the current subtree. + +#### Parameters + +| Name | Type | Description | +| ------ | ------- | ---------------- | +| \_leaf | uint256 | The leaf to add. | + +#### Return Values + +| Name | Type | Description | +| --------- | ------- | ----------------------------------- | +| leafIndex | uint256 | The index of the leaf in the queue. | + +### \_enqueue + +```solidity +function _enqueue(uint256 _leaf, uint256 _level) internal +``` + +Updates the queue at a given level and hashes any subroots +that need to be hashed. + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | ------------------------------------- | +| \_leaf | uint256 | The leaf to add. | +| \_level | uint256 | The level at which to queue the leaf. | + +### fill + +```solidity +function fill() public +``` + +Fill any empty leaves of the current subtree with zeros and store the +resulting subroot. + +### \_fill + +```solidity +function _fill(uint256 _level) internal virtual +``` + +A function that queues zeros to the specified level, hashes, +the level, and enqueues the hash to the next level. + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | ---------------------------------- | +| \_level | uint256 | The level at which to queue zeros. | + +### insertSubTree + +```solidity +function insertSubTree(uint256 _subRoot) public +``` + +Insert a subtree. Used for batch enqueues. + +### calcMinHeight + +```solidity +function calcMinHeight() public view returns (uint256 depth) +``` + +Calculate the lowest possible height of a tree with +all the subroots merged together. + +#### Return Values + +| Name | Type | Description | +| ----- | ------- | ------------------------------------------------- | +| depth | uint256 | The lowest possible height of a tree with all the | + +### mergeSubRoots + +```solidity +function mergeSubRoots(uint256 _numSrQueueOps) public +``` + +Merge all subtrees to form the shortest possible tree. +This function can be called either once to merge all subtrees in a +single transaction, or multiple times to do the same in multiple +transactions. + +#### Parameters + +| Name | Type | Description | +| --------------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| \_numSrQueueOps | uint256 | The number of times this function will call queueSubRoot(), up to the maximum number of times necessary. If it is set to 0, it will call queueSubRoot() as many times as is necessary. Set this to a low number and call this function multiple times if there are many subroots to merge, or a single transaction could run out of gas. | + +### queueSubRoot + +```solidity +function queueSubRoot(uint256 _leaf, uint256 _level, uint256 _maxDepth) internal +``` + +Queues a subroot into the subroot tree. + +#### Parameters + +| Name | Type | Description | +| ---------- | ------- | ----------------------------------- | +| \_leaf | uint256 | The value to queue. | +| \_level | uint256 | The level at which to queue \_leaf. | +| \_maxDepth | uint256 | The depth of the tree. | + +### merge + +```solidity +function merge(uint256 _depth) public returns (uint256 root) +``` + +Merge all subtrees to form a main tree with a desired depth. + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | ------------------------------------------------------------------------------------ | +| \_depth | uint256 | The depth of the main tree. It must fit all the leaves or this function will revert. | + +#### Return Values + +| Name | Type | Description | +| ---- | ------- | -------------------------- | +| root | uint256 | The root of the main tree. | + +### getSubRoot + +```solidity +function getSubRoot(uint256 _index) public view returns (uint256 subRoot) +``` + +Returns the subroot at the specified index. Reverts if the index refers +to a subtree which has not been filled yet. + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | ------------------ | +| \_index | uint256 | The subroot index. | + +#### Return Values + +| Name | Type | Description | +| ------- | ------- | ----------------------------------- | +| subRoot | uint256 | The subroot at the specified index. | + +### getSmallSRTroot + +```solidity +function getSmallSRTroot() public view returns (uint256 smallSubTreeRoot) +``` + +Returns the subroot tree (SRT) root. Its value must first be computed +using mergeSubRoots. + +#### Return Values + +| Name | Type | Description | +| ---------------- | ------- | ------------- | +| smallSubTreeRoot | uint256 | The SRT root. | + +### getMainRoot + +```solidity +function getMainRoot(uint256 _depth) public view returns (uint256 mainRoot) +``` + +Return the merged Merkle root of all the leaves at a desired depth. + +_merge() or merged(\_depth) must be called first._ + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | ---------------------------------------------------------------------------------------- | +| \_depth | uint256 | The depth of the main tree. It must first be computed using mergeSubRoots() and merge(). | + +#### Return Values + +| Name | Type | Description | +| -------- | ------- | -------------------------- | +| mainRoot | uint256 | The root of the main tree. | + +### getSrIndices + +```solidity +function getSrIndices() public view returns (uint256 next, uint256 current) +``` + +Get the next subroot index and the current subtree index. diff --git a/website/versioned_docs/version-v1.2/solidity-docs/trees/AccQueueBinary.md b/website/versioned_docs/version-v1.2/solidity-docs/trees/AccQueueBinary.md new file mode 100644 index 0000000000..2fba2bc6ff --- /dev/null +++ b/website/versioned_docs/version-v1.2/solidity-docs/trees/AccQueueBinary.md @@ -0,0 +1,60 @@ +# AccQueueBinary + +This contract defines a Merkle tree where each leaf insertion only updates a +subtree. To obtain the main tree root, the contract owner must merge the +subtrees together. Merging subtrees requires at least 2 operations: +mergeSubRoots(), and merge(). To get around the gas limit, +the mergeSubRoots() can be performed in multiple transactions. + +_This contract is for a binary tree (2 leaves per node)_ + +### constructor + +```solidity +constructor(uint256 _subDepth) internal +``` + +Create a new AccQueueBinary + +### hashLevel + +```solidity +function hashLevel(uint256 _level, uint256 _leaf) internal returns (uint256 hashed) +``` + +Hash the contents of the specified level and the specified leaf. + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | -------------------------------- | +| \_level | uint256 | The level to hash. | +| \_leaf | uint256 | The leaf include with the level. | + +#### Return Values + +| Name | Type | Description | +| ------ | ------- | ------------------------------- | +| hashed | uint256 | The hash of the level and leaf. | + +### hashLevelLeaf + +```solidity +function hashLevelLeaf(uint256 _level, uint256 _leaf) public view returns (uint256 hashed) +``` + +Hash the contents of the specified level and the specified leaf. + +### \_fill + +```solidity +function _fill(uint256 _level) internal +``` + +An internal function which fills a subtree. + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | --------------------------------------- | +| \_level | uint256 | The level at which to fill the subtree. | diff --git a/website/versioned_docs/version-v1.2/solidity-docs/trees/AccQueueBinary0.md b/website/versioned_docs/version-v1.2/solidity-docs/trees/AccQueueBinary0.md new file mode 100644 index 0000000000..1224bdf593 --- /dev/null +++ b/website/versioned_docs/version-v1.2/solidity-docs/trees/AccQueueBinary0.md @@ -0,0 +1,40 @@ +# AccQueueBinary0 + +This contract extends AccQueueBinary and MerkleBinary0 + +_This contract is used for creating a +Merkle tree with binary (2 leaves per node) structure_ + +### constructor + +```solidity +constructor(uint256 _subDepth) public +``` + +Constructor for creating AccQueueBinary0 contract + +#### Parameters + +| Name | Type | Description | +| ---------- | ------- | ------------------------- | +| \_subDepth | uint256 | The depth of each subtree | + +### getZero + +```solidity +function getZero(uint256 _level) internal view returns (uint256 zero) +``` + +Returns the zero leaf at a specified level + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | ------------------------------------------ | +| \_level | uint256 | The level at which to return the zero leaf | + +#### Return Values + +| Name | Type | Description | +| ---- | ------- | ------------------------------------ | +| zero | uint256 | The zero leaf at the specified level | diff --git a/website/versioned_docs/version-v1.2/solidity-docs/trees/AccQueueBinaryMaci.md b/website/versioned_docs/version-v1.2/solidity-docs/trees/AccQueueBinaryMaci.md new file mode 100644 index 0000000000..7f883c8afe --- /dev/null +++ b/website/versioned_docs/version-v1.2/solidity-docs/trees/AccQueueBinaryMaci.md @@ -0,0 +1,34 @@ +# AccQueueBinaryMaci + +This contract extends AccQueueBinary and MerkleBinaryMaci + +_This contract is used for creating a +Merkle tree with binary (2 leaves per node) structure_ + +### constructor + +```solidity +constructor(uint256 _subDepth) public +``` + +Constructor for creating AccQueueBinaryMaci contract + +#### Parameters + +| Name | Type | Description | +| ---------- | ------- | ------------------------- | +| \_subDepth | uint256 | The depth of each subtree | + +### getZero + +```solidity +function getZero(uint256 _level) internal view returns (uint256 zero) +``` + +Returns the zero leaf at a specified level + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | ------------------------------------------ | +| \_level | uint256 | The level at which to return the zero leaf | diff --git a/website/versioned_docs/version-v1.2/solidity-docs/trees/AccQueueQuinary.md b/website/versioned_docs/version-v1.2/solidity-docs/trees/AccQueueQuinary.md new file mode 100644 index 0000000000..138c31da61 --- /dev/null +++ b/website/versioned_docs/version-v1.2/solidity-docs/trees/AccQueueQuinary.md @@ -0,0 +1,75 @@ +# AccQueueQuinary + +This contract defines a Merkle tree where each leaf insertion only updates a +subtree. To obtain the main tree root, the contract owner must merge the +subtrees together. Merging subtrees requires at least 2 operations: +mergeSubRoots(), and merge(). To get around the gas limit, +the mergeSubRoots() can be performed in multiple transactions. + +_This contract is for a quinary tree (5 leaves per node)_ + +### constructor + +```solidity +constructor(uint256 _subDepth) internal +``` + +Create a new AccQueueQuinary instance + +### hashLevel + +```solidity +function hashLevel(uint256 _level, uint256 _leaf) internal returns (uint256 hashed) +``` + +Hash the contents of the specified level and the specified leaf. + +_it also frees up storage slots to refund gas._ + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | -------------------------------- | +| \_level | uint256 | The level to hash. | +| \_leaf | uint256 | The leaf include with the level. | + +#### Return Values + +| Name | Type | Description | +| ------ | ------- | ------------------------------- | +| hashed | uint256 | The hash of the level and leaf. | + +### hashLevelLeaf + +```solidity +function hashLevelLeaf(uint256 _level, uint256 _leaf) public view returns (uint256 hashed) +``` + +Hash the contents of the specified level and the specified leaf. + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | -------------------------------- | +| \_level | uint256 | The level to hash. | +| \_leaf | uint256 | The leaf include with the level. | + +#### Return Values + +| Name | Type | Description | +| ------ | ------- | ------------------------------- | +| hashed | uint256 | The hash of the level and leaf. | + +### \_fill + +```solidity +function _fill(uint256 _level) internal +``` + +An internal function which fills a subtree + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | -------------------------------------- | +| \_level | uint256 | The level at which to fill the subtree | diff --git a/website/versioned_docs/version-v1.2/solidity-docs/trees/AccQueueQuinary0.md b/website/versioned_docs/version-v1.2/solidity-docs/trees/AccQueueQuinary0.md new file mode 100644 index 0000000000..ea3d66ea0f --- /dev/null +++ b/website/versioned_docs/version-v1.2/solidity-docs/trees/AccQueueQuinary0.md @@ -0,0 +1,40 @@ +# AccQueueQuinary0 + +This contract extends AccQueueQuinary and MerkleQuinary0 + +_This contract is used for creating a +Merkle tree with quinary (5 leaves per node) structure_ + +### constructor + +```solidity +constructor(uint256 _subDepth) public +``` + +Constructor for creating AccQueueQuinary0 contract + +#### Parameters + +| Name | Type | Description | +| ---------- | ------- | ------------------------- | +| \_subDepth | uint256 | The depth of each subtree | + +### getZero + +```solidity +function getZero(uint256 _level) internal view returns (uint256 zero) +``` + +Returns the zero leaf at a specified level + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | ------------------------------------------ | +| \_level | uint256 | The level at which to return the zero leaf | + +#### Return Values + +| Name | Type | Description | +| ---- | ------- | ------------------------------------ | +| zero | uint256 | The zero leaf at the specified level | diff --git a/website/versioned_docs/version-v1.2/solidity-docs/trees/AccQueueQuinaryBlankSl.md b/website/versioned_docs/version-v1.2/solidity-docs/trees/AccQueueQuinaryBlankSl.md new file mode 100644 index 0000000000..ef2d3426f3 --- /dev/null +++ b/website/versioned_docs/version-v1.2/solidity-docs/trees/AccQueueQuinaryBlankSl.md @@ -0,0 +1,40 @@ +# AccQueueQuinaryBlankSl + +This contract extends AccQueueQuinary and MerkleQuinaryBlankSl + +_This contract is used for creating a +Merkle tree with quinary (5 leaves per node) structure_ + +### constructor + +```solidity +constructor(uint256 _subDepth) public +``` + +Constructor for creating AccQueueQuinaryBlankSl contract + +#### Parameters + +| Name | Type | Description | +| ---------- | ------- | ------------------------- | +| \_subDepth | uint256 | The depth of each subtree | + +### getZero + +```solidity +function getZero(uint256 _level) internal view returns (uint256 zero) +``` + +Returns the zero leaf at a specified level + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | ------------------------------------------ | +| \_level | uint256 | The level at which to return the zero leaf | + +#### Return Values + +| Name | Type | Description | +| ---- | ------- | ------------------------------------ | +| zero | uint256 | The zero leaf at the specified level | diff --git a/website/versioned_docs/version-v1.2/solidity-docs/trees/AccQueueQuinaryMaci.md b/website/versioned_docs/version-v1.2/solidity-docs/trees/AccQueueQuinaryMaci.md new file mode 100644 index 0000000000..7a1eafc27a --- /dev/null +++ b/website/versioned_docs/version-v1.2/solidity-docs/trees/AccQueueQuinaryMaci.md @@ -0,0 +1,40 @@ +# AccQueueQuinaryMaci + +This contract extends AccQueueQuinary and MerkleQuinaryMaci + +_This contract is used for creating a +Merkle tree with quinary (5 leaves per node) structure_ + +### constructor + +```solidity +constructor(uint256 _subDepth) public +``` + +Constructor for creating AccQueueQuinaryMaci contract + +#### Parameters + +| Name | Type | Description | +| ---------- | ------- | ------------------------- | +| \_subDepth | uint256 | The depth of each subtree | + +### getZero + +```solidity +function getZero(uint256 _level) internal view returns (uint256 zero) +``` + +Returns the zero leaf at a specified level + +#### Parameters + +| Name | Type | Description | +| ------- | ------- | ------------------------------------------ | +| \_level | uint256 | The level at which to return the zero leaf | + +#### Return Values + +| Name | Type | Description | +| ---- | ------- | ------------------------------------ | +| zero | uint256 | The zero leaf at the specified level | diff --git a/website/versioned_docs/version-v1.2/solidity-docs/trees/EmptyBallotRoots.md b/website/versioned_docs/version-v1.2/solidity-docs/trees/EmptyBallotRoots.md new file mode 100644 index 0000000000..700ee82f6a --- /dev/null +++ b/website/versioned_docs/version-v1.2/solidity-docs/trees/EmptyBallotRoots.md @@ -0,0 +1,13 @@ +# EmptyBallotRoots + +### emptyBallotRoots + +```solidity +uint256[5] emptyBallotRoots +``` + +### constructor + +```solidity +constructor() internal +``` diff --git a/website/versioned_docs/version-v1.2/solidity-docs/utilities/CommonUtilities.md b/website/versioned_docs/version-v1.2/solidity-docs/utilities/CommonUtilities.md new file mode 100644 index 0000000000..ce858d8339 --- /dev/null +++ b/website/versioned_docs/version-v1.2/solidity-docs/utilities/CommonUtilities.md @@ -0,0 +1,25 @@ +# CommonUtilities + +A contract that holds common utilities +which are to be used by multiple contracts +namely Subsidy, Tally and MessageProcessor + +### VotingPeriodNotPassed + +```solidity +error VotingPeriodNotPassed() +``` + +### \_votingPeriodOver + +```solidity +function _votingPeriodOver(contract IPoll _poll) internal view +``` + +common function for MessageProcessor, Tally and Subsidy + +#### Parameters + +| Name | Type | Description | +| ------ | -------------- | ---------------------- | +| \_poll | contract IPoll | the poll to be checked | diff --git a/website/versioned_docs/version-v1.2/solidity-docs/utilities/DomainObjs.md b/website/versioned_docs/version-v1.2/solidity-docs/utilities/DomainObjs.md new file mode 100644 index 0000000000..1a50df882a --- /dev/null +++ b/website/versioned_docs/version-v1.2/solidity-docs/utilities/DomainObjs.md @@ -0,0 +1,40 @@ +# DomainObjs + +An utility contract that holds +a number of domain objects and functions + +### MESSAGE_DATA_LENGTH + +```solidity +uint8 MESSAGE_DATA_LENGTH +``` + +the length of a MACI message + +### Message + +```solidity +struct Message { + uint256 msgType; + uint256[10] data; +} +``` + +### PubKey + +```solidity +struct PubKey { + uint256 x; + uint256 y; +} +``` + +### StateLeaf + +```solidity +struct StateLeaf { + struct DomainObjs.PubKey pubKey; + uint256 voiceCreditBalance; + uint256 timestamp; +} +``` diff --git a/website/versioned_docs/version-v1.2/solidity-docs/utilities/Params.md b/website/versioned_docs/version-v1.2/solidity-docs/utilities/Params.md new file mode 100644 index 0000000000..179bd40075 --- /dev/null +++ b/website/versioned_docs/version-v1.2/solidity-docs/utilities/Params.md @@ -0,0 +1,36 @@ +# Params + +This contracts contains a number of structures +which are to be passed as parameters to Poll contracts. +This way we can reduce the number of parameters +and avoid a stack too deep error during compilation. + +### TreeDepths + +```solidity +struct TreeDepths { + uint8 intStateTreeDepth; + uint8 messageTreeSubDepth; + uint8 messageTreeDepth; + uint8 voteOptionTreeDepth; +} +``` + +### MaxValues + +```solidity +struct MaxValues { + uint256 maxMessages; + uint256 maxVoteOptions; +} +``` + +### ExtContracts + +```solidity +struct ExtContracts { + contract IMACI maci; + contract AccQueue messageAq; + contract TopupCredit topupCredit; +} +``` diff --git a/website/versioned_docs/version-v1.2/solidity-docs/utilities/Utilities.md b/website/versioned_docs/version-v1.2/solidity-docs/utilities/Utilities.md new file mode 100644 index 0000000000..b1c44416b3 --- /dev/null +++ b/website/versioned_docs/version-v1.2/solidity-docs/utilities/Utilities.md @@ -0,0 +1,79 @@ +# Utilities + +An utility contract that can be used to: + +- hash a state leaf +- pad and hash a MACI message +- hash a MACI message and an encryption public key + +### InvalidMessage + +```solidity +error InvalidMessage() +``` + +custom errors + +### hashStateLeaf + +```solidity +function hashStateLeaf(struct DomainObjs.StateLeaf _stateLeaf) public pure returns (uint256 ciphertext) +``` + +An utility function used to hash a state leaf + +#### Parameters + +| Name | Type | Description | +| ----------- | --------------------------- | --------------------------- | +| \_stateLeaf | struct DomainObjs.StateLeaf | the state leaf to be hashed | + +#### Return Values + +| Name | Type | Description | +| ---------- | ------- | -------------------------- | +| ciphertext | uint256 | The hash of the state leaf | + +### padAndHashMessage + +```solidity +function padAndHashMessage(uint256[2] dataToPad, uint256 msgType) public pure returns (struct DomainObjs.Message message, struct DomainObjs.PubKey padKey, uint256 msgHash) +``` + +An utility function used to pad and hash a MACI message + +#### Parameters + +| Name | Type | Description | +| --------- | ---------- | ----------------------- | +| dataToPad | uint256[2] | the data to be padded | +| msgType | uint256 | the type of the message | + +#### Return Values + +| Name | Type | Description | +| ------- | ------------------------- | ------------------------------------------------- | +| message | struct DomainObjs.Message | The padded message | +| padKey | struct DomainObjs.PubKey | The padding public key | +| msgHash | uint256 | The hash of the padded message and encryption key | + +### hashMessageAndEncPubKey + +```solidity +function hashMessageAndEncPubKey(struct DomainObjs.Message _message, struct DomainObjs.PubKey _encPubKey) public pure returns (uint256 msgHash) +``` + +An utility function used to hash a MACI message and an encryption public key + +#### Parameters + +| Name | Type | Description | +| ----------- | ------------------------- | -------------------------------------- | +| \_message | struct DomainObjs.Message | the message to be hashed | +| \_encPubKey | struct DomainObjs.PubKey | the encryption public key to be hashed | + +#### Return Values + +| Name | Type | Description | +| ------- | ------- | ----------------------------------------------------- | +| msgHash | uint256 | The hash of the message and the encryption public key | diff --git a/website/versioned_docs/version-v1.2/testing-in-detail.md b/website/versioned_docs/version-v1.2/testing-in-detail.md index 5ade3d0642..fb878b80f4 100644 --- a/website/versioned_docs/version-v1.2/testing-in-detail.md +++ b/website/versioned_docs/version-v1.2/testing-in-detail.md @@ -7,7 +7,7 @@ sidebar_position: 12 # Testing in detail -This doc expands on our [introduction to testing](/docs/testing) doc and explains how MACI tests work in greater detail. This information should be used by MACI's maintainers as well as contributors. +This doc expands on our [introduction to testing](/docs/v1.2/testing) doc and explains how MACI tests work in greater detail. This information should be used by MACI's maintainers as well as contributors. ## Automated Tests @@ -171,7 +171,7 @@ Within the circuits folder, there are a number of tests that are used to verify These tests often use mock data from the `core` package. For instance, when testing the `processMessages` circuit, we are required to generate the parameters from the `core` packing, using the `Poll:processMessages` function. The same applies to vote tallying, where we need the `Poll:tally` function to be run first with mock users and vote messages. -All of the tests run using test parameters, usually `10, 2, 1, 2`, aside from the tests inside: [`ceremonyParam`](https://github.com/privacy-scaling-explorations/maci/blob/dev/circuits/ts/__tests__/CeremonyParams.test.ts) which use the parameters of the latest MACI ceremony. More details on the trusted setup can be found [here](/docs/trusted-setup). +All of the tests run using test parameters, usually `10, 2, 1, 2`, aside from the tests inside: [`ceremonyParam`](https://github.com/privacy-scaling-explorations/maci/blob/dev/circuits/ts/__tests__/CeremonyParams.test.ts) which use the parameters of the latest MACI ceremony. More details on the trusted setup can be found [here](/docs/v1.2/trusted-setup). ### Core diff --git a/website/versioned_docs/version-v1.2/typedoc/cli/.nojekyll b/website/versioned_docs/version-v1.2/typedoc/cli/.nojekyll new file mode 100644 index 0000000000..e2ac6616ad --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/cli/.nojekyll @@ -0,0 +1 @@ +TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false. \ No newline at end of file diff --git a/website/versioned_docs/version-v1.2/typedoc/cli/index.md b/website/versioned_docs/version-v1.2/typedoc/cli/index.md new file mode 100644 index 0000000000..f5aebb8c5c --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/cli/index.md @@ -0,0 +1,15 @@ +--- +title: Cli +sidebar_label: Cli +--- + +[![NPM Package][cli-npm-badge]][cli-npm-link] +[![Actions Status][cli-actions-badge]][cli-actions-link] + +Please refer to the [documentation for the +CLI](https://maci.pse.dev/docs/cli). + +[cli-npm-badge]: https://img.shields.io/npm/v/maci-cli.svg +[cli-actions-badge]: https://github.com/privacy-scaling-explorations/maci/actions/workflows/e2e.yml/badge.svg +[cli-npm-link]: https://www.npmjs.com/package/maci-cli +[cli-actions-link]: https://github.com/privacy-scaling-explorations/maci/actions?query=workflow%3ACI diff --git a/website/versioned_docs/version-v1.2/typedoc/cli/interfaces/AirdropArgs.md b/website/versioned_docs/version-v1.2/typedoc/cli/interfaces/AirdropArgs.md new file mode 100644 index 0000000000..c164ff5409 --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/cli/interfaces/AirdropArgs.md @@ -0,0 +1,89 @@ +--- +title: AirdropArgs +sidebar_label: AirdropArgs +--- + +Interface for the arguments to the airdrop command + +## Table of contents + +### Properties + +- [amount](AirdropArgs.md#amount) +- [contractAddress](AirdropArgs.md#contractaddress) +- [maciAddress](AirdropArgs.md#maciaddress) +- [pollId](AirdropArgs.md#pollid) +- [quiet](AirdropArgs.md#quiet) +- [signer](AirdropArgs.md#signer) + +## Properties + +### amount + +• **amount**: `number` + +The amount of credits to airdrop + +#### Defined in + +[utils/interfaces.ts:174](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L174) + +--- + +### contractAddress + +• `Optional` **contractAddress**: `string` + +The address of the ERC20 contract + +#### Defined in + +[utils/interfaces.ts:184](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L184) + +--- + +### maciAddress + +• `Optional` **maciAddress**: `string` + +The address of the MACI contract + +#### Defined in + +[utils/interfaces.ts:194](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L194) + +--- + +### pollId + +• `Optional` **pollId**: `bigint` + +The id of the poll + +#### Defined in + +[utils/interfaces.ts:189](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L189) + +--- + +### quiet + +• `Optional` **quiet**: `boolean` + +Whether to log the output + +#### Defined in + +[utils/interfaces.ts:199](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L199) + +--- + +### signer + +• **signer**: `Signer` + +A signer object + +#### Defined in + +[utils/interfaces.ts:179](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L179) diff --git a/website/versioned_docs/version-v1.2/typedoc/cli/interfaces/DeployArgs.md b/website/versioned_docs/version-v1.2/typedoc/cli/interfaces/DeployArgs.md new file mode 100644 index 0000000000..8deacc1be1 --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/cli/interfaces/DeployArgs.md @@ -0,0 +1,154 @@ +--- +title: DeployArgs +sidebar_label: DeployArgs +--- + +Interface for the arguments to the deploy command + +## Table of contents + +### Properties + +- [initialVoiceCredits](DeployArgs.md#initialvoicecredits) +- [initialVoiceCreditsProxyAddress](DeployArgs.md#initialvoicecreditsproxyaddress) +- [poseidonT3Address](DeployArgs.md#poseidont3address) +- [poseidonT4Address](DeployArgs.md#poseidont4address) +- [poseidonT5Address](DeployArgs.md#poseidont5address) +- [poseidonT6Address](DeployArgs.md#poseidont6address) +- [quiet](DeployArgs.md#quiet) +- [signer](DeployArgs.md#signer) +- [signupGatekeeperAddress](DeployArgs.md#signupgatekeeperaddress) +- [stateTreeDepth](DeployArgs.md#statetreedepth) +- [useQv](DeployArgs.md#useqv) + +## Properties + +### initialVoiceCredits + +• `Optional` **initialVoiceCredits**: `number` + +The initial voice credits to be minted + +#### Defined in + +[utils/interfaces.ts:279](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L279) + +--- + +### initialVoiceCreditsProxyAddress + +• `Optional` **initialVoiceCreditsProxyAddress**: `string` + +The address of the initialVoiceCreditsProxy contract + +#### Defined in + +[utils/interfaces.ts:284](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L284) + +--- + +### poseidonT3Address + +• `Optional` **poseidonT3Address**: `string` + +The address of the PoseidonT3 contract + +#### Defined in + +[utils/interfaces.ts:294](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L294) + +--- + +### poseidonT4Address + +• `Optional` **poseidonT4Address**: `string` + +The address of the PoseidonT4 contract + +#### Defined in + +[utils/interfaces.ts:299](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L299) + +--- + +### poseidonT5Address + +• `Optional` **poseidonT5Address**: `string` + +The address of the PoseidonT5 contract + +#### Defined in + +[utils/interfaces.ts:304](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L304) + +--- + +### poseidonT6Address + +• `Optional` **poseidonT6Address**: `string` + +The address of the PoseidonT6 contract + +#### Defined in + +[utils/interfaces.ts:309](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L309) + +--- + +### quiet + +• `Optional` **quiet**: `boolean` + +Whether to log the output + +#### Defined in + +[utils/interfaces.ts:314](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L314) + +--- + +### signer + +• **signer**: `Signer` + +A signer object + +#### Defined in + +[utils/interfaces.ts:274](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L274) + +--- + +### signupGatekeeperAddress + +• `Optional` **signupGatekeeperAddress**: `string` + +The address of the signupGatekeeper contract + +#### Defined in + +[utils/interfaces.ts:289](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L289) + +--- + +### stateTreeDepth + +• **stateTreeDepth**: `number` + +The depth of the state tree + +#### Defined in + +[utils/interfaces.ts:269](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L269) + +--- + +### useQv + +• `Optional` **useQv**: `boolean` + +Whether to use quadratic voting or not + +#### Defined in + +[utils/interfaces.ts:319](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L319) diff --git a/website/versioned_docs/version-v1.2/typedoc/cli/interfaces/DeployPollArgs.md b/website/versioned_docs/version-v1.2/typedoc/cli/interfaces/DeployPollArgs.md new file mode 100644 index 0000000000..9be8068ee8 --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/cli/interfaces/DeployPollArgs.md @@ -0,0 +1,154 @@ +--- +title: DeployPollArgs +sidebar_label: DeployPollArgs +--- + +Interface for the arguments to the deployPoll command + +## Table of contents + +### Properties + +- [coordinatorPubkey](DeployPollArgs.md#coordinatorpubkey) +- [intStateTreeDepth](DeployPollArgs.md#intstatetreedepth) +- [maciAddress](DeployPollArgs.md#maciaddress) +- [messageTreeDepth](DeployPollArgs.md#messagetreedepth) +- [messageTreeSubDepth](DeployPollArgs.md#messagetreesubdepth) +- [pollDuration](DeployPollArgs.md#pollduration) +- [quiet](DeployPollArgs.md#quiet) +- [signer](DeployPollArgs.md#signer) +- [subsidyEnabled](DeployPollArgs.md#subsidyenabled) +- [vkRegistryAddress](DeployPollArgs.md#vkregistryaddress) +- [voteOptionTreeDepth](DeployPollArgs.md#voteoptiontreedepth) + +## Properties + +### coordinatorPubkey + +• **coordinatorPubkey**: `string` + +The coordinator's public key + +#### Defined in + +[utils/interfaces.ts:354](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L354) + +--- + +### intStateTreeDepth + +• **intStateTreeDepth**: `number` + +The depth of the intermediate state tree + +#### Defined in + +[utils/interfaces.ts:334](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L334) + +--- + +### maciAddress + +• `Optional` **maciAddress**: `string` + +The MACI contract address + +#### Defined in + +[utils/interfaces.ts:369](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L369) + +--- + +### messageTreeDepth + +• **messageTreeDepth**: `number` + +The depth of the message tree + +#### Defined in + +[utils/interfaces.ts:344](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L344) + +--- + +### messageTreeSubDepth + +• **messageTreeSubDepth**: `number` + +The depth of the message tree sublevels + +#### Defined in + +[utils/interfaces.ts:339](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L339) + +--- + +### pollDuration + +• **pollDuration**: `number` + +The duration of the poll in seconds + +#### Defined in + +[utils/interfaces.ts:329](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L329) + +--- + +### quiet + +• `Optional` **quiet**: `boolean` + +Whether to log the output to the console + +#### Defined in + +[utils/interfaces.ts:379](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L379) + +--- + +### signer + +• **signer**: `Signer` + +A signer object + +#### Defined in + +[utils/interfaces.ts:364](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L364) + +--- + +### subsidyEnabled + +• **subsidyEnabled**: `boolean` + +Whether to deploy subsidy contract + +#### Defined in + +[utils/interfaces.ts:359](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L359) + +--- + +### vkRegistryAddress + +• `Optional` **vkRegistryAddress**: `string` + +The vkRegistry contract address + +#### Defined in + +[utils/interfaces.ts:374](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L374) + +--- + +### voteOptionTreeDepth + +• **voteOptionTreeDepth**: `number` + +The depth of the vote option tree + +#### Defined in + +[utils/interfaces.ts:349](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L349) diff --git a/website/versioned_docs/version-v1.2/typedoc/cli/interfaces/DeployedContracts.md b/website/versioned_docs/version-v1.2/typedoc/cli/interfaces/DeployedContracts.md new file mode 100644 index 0000000000..c164c12ae5 --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/cli/interfaces/DeployedContracts.md @@ -0,0 +1,130 @@ +--- +title: DeployedContracts +sidebar_label: DeployedContracts +--- + +## Table of contents + +### Properties + +- [initialVoiceCreditProxyAddress](DeployedContracts.md#initialvoicecreditproxyaddress) +- [maciAddress](DeployedContracts.md#maciaddress) +- [pollFactoryAddress](DeployedContracts.md#pollfactoryaddress) +- [poseidonT3Address](DeployedContracts.md#poseidont3address) +- [poseidonT4Address](DeployedContracts.md#poseidont4address) +- [poseidonT5Address](DeployedContracts.md#poseidont5address) +- [poseidonT6Address](DeployedContracts.md#poseidont6address) +- [signUpGatekeeperAddress](DeployedContracts.md#signupgatekeeperaddress) +- [stateAqAddress](DeployedContracts.md#stateaqaddress) +- [topupCreditAddress](DeployedContracts.md#topupcreditaddress) +- [verifierAddress](DeployedContracts.md#verifieraddress) + +## Properties + +### initialVoiceCreditProxyAddress + +• **initialVoiceCreditProxyAddress**: `string` + +#### Defined in + +[utils/interfaces.ts:16](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L16) + +--- + +### maciAddress + +• **maciAddress**: `string` + +#### Defined in + +[utils/interfaces.ts:8](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L8) + +--- + +### pollFactoryAddress + +• **pollFactoryAddress**: `string` + +#### Defined in + +[utils/interfaces.ts:10](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L10) + +--- + +### poseidonT3Address + +• **poseidonT3Address**: `string` + +#### Defined in + +[utils/interfaces.ts:12](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L12) + +--- + +### poseidonT4Address + +• **poseidonT4Address**: `string` + +#### Defined in + +[utils/interfaces.ts:13](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L13) + +--- + +### poseidonT5Address + +• **poseidonT5Address**: `string` + +#### Defined in + +[utils/interfaces.ts:14](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L14) + +--- + +### poseidonT6Address + +• **poseidonT6Address**: `string` + +#### Defined in + +[utils/interfaces.ts:15](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L15) + +--- + +### signUpGatekeeperAddress + +• **signUpGatekeeperAddress**: `string` + +#### Defined in + +[utils/interfaces.ts:17](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L17) + +--- + +### stateAqAddress + +• **stateAqAddress**: `string` + +#### Defined in + +[utils/interfaces.ts:9](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L9) + +--- + +### topupCreditAddress + +• **topupCreditAddress**: `string` + +#### Defined in + +[utils/interfaces.ts:11](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L11) + +--- + +### verifierAddress + +• **verifierAddress**: `string` + +#### Defined in + +[utils/interfaces.ts:18](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L18) diff --git a/website/versioned_docs/version-v1.2/typedoc/cli/interfaces/GenLocalStateArgs.md b/website/versioned_docs/version-v1.2/typedoc/cli/interfaces/GenLocalStateArgs.md new file mode 100644 index 0000000000..0b80d71dfd --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/cli/interfaces/GenLocalStateArgs.md @@ -0,0 +1,168 @@ +--- +title: GenLocalStateArgs +sidebar_label: GenLocalStateArgs +--- + +Interface for the arguments to the genLocalState command +Generate a local MACI state from the smart contracts events + +## Table of contents + +### Properties + +- [blockPerBatch](GenLocalStateArgs.md#blockperbatch) +- [coordinatorPrivateKey](GenLocalStateArgs.md#coordinatorprivatekey) +- [endBlock](GenLocalStateArgs.md#endblock) +- [ethereumProvider](GenLocalStateArgs.md#ethereumprovider) +- [maciContractAddress](GenLocalStateArgs.md#macicontractaddress) +- [outputPath](GenLocalStateArgs.md#outputpath) +- [pollId](GenLocalStateArgs.md#pollid) +- [quiet](GenLocalStateArgs.md#quiet) +- [signer](GenLocalStateArgs.md#signer) +- [sleep](GenLocalStateArgs.md#sleep) +- [startBlock](GenLocalStateArgs.md#startblock) +- [transactionHash](GenLocalStateArgs.md#transactionhash) + +## Properties + +### blockPerBatch + +• `Optional` **blockPerBatch**: `number` + +The number of blocks to fetch per batch + +#### Defined in + +[utils/interfaces.ts:430](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L430) + +--- + +### coordinatorPrivateKey + +• `Optional` **coordinatorPrivateKey**: `string` + +The private key of the MACI coordinator + +#### Defined in + +[utils/interfaces.ts:410](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L410) + +--- + +### endBlock + +• `Optional` **endBlock**: `number` + +The end block number + +#### Defined in + +[utils/interfaces.ts:420](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L420) + +--- + +### ethereumProvider + +• `Optional` **ethereumProvider**: `string` + +The ethereum provider + +#### Defined in + +[utils/interfaces.ts:415](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L415) + +--- + +### maciContractAddress + +• `Optional` **maciContractAddress**: `string` + +The address of the MACI contract + +#### Defined in + +[utils/interfaces.ts:405](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L405) + +--- + +### outputPath + +• **outputPath**: `string` + +The path where to write the state + +#### Defined in + +[utils/interfaces.ts:390](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L390) + +--- + +### pollId + +• **pollId**: `bigint` + +The id of the poll + +#### Defined in + +[utils/interfaces.ts:395](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L395) + +--- + +### quiet + +• `Optional` **quiet**: `boolean` + +Whether to log the output + +#### Defined in + +[utils/interfaces.ts:445](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L445) + +--- + +### signer + +• **signer**: `Signer` + +A signer object + +#### Defined in + +[utils/interfaces.ts:400](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L400) + +--- + +### sleep + +• `Optional` **sleep**: `number` + +The sleep time between batches + +#### Defined in + +[utils/interfaces.ts:440](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L440) + +--- + +### startBlock + +• `Optional` **startBlock**: `number` + +The start block number + +#### Defined in + +[utils/interfaces.ts:425](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L425) + +--- + +### transactionHash + +• `Optional` **transactionHash**: `string` + +The transaction hash + +#### Defined in + +[utils/interfaces.ts:435](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L435) diff --git a/website/versioned_docs/version-v1.2/typedoc/cli/interfaces/GenProofsArgs.md b/website/versioned_docs/version-v1.2/typedoc/cli/interfaces/GenProofsArgs.md new file mode 100644 index 0000000000..1a5e1567f8 --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/cli/interfaces/GenProofsArgs.md @@ -0,0 +1,388 @@ +--- +title: GenProofsArgs +sidebar_label: GenProofsArgs +--- + +Interface for the arguments to the genProof command + +## Table of contents + +### Properties + +- [blocksPerBatch](GenProofsArgs.md#blocksperbatch) +- [coordinatorPrivKey](GenProofsArgs.md#coordinatorprivkey) +- [endBlock](GenProofsArgs.md#endblock) +- [maciAddress](GenProofsArgs.md#maciaddress) +- [outputDir](GenProofsArgs.md#outputdir) +- [pollId](GenProofsArgs.md#pollid) +- [processDatFile](GenProofsArgs.md#processdatfile) +- [processWasm](GenProofsArgs.md#processwasm) +- [processWitgen](GenProofsArgs.md#processwitgen) +- [processZkey](GenProofsArgs.md#processzkey) +- [quiet](GenProofsArgs.md#quiet) +- [rapidsnark](GenProofsArgs.md#rapidsnark) +- [signer](GenProofsArgs.md#signer) +- [startBlock](GenProofsArgs.md#startblock) +- [stateFile](GenProofsArgs.md#statefile) +- [subsidyDatFile](GenProofsArgs.md#subsidydatfile) +- [subsidyFile](GenProofsArgs.md#subsidyfile) +- [subsidyWasm](GenProofsArgs.md#subsidywasm) +- [subsidyWitgen](GenProofsArgs.md#subsidywitgen) +- [subsidyZkey](GenProofsArgs.md#subsidyzkey) +- [tallyAddress](GenProofsArgs.md#tallyaddress) +- [tallyDatFile](GenProofsArgs.md#tallydatfile) +- [tallyFile](GenProofsArgs.md#tallyfile) +- [tallyWasm](GenProofsArgs.md#tallywasm) +- [tallyWitgen](GenProofsArgs.md#tallywitgen) +- [tallyZkey](GenProofsArgs.md#tallyzkey) +- [transactionHash](GenProofsArgs.md#transactionhash) +- [useQuadraticVoting](GenProofsArgs.md#usequadraticvoting) +- [useWasm](GenProofsArgs.md#usewasm) + +## Properties + +### blocksPerBatch + +• `Optional` **blocksPerBatch**: `number` + +The number of blocks to fetch logs from + +#### Defined in + +[utils/interfaces.ts:575](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L575) + +--- + +### coordinatorPrivKey + +• `Optional` **coordinatorPrivKey**: `string` + +The coordinator's private key + +#### Defined in + +[utils/interfaces.ts:530](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L530) + +--- + +### endBlock + +• `Optional` **endBlock**: `number` + +The block number to stop fetching logs from + +#### Defined in + +[utils/interfaces.ts:580](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L580) + +--- + +### maciAddress + +• `Optional` **maciAddress**: `string` + +The address of the MACI contract + +#### Defined in + +[utils/interfaces.ts:535](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L535) + +--- + +### outputDir + +• **outputDir**: `string` + +The directory to store the proofs + +#### Defined in + +[utils/interfaces.ts:455](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L455) + +--- + +### pollId + +• **pollId**: `bigint` + +The id of the poll + +#### Defined in + +[utils/interfaces.ts:475](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L475) + +--- + +### processDatFile + +• `Optional` **processDatFile**: `string` + +The path to the process dat file + +#### Defined in + +[utils/interfaces.ts:505](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L505) + +--- + +### processWasm + +• `Optional` **processWasm**: `string` + +The path to the process wasm file + +#### Defined in + +[utils/interfaces.ts:545](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L545) + +--- + +### processWitgen + +• `Optional` **processWitgen**: `string` + +The path to the process witnessgen binary + +#### Defined in + +[utils/interfaces.ts:500](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L500) + +--- + +### processZkey + +• **processZkey**: `string` + +The path to the process zkey file + +#### Defined in + +[utils/interfaces.ts:470](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L470) + +--- + +### quiet + +• `Optional` **quiet**: `boolean` + +Whether to log the output + +#### Defined in + +[utils/interfaces.ts:585](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L585) + +--- + +### rapidsnark + +• `Optional` **rapidsnark**: `string` + +The path to the rapidsnark binary + +#### Defined in + +[utils/interfaces.ts:495](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L495) + +--- + +### signer + +• **signer**: `Signer` + +A signer object + +#### Defined in + +[utils/interfaces.ts:480](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L480) + +--- + +### startBlock + +• `Optional` **startBlock**: `number` + +The block number to start fetching logs from + +#### Defined in + +[utils/interfaces.ts:570](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L570) + +--- + +### stateFile + +• `Optional` **stateFile**: `string` + +The file with the serialized maci state + +#### Defined in + +[utils/interfaces.ts:565](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L565) + +--- + +### subsidyDatFile + +• `Optional` **subsidyDatFile**: `string` + +The path to the subsidy dat file + +#### Defined in + +[utils/interfaces.ts:525](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L525) + +--- + +### subsidyFile + +• `Optional` **subsidyFile**: `string` + +The file to store the subsidy proof + +#### Defined in + +[utils/interfaces.ts:485](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L485) + +--- + +### subsidyWasm + +• `Optional` **subsidyWasm**: `string` + +The path to the subsidy wasm file + +#### Defined in + +[utils/interfaces.ts:555](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L555) + +--- + +### subsidyWitgen + +• `Optional` **subsidyWitgen**: `string` + +The path to the subsidy witnessgen binary + +#### Defined in + +[utils/interfaces.ts:520](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L520) + +--- + +### subsidyZkey + +• `Optional` **subsidyZkey**: `string` + +The path to the subsidy zkey file + +#### Defined in + +[utils/interfaces.ts:490](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L490) + +--- + +### tallyAddress + +• `Optional` **tallyAddress**: `string` + +The address of the Tally contract + +#### Defined in + +[utils/interfaces.ts:595](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L595) + +--- + +### tallyDatFile + +• `Optional` **tallyDatFile**: `string` + +The path to the tally dat file + +#### Defined in + +[utils/interfaces.ts:515](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L515) + +--- + +### tallyFile + +• **tallyFile**: `string` + +The file to store the tally proof + +#### Defined in + +[utils/interfaces.ts:460](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L460) + +--- + +### tallyWasm + +• `Optional` **tallyWasm**: `string` + +The path to the tally wasm file + +#### Defined in + +[utils/interfaces.ts:550](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L550) + +--- + +### tallyWitgen + +• `Optional` **tallyWitgen**: `string` + +The path to the tally witnessgen binary + +#### Defined in + +[utils/interfaces.ts:510](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L510) + +--- + +### tallyZkey + +• **tallyZkey**: `string` + +The path to the tally zkey file + +#### Defined in + +[utils/interfaces.ts:465](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L465) + +--- + +### transactionHash + +• `Optional` **transactionHash**: `string` + +The transaction hash of the first transaction + +#### Defined in + +[utils/interfaces.ts:540](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L540) + +--- + +### useQuadraticVoting + +• `Optional` **useQuadraticVoting**: `boolean` + +Whether to use quadratic voting or not + +#### Defined in + +[utils/interfaces.ts:590](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L590) + +--- + +### useWasm + +• `Optional` **useWasm**: `boolean` + +Whether to use wasm or rapidsnark + +#### Defined in + +[utils/interfaces.ts:560](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L560) diff --git a/website/versioned_docs/version-v1.2/typedoc/cli/interfaces/IGenKeypairArgs.md b/website/versioned_docs/version-v1.2/typedoc/cli/interfaces/IGenKeypairArgs.md new file mode 100644 index 0000000000..09ad13d146 --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/cli/interfaces/IGenKeypairArgs.md @@ -0,0 +1,37 @@ +--- +title: IGenKeypairArgs +sidebar_label: IGenKeypairArgs +--- + +Interface for the arguments for generate keypair command + +## Table of contents + +### Properties + +- [quiet](IGenKeypairArgs.md#quiet) +- [seed](IGenKeypairArgs.md#seed) + +## Properties + +### quiet + +• `Optional` **quiet**: `boolean` + +Whether to log the output + +#### Defined in + +[utils/interfaces.ts:1060](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L1060) + +--- + +### seed + +• `Optional` **seed**: `bigint` + +Seed value for keypair + +#### Defined in + +[utils/interfaces.ts:1055](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L1055) diff --git a/website/versioned_docs/version-v1.2/typedoc/cli/interfaces/IRegisteredUserArgs.md b/website/versioned_docs/version-v1.2/typedoc/cli/interfaces/IRegisteredUserArgs.md new file mode 100644 index 0000000000..5023ed2fa5 --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/cli/interfaces/IRegisteredUserArgs.md @@ -0,0 +1,63 @@ +--- +title: IRegisteredUserArgs +sidebar_label: IRegisteredUserArgs +--- + +Interface for the arguments to the register check command + +## Table of contents + +### Properties + +- [maciAddress](IRegisteredUserArgs.md#maciaddress) +- [maciPubKey](IRegisteredUserArgs.md#macipubkey) +- [quiet](IRegisteredUserArgs.md#quiet) +- [signer](IRegisteredUserArgs.md#signer) + +## Properties + +### maciAddress + +• **maciAddress**: `string` + +The address of the MACI contract + +#### Defined in + +[utils/interfaces.ts:895](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L895) + +--- + +### maciPubKey + +• **maciPubKey**: `string` + +The public key of the user + +#### Defined in + +[utils/interfaces.ts:890](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L890) + +--- + +### quiet + +• `Optional` **quiet**: `boolean` + +Whether to log the output + +#### Defined in + +[utils/interfaces.ts:900](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L900) + +--- + +### signer + +• **signer**: `Signer` + +A signer object + +#### Defined in + +[utils/interfaces.ts:885](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L885) diff --git a/website/versioned_docs/version-v1.2/typedoc/cli/interfaces/MergeMessagesArgs.md b/website/versioned_docs/version-v1.2/typedoc/cli/interfaces/MergeMessagesArgs.md new file mode 100644 index 0000000000..4e3e71594c --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/cli/interfaces/MergeMessagesArgs.md @@ -0,0 +1,76 @@ +--- +title: MergeMessagesArgs +sidebar_label: MergeMessagesArgs +--- + +Interface for the arguments to the mergeMessages command + +## Table of contents + +### Properties + +- [maciContractAddress](MergeMessagesArgs.md#macicontractaddress) +- [numQueueOps](MergeMessagesArgs.md#numqueueops) +- [pollId](MergeMessagesArgs.md#pollid) +- [quiet](MergeMessagesArgs.md#quiet) +- [signer](MergeMessagesArgs.md#signer) + +## Properties + +### maciContractAddress + +• `Optional` **maciContractAddress**: `string` + +The address of the MACI contract + +#### Defined in + +[utils/interfaces.ts:620](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L620) + +--- + +### numQueueOps + +• `Optional` **numQueueOps**: `string` + +The number of queue operations to merge + +#### Defined in + +[utils/interfaces.ts:625](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L625) + +--- + +### pollId + +• **pollId**: `bigint` + +The id of the poll + +#### Defined in + +[utils/interfaces.ts:605](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L605) + +--- + +### quiet + +• `Optional` **quiet**: `boolean` + +Whether to log the output + +#### Defined in + +[utils/interfaces.ts:615](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L615) + +--- + +### signer + +• **signer**: `Signer` + +A signer object + +#### Defined in + +[utils/interfaces.ts:610](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L610) diff --git a/website/versioned_docs/version-v1.2/typedoc/cli/interfaces/MergeSignupsArgs.md b/website/versioned_docs/version-v1.2/typedoc/cli/interfaces/MergeSignupsArgs.md new file mode 100644 index 0000000000..9486bb1f00 --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/cli/interfaces/MergeSignupsArgs.md @@ -0,0 +1,76 @@ +--- +title: MergeSignupsArgs +sidebar_label: MergeSignupsArgs +--- + +Interface for the arguments to the mergeSignups command + +## Table of contents + +### Properties + +- [maciContractAddress](MergeSignupsArgs.md#macicontractaddress) +- [numQueueOps](MergeSignupsArgs.md#numqueueops) +- [pollId](MergeSignupsArgs.md#pollid) +- [quiet](MergeSignupsArgs.md#quiet) +- [signer](MergeSignupsArgs.md#signer) + +## Properties + +### maciContractAddress + +• `Optional` **maciContractAddress**: `string` + +The address of the MACI contract + +#### Defined in + +[utils/interfaces.ts:645](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L645) + +--- + +### numQueueOps + +• `Optional` **numQueueOps**: `string` + +The number of queue operations to perform + +#### Defined in + +[utils/interfaces.ts:650](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L650) + +--- + +### pollId + +• **pollId**: `bigint` + +The id of the poll + +#### Defined in + +[utils/interfaces.ts:635](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L635) + +--- + +### quiet + +• `Optional` **quiet**: `boolean` + +Whether to log the output + +#### Defined in + +[utils/interfaces.ts:655](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L655) + +--- + +### signer + +• **signer**: `Signer` + +A signer object + +#### Defined in + +[utils/interfaces.ts:640](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L640) diff --git a/website/versioned_docs/version-v1.2/typedoc/cli/interfaces/PollContracts.md b/website/versioned_docs/version-v1.2/typedoc/cli/interfaces/PollContracts.md new file mode 100644 index 0000000000..13776d493b --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/cli/interfaces/PollContracts.md @@ -0,0 +1,53 @@ +--- +title: PollContracts +sidebar_label: PollContracts +--- + +## Table of contents + +### Properties + +- [messageProcessor](PollContracts.md#messageprocessor) +- [poll](PollContracts.md#poll) +- [subsidy](PollContracts.md#subsidy) +- [tally](PollContracts.md#tally) + +## Properties + +### messageProcessor + +• **messageProcessor**: `string` + +#### Defined in + +[utils/interfaces.ts:23](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L23) + +--- + +### poll + +• **poll**: `string` + +#### Defined in + +[utils/interfaces.ts:22](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L22) + +--- + +### subsidy + +• `Optional` **subsidy**: `string` + +#### Defined in + +[utils/interfaces.ts:25](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L25) + +--- + +### tally + +• **tally**: `string` + +#### Defined in + +[utils/interfaces.ts:24](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L24) diff --git a/website/versioned_docs/version-v1.2/typedoc/cli/interfaces/ProveOnChainArgs.md b/website/versioned_docs/version-v1.2/typedoc/cli/interfaces/ProveOnChainArgs.md new file mode 100644 index 0000000000..d85794bd27 --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/cli/interfaces/ProveOnChainArgs.md @@ -0,0 +1,128 @@ +--- +title: ProveOnChainArgs +sidebar_label: ProveOnChainArgs +--- + +Interface for the arguments to the ProveOnChainArgs command + +## Table of contents + +### Properties + +- [maciAddress](ProveOnChainArgs.md#maciaddress) +- [messageProcessorAddress](ProveOnChainArgs.md#messageprocessoraddress) +- [pollId](ProveOnChainArgs.md#pollid) +- [proofDir](ProveOnChainArgs.md#proofdir) +- [quiet](ProveOnChainArgs.md#quiet) +- [signer](ProveOnChainArgs.md#signer) +- [subsidyAddress](ProveOnChainArgs.md#subsidyaddress) +- [subsidyEnabled](ProveOnChainArgs.md#subsidyenabled) +- [tallyAddress](ProveOnChainArgs.md#tallyaddress) + +## Properties + +### maciAddress + +• `Optional` **maciAddress**: `string` + +The address of the MACI contract + +#### Defined in + +[utils/interfaces.ts:685](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L685) + +--- + +### messageProcessorAddress + +• `Optional` **messageProcessorAddress**: `string` + +The address of the MessageProcessor contract + +#### Defined in + +[utils/interfaces.ts:690](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L690) + +--- + +### pollId + +• **pollId**: `bigint` + +The id of the poll + +#### Defined in + +[utils/interfaces.ts:665](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L665) + +--- + +### proofDir + +• **proofDir**: `string` + +The directory containing the proofs + +#### Defined in + +[utils/interfaces.ts:670](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L670) + +--- + +### quiet + +• `Optional` **quiet**: `boolean` + +Whether to log the output + +#### Defined in + +[utils/interfaces.ts:705](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L705) + +--- + +### signer + +• **signer**: `Signer` + +A signer object + +#### Defined in + +[utils/interfaces.ts:680](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L680) + +--- + +### subsidyAddress + +• `Optional` **subsidyAddress**: `string` + +The address of the Subsidy contract + +#### Defined in + +[utils/interfaces.ts:700](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L700) + +--- + +### subsidyEnabled + +• **subsidyEnabled**: `boolean` + +Whether to deploy subsidy contract + +#### Defined in + +[utils/interfaces.ts:675](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L675) + +--- + +### tallyAddress + +• `Optional` **tallyAddress**: `string` + +The address of the Tally contract + +#### Defined in + +[utils/interfaces.ts:695](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L695) diff --git a/website/versioned_docs/version-v1.2/typedoc/cli/interfaces/PublishArgs.md b/website/versioned_docs/version-v1.2/typedoc/cli/interfaces/PublishArgs.md new file mode 100644 index 0000000000..14189fa71f --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/cli/interfaces/PublishArgs.md @@ -0,0 +1,154 @@ +--- +title: PublishArgs +sidebar_label: PublishArgs +--- + +Interface for the arguments to the publish command + +## Table of contents + +### Properties + +- [maciContractAddress](PublishArgs.md#macicontractaddress) +- [newVoteWeight](PublishArgs.md#newvoteweight) +- [nonce](PublishArgs.md#nonce) +- [pollId](PublishArgs.md#pollid) +- [privateKey](PublishArgs.md#privatekey) +- [pubkey](PublishArgs.md#pubkey) +- [quiet](PublishArgs.md#quiet) +- [salt](PublishArgs.md#salt) +- [signer](PublishArgs.md#signer) +- [stateIndex](PublishArgs.md#stateindex) +- [voteOptionIndex](PublishArgs.md#voteoptionindex) + +## Properties + +### maciContractAddress + +• **maciContractAddress**: `string` + +The address of the MACI contract + +#### Defined in + +[utils/interfaces.ts:750](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L750) + +--- + +### newVoteWeight + +• **newVoteWeight**: `bigint` + +The new vote weight + +#### Defined in + +[utils/interfaces.ts:740](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L740) + +--- + +### nonce + +• **nonce**: `bigint` + +The nonce of the message + +#### Defined in + +[utils/interfaces.ts:730](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L730) + +--- + +### pollId + +• **pollId**: `bigint` + +The id of the poll + +#### Defined in + +[utils/interfaces.ts:735](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L735) + +--- + +### privateKey + +• **privateKey**: `string` + +The private key of the user + +#### Defined in + +[utils/interfaces.ts:755](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L755) + +--- + +### pubkey + +• **pubkey**: `string` + +The public key of the user + +#### Defined in + +[utils/interfaces.ts:715](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L715) + +--- + +### quiet + +• `Optional` **quiet**: `boolean` + +Whether to log the output + +#### Defined in + +[utils/interfaces.ts:765](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L765) + +--- + +### salt + +• `Optional` **salt**: `bigint` + +The salt of the message + +#### Defined in + +[utils/interfaces.ts:760](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L760) + +--- + +### signer + +• **signer**: `Signer` + +A signer object + +#### Defined in + +[utils/interfaces.ts:745](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L745) + +--- + +### stateIndex + +• **stateIndex**: `bigint` + +The index of the state leaf + +#### Defined in + +[utils/interfaces.ts:720](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L720) + +--- + +### voteOptionIndex + +• **voteOptionIndex**: `bigint` + +The index of the vote option + +#### Defined in + +[utils/interfaces.ts:725](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L725) diff --git a/website/versioned_docs/version-v1.2/typedoc/cli/interfaces/SignupArgs.md b/website/versioned_docs/version-v1.2/typedoc/cli/interfaces/SignupArgs.md new file mode 100644 index 0000000000..5af546049b --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/cli/interfaces/SignupArgs.md @@ -0,0 +1,89 @@ +--- +title: SignupArgs +sidebar_label: SignupArgs +--- + +Interface for the arguments to the signup command + +## Table of contents + +### Properties + +- [ivcpDataArg](SignupArgs.md#ivcpdataarg) +- [maciAddress](SignupArgs.md#maciaddress) +- [maciPubKey](SignupArgs.md#macipubkey) +- [quiet](SignupArgs.md#quiet) +- [sgDataArg](SignupArgs.md#sgdataarg) +- [signer](SignupArgs.md#signer) + +## Properties + +### ivcpDataArg + +• `Optional` **ivcpDataArg**: `string` + +The initial voice credit proxy data + +#### Defined in + +[utils/interfaces.ts:855](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L855) + +--- + +### maciAddress + +• **maciAddress**: `string` + +The address of the MACI contract + +#### Defined in + +[utils/interfaces.ts:845](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L845) + +--- + +### maciPubKey + +• **maciPubKey**: `string` + +The public key of the user + +#### Defined in + +[utils/interfaces.ts:835](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L835) + +--- + +### quiet + +• `Optional` **quiet**: `boolean` + +Whether to log the output + +#### Defined in + +[utils/interfaces.ts:860](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L860) + +--- + +### sgDataArg + +• `Optional` **sgDataArg**: `string` + +The signup gateway data + +#### Defined in + +[utils/interfaces.ts:850](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L850) + +--- + +### signer + +• **signer**: `Signer` + +A signer object + +#### Defined in + +[utils/interfaces.ts:840](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L840) diff --git a/website/versioned_docs/version-v1.2/typedoc/cli/interfaces/SubsidyData.md b/website/versioned_docs/version-v1.2/typedoc/cli/interfaces/SubsidyData.md new file mode 100644 index 0000000000..79968f875e --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/cli/interfaces/SubsidyData.md @@ -0,0 +1,73 @@ +--- +title: SubsidyData +sidebar_label: SubsidyData +--- + +A util interface that represents a subsidy file + +## Table of contents + +### Properties + +- [maci](SubsidyData.md#maci) +- [newSubsidyCommitment](SubsidyData.md#newsubsidycommitment) +- [pollId](SubsidyData.md#pollid) +- [provider](SubsidyData.md#provider) +- [results](SubsidyData.md#results) + +## Properties + +### maci + +• **maci**: `string` + +#### Defined in + +[utils/interfaces.ts:134](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L134) + +--- + +### newSubsidyCommitment + +• **newSubsidyCommitment**: `string` + +#### Defined in + +[utils/interfaces.ts:136](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L136) + +--- + +### pollId + +• **pollId**: `bigint` + +#### Defined in + +[utils/interfaces.ts:135](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L135) + +--- + +### provider + +• **provider**: `string` + +#### Defined in + +[utils/interfaces.ts:133](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L133) + +--- + +### results + +• **results**: `Object` + +#### Type declaration + +| Name | Type | +| :-------- | :--------- | +| `salt` | `string` | +| `subsidy` | `string`[] | + +#### Defined in + +[utils/interfaces.ts:137](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L137) diff --git a/website/versioned_docs/version-v1.2/typedoc/cli/interfaces/TallyData.md b/website/versioned_docs/version-v1.2/typedoc/cli/interfaces/TallyData.md new file mode 100644 index 0000000000..fcf644b21c --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/cli/interfaces/TallyData.md @@ -0,0 +1,166 @@ +--- +title: TallyData +sidebar_label: TallyData +--- + +Interface for the tally file data. + +## Table of contents + +### Properties + +- [chainId](TallyData.md#chainid) +- [isQuadratic](TallyData.md#isquadratic) +- [maci](TallyData.md#maci) +- [network](TallyData.md#network) +- [newTallyCommitment](TallyData.md#newtallycommitment) +- [perVOSpentVoiceCredits](TallyData.md#pervospentvoicecredits) +- [pollId](TallyData.md#pollid) +- [results](TallyData.md#results) +- [tallyAddress](TallyData.md#tallyaddress) +- [totalSpentVoiceCredits](TallyData.md#totalspentvoicecredits) + +## Properties + +### chainId + +• `Optional` **chainId**: `string` + +The chain ID for which these proofs are valid for + +#### Defined in + +[utils/interfaces.ts:51](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L51) + +--- + +### isQuadratic + +• **isQuadratic**: `boolean` + +Whether the poll is using quadratic voting or not. + +#### Defined in + +[utils/interfaces.ts:56](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L56) + +--- + +### maci + +• **maci**: `string` + +The MACI address. + +#### Defined in + +[utils/interfaces.ts:35](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L35) + +--- + +### network + +• `Optional` **network**: `string` + +The name of the network for which these proofs +are valid for + +#### Defined in + +[utils/interfaces.ts:46](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L46) + +--- + +### newTallyCommitment + +• **newTallyCommitment**: `string` + +The new tally commitment. + +#### Defined in + +[utils/interfaces.ts:66](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L66) + +--- + +### perVOSpentVoiceCredits + +• `Optional` **perVOSpentVoiceCredits**: `Object` + +The per VO spent voice credits. + +#### Type declaration + +| Name | Type | Description | +| :----------- | :--------- | :------------------------------------------------ | +| `commitment` | `string` | The commitment of the per VO spent voice credits. | +| `salt` | `string` | The salt of the per VO spent voice credits. | +| `tally` | `string`[] | The tally of the per VO spent voice credits. | + +#### Defined in + +[utils/interfaces.ts:111](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L111) + +--- + +### pollId + +• **pollId**: `string` + +The ID of the poll. + +#### Defined in + +[utils/interfaces.ts:40](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L40) + +--- + +### results + +• **results**: `Object` + +The results of the poll. + +#### Type declaration + +| Name | Type | Description | +| :----------- | :--------- | :----------------------------- | +| `commitment` | `string` | The commitment of the results. | +| `salt` | `string` | The salt of the results. | +| `tally` | `string`[] | The tally of the results. | + +#### Defined in + +[utils/interfaces.ts:71](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L71) + +--- + +### tallyAddress + +• **tallyAddress**: `string` + +The address of the Tally contract. + +#### Defined in + +[utils/interfaces.ts:61](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L61) + +--- + +### totalSpentVoiceCredits + +• **totalSpentVoiceCredits**: `Object` + +The total spent voice credits. + +#### Type declaration + +| Name | Type | Description | +| :----------- | :------- | :----------------------------------------- | +| `commitment` | `string` | The commitment of the spent voice credits. | +| `salt` | `string` | The salt of the spent voice credits. | +| `spent` | `string` | The spent voice credits. | + +#### Defined in + +[utils/interfaces.ts:91](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L91) diff --git a/website/versioned_docs/version-v1.2/typedoc/cli/interfaces/TopupArgs.md b/website/versioned_docs/version-v1.2/typedoc/cli/interfaces/TopupArgs.md new file mode 100644 index 0000000000..61aeebb114 --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/cli/interfaces/TopupArgs.md @@ -0,0 +1,89 @@ +--- +title: TopupArgs +sidebar_label: TopupArgs +--- + +Interface for the arguments to the topup command + +## Table of contents + +### Properties + +- [amount](TopupArgs.md#amount) +- [maciAddress](TopupArgs.md#maciaddress) +- [pollId](TopupArgs.md#pollid) +- [quiet](TopupArgs.md#quiet) +- [signer](TopupArgs.md#signer) +- [stateIndex](TopupArgs.md#stateindex) + +## Properties + +### amount + +• **amount**: `number` + +The amount to topup + +#### Defined in + +[utils/interfaces.ts:970](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L970) + +--- + +### maciAddress + +• `Optional` **maciAddress**: `string` + +The address of the MACI contract + +#### Defined in + +[utils/interfaces.ts:985](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L985) + +--- + +### pollId + +• **pollId**: `bigint` + +The poll ID + +#### Defined in + +[utils/interfaces.ts:980](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L980) + +--- + +### quiet + +• `Optional` **quiet**: `boolean` + +Whether to log the output + +#### Defined in + +[utils/interfaces.ts:995](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L995) + +--- + +### signer + +• **signer**: `Signer` + +A signer object + +#### Defined in + +[utils/interfaces.ts:990](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L990) + +--- + +### stateIndex + +• **stateIndex**: `number` + +The state index of the user + +#### Defined in + +[utils/interfaces.ts:975](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L975) diff --git a/website/versioned_docs/version-v1.2/typedoc/cli/interfaces/VerifyArgs.md b/website/versioned_docs/version-v1.2/typedoc/cli/interfaces/VerifyArgs.md new file mode 100644 index 0000000000..7d5fd27720 --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/cli/interfaces/VerifyArgs.md @@ -0,0 +1,128 @@ +--- +title: VerifyArgs +sidebar_label: VerifyArgs +--- + +Interface for the arguments to the verifyProof command + +## Table of contents + +### Properties + +- [maciAddress](VerifyArgs.md#maciaddress) +- [pollId](VerifyArgs.md#pollid) +- [quiet](VerifyArgs.md#quiet) +- [signer](VerifyArgs.md#signer) +- [subsidyAddress](VerifyArgs.md#subsidyaddress) +- [subsidyData](VerifyArgs.md#subsidydata) +- [subsidyEnabled](VerifyArgs.md#subsidyenabled) +- [tallyAddress](VerifyArgs.md#tallyaddress) +- [tallyData](VerifyArgs.md#tallydata) + +## Properties + +### maciAddress + +• **maciAddress**: `string` + +The address of the MACI contract + +#### Defined in + +[utils/interfaces.ts:1025](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L1025) + +--- + +### pollId + +• **pollId**: `bigint` + +The id of the poll + +#### Defined in + +[utils/interfaces.ts:1005](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L1005) + +--- + +### quiet + +• `Optional` **quiet**: `boolean` + +Whether to log the output + +#### Defined in + +[utils/interfaces.ts:1045](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L1045) + +--- + +### signer + +• **signer**: `Signer` + +A signer object + +#### Defined in + +[utils/interfaces.ts:1015](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L1015) + +--- + +### subsidyAddress + +• `Optional` **subsidyAddress**: `string` + +The address of the Subsidy contract + +#### Defined in + +[utils/interfaces.ts:1035](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L1035) + +--- + +### subsidyData + +• `Optional` **subsidyData**: [`SubsidyData`](SubsidyData.md) + +The subsidy data + +#### Defined in + +[utils/interfaces.ts:1040](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L1040) + +--- + +### subsidyEnabled + +• **subsidyEnabled**: `boolean` + +Whether to deploy subsidy contract + +#### Defined in + +[utils/interfaces.ts:1010](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L1010) + +--- + +### tallyAddress + +• **tallyAddress**: `string` + +The address of the Tally contract + +#### Defined in + +[utils/interfaces.ts:1030](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L1030) + +--- + +### tallyData + +• **tallyData**: [`TallyData`](TallyData.md) + +The tally data + +#### Defined in + +[utils/interfaces.ts:1020](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/utils/interfaces.ts#L1020) diff --git a/website/versioned_docs/version-v1.2/typedoc/cli/modules.md b/website/versioned_docs/version-v1.2/typedoc/cli/modules.md new file mode 100644 index 0000000000..68c8a03fea --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/cli/modules.md @@ -0,0 +1,556 @@ +--- +title: Cli Module +sidebar_label: module +sidebar_position: 1 +--- + +## Table of contents + +### Interfaces + +- [AirdropArgs](interfaces/AirdropArgs.md) +- [DeployArgs](interfaces/DeployArgs.md) +- [DeployPollArgs](interfaces/DeployPollArgs.md) +- [DeployedContracts](interfaces/DeployedContracts.md) +- [GenLocalStateArgs](interfaces/GenLocalStateArgs.md) +- [GenProofsArgs](interfaces/GenProofsArgs.md) +- [IGenKeypairArgs](interfaces/IGenKeypairArgs.md) +- [IRegisteredUserArgs](interfaces/IRegisteredUserArgs.md) +- [MergeMessagesArgs](interfaces/MergeMessagesArgs.md) +- [MergeSignupsArgs](interfaces/MergeSignupsArgs.md) +- [PollContracts](interfaces/PollContracts.md) +- [ProveOnChainArgs](interfaces/ProveOnChainArgs.md) +- [PublishArgs](interfaces/PublishArgs.md) +- [SignupArgs](interfaces/SignupArgs.md) +- [SubsidyData](interfaces/SubsidyData.md) +- [TallyData](interfaces/TallyData.md) +- [TopupArgs](interfaces/TopupArgs.md) +- [VerifyArgs](interfaces/VerifyArgs.md) + +### Functions + +- [airdrop](modules.md#airdrop) +- [checkVerifyingKeys](modules.md#checkverifyingkeys) +- [deploy](modules.md#deploy) +- [deployPoll](modules.md#deploypoll) +- [deployVkRegistryContract](modules.md#deployvkregistrycontract) +- [fundWallet](modules.md#fundwallet) +- [genKeyPair](modules.md#genkeypair) +- [genLocalState](modules.md#genlocalstate) +- [genMaciPubKey](modules.md#genmacipubkey) +- [genProofs](modules.md#genproofs) +- [getPoll](modules.md#getpoll) +- [isRegisteredUser](modules.md#isregistereduser) +- [mergeMessages](modules.md#mergemessages) +- [mergeSignups](modules.md#mergesignups) +- [proveOnChain](modules.md#proveonchain) +- [publish](modules.md#publish) +- [setVerifyingKeys](modules.md#setverifyingkeys) +- [signup](modules.md#signup) +- [timeTravel](modules.md#timetravel) +- [topup](modules.md#topup) +- [verify](modules.md#verify) + +## Functions + +### airdrop + +▸ **airdrop**(`AirdropArgs`): `Promise`\<`void`\> + +Utility that can be used to get +topup credits airdropped +to the coordinator + +#### Parameters + +| Name | Type | Description | +| :------------ | :----------------------------------------- | :------------------------------------ | +| `AirdropArgs` | [`AirdropArgs`](interfaces/AirdropArgs.md) | The arguments for the airdrop command | + +#### Returns + +`Promise`\<`void`\> + +#### Defined in + +[commands/airdrop.ts:11](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/commands/airdrop.ts#L11) + +--- + +### checkVerifyingKeys + +▸ **checkVerifyingKeys**(`CheckVerifyingKeysArgs`): `Promise`\<`boolean`\> + +Command to confirm that the verifying keys in the contract match the +local ones + +#### Parameters + +| Name | Type | Description | +| :----------------------- | :----------------------- | :----------------------------------------------- | +| `CheckVerifyingKeysArgs` | `CheckVerifyingKeysArgs` | The arguments for the checkVerifyingKeys command | + +#### Returns + +`Promise`\<`boolean`\> + +Whether the verifying keys match or not + +**`Note`** + +see different options for zkey files to use specific circuits https://maci.pse.dev/docs/trusted-setup, https://maci.pse.dev/docs/testing/#pre-compiled-artifacts-for-testing + +#### Defined in + +[commands/checkVerifyingKeys.ts:28](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/commands/checkVerifyingKeys.ts#L28) + +--- + +### deploy + +▸ **deploy**(`DeployArgs`): `Promise`\<[`DeployedContracts`](interfaces/DeployedContracts.md)\> + +Deploy MACI and related contracts + +#### Parameters + +| Name | Type | Description | +| :----------- | :--------------------------------------- | :----------------------------------- | +| `DeployArgs` | [`DeployArgs`](interfaces/DeployArgs.md) | The arguments for the deploy command | + +#### Returns + +`Promise`\<[`DeployedContracts`](interfaces/DeployedContracts.md)\> + +The addresses of the deployed contracts + +#### Defined in + +[commands/deploy.ts:26](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/commands/deploy.ts#L26) + +--- + +### deployPoll + +▸ **deployPoll**(`DeployPollArgs`): `Promise`\<[`PollContracts`](interfaces/PollContracts.md)\> + +Deploy a new Poll for the set of MACI's contracts already deployed + +#### Parameters + +| Name | Type | Description | +| :--------------- | :----------------------------------------------- | :--------------------------------------- | +| `DeployPollArgs` | [`DeployPollArgs`](interfaces/DeployPollArgs.md) | The arguments for the deployPoll command | + +#### Returns + +`Promise`\<[`PollContracts`](interfaces/PollContracts.md)\> + +The addresses of the deployed contracts + +#### Defined in + +[commands/deployPoll.ts:21](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/commands/deployPoll.ts#L21) + +--- + +### deployVkRegistryContract + +▸ **deployVkRegistryContract**(`quiet`): `Promise`\<`string`\> + +Deploy the vkRegistry contract + +#### Parameters + +| Name | Type | Description | +| :------ | :--------------------- | :------------------------------------ | +| `quiet` | `DeployVkRegistryArgs` | whether to print the contract address | + +#### Returns + +`Promise`\<`string`\> + +#### Defined in + +[commands/deployVkRegistry.ts:20](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/commands/deployVkRegistry.ts#L20) + +--- + +### fundWallet + +▸ **fundWallet**(`«destructured»`): `Promise`\<`void`\> + +Fund a new wallet with Ether + +#### Parameters + +| Name | Type | +| :--------------- | :--------------- | +| `«destructured»` | `FundWalletArgs` | + +#### Returns + +`Promise`\<`void`\> + +#### Defined in + +[commands/fundWallet.ts:9](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/commands/fundWallet.ts#L9) + +--- + +### genKeyPair + +▸ **genKeyPair**(`args`): `Object` + +Generate a new Maci Key Pair +and print it to the screen + +#### Parameters + +| Name | Type | Description | +| :----- | :------------------------------------------------- | :------------------------ | +| `args` | [`IGenKeypairArgs`](interfaces/IGenKeypairArgs.md) | keypair generation params | + +#### Returns + +`Object` + +- keypair + +| Name | Type | +| :----------- | :------- | +| `privateKey` | `string` | +| `publicKey` | `string` | + +#### Defined in + +[commands/genKeyPair.ts:15](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/commands/genKeyPair.ts#L15) + +--- + +### genLocalState + +▸ **genLocalState**(`GenLocalStateArgs`): `Promise`\<`void`\> + +Generate a local MACI state from the smart contracts events + +#### Parameters + +| Name | Type | Description | +| :------------------ | :----------------------------------------------------- | :------------------------------------------ | +| `GenLocalStateArgs` | [`GenLocalStateArgs`](interfaces/GenLocalStateArgs.md) | The arguments for the genLocalState command | + +#### Returns + +`Promise`\<`void`\> + +#### Defined in + +[commands/genLocalState.ts:24](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/commands/genLocalState.ts#L24) + +--- + +### genMaciPubKey + +▸ **genMaciPubKey**(`privkey`, `quiet?`): `string` + +Generate a new Maci Public key from a private key + +#### Parameters + +| Name | Type | Default value | Description | +| :-------- | :-------- | :------------ | :------------------------ | +| `privkey` | `string` | `undefined` | - | +| `quiet` | `boolean` | `true` | whether to log the output | + +#### Returns + +`string` + +the public key serialized + +#### Defined in + +[commands/genPubKey.ts:13](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/commands/genPubKey.ts#L13) + +--- + +### genProofs + +▸ **genProofs**(`GenProofsArgs`): `Promise`\<[`TallyData`](interfaces/TallyData.md)\> + +Generate proofs for the message processing, tally and subsidy calculations + +#### Parameters + +| Name | Type | Description | +| :-------------- | :--------------------------------------------- | :-------------------------------------- | +| `GenProofsArgs` | [`GenProofsArgs`](interfaces/GenProofsArgs.md) | The arguments for the genProofs command | + +#### Returns + +`Promise`\<[`TallyData`](interfaces/TallyData.md)\> + +The tally data + +**`Note`** + +see different options for zkey files to use specific circuits https://maci.pse.dev/docs/trusted-setup, https://maci.pse.dev/docs/testing/#pre-compiled-artifacts-for-testing + +#### Defined in + +[commands/genProofs.ts:42](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/commands/genProofs.ts#L42) + +--- + +### getPoll + +▸ **getPoll**(`args`): `Promise`\<`IGetPollData`\> + +Get deployed poll from MACI contract + +#### Parameters + +| Name | Type | Description | +| :----- | :------------- | :------------------------------------- | +| `args` | `IGetPollArgs` | The arguments for the get poll command | + +#### Returns + +`Promise`\<`IGetPollData`\> + +poll data + +#### Defined in + +[commands/poll.ts:14](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/commands/poll.ts#L14) + +--- + +### isRegisteredUser + +▸ **isRegisteredUser**(`IRegisteredArgs`): `Promise`\<\{ `isRegistered`: `boolean` ; `stateIndex?`: `string` }\> + +Checks if user is registered with public key + +#### Parameters + +| Name | Type | Description | +| :---------------- | :--------------------------------------------------------- | :------------------------------------------- | +| `IRegisteredArgs` | [`IRegisteredUserArgs`](interfaces/IRegisteredUserArgs.md) | The arguments for the register check command | + +#### Returns + +`Promise`\<\{ `isRegistered`: `boolean` ; `stateIndex?`: `string` }\> + +user registered or not and state index + +#### Defined in + +[commands/signup.ts:94](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/commands/signup.ts#L94) + +--- + +### mergeMessages + +▸ **mergeMessages**(`MergeMessagesArgs`): `Promise`\<`void`\> + +Merge the message queue on chain + +#### Parameters + +| Name | Type | Description | +| :------------------ | :----------------------------------------------------- | :------------------------------------------ | +| `MergeMessagesArgs` | [`MergeMessagesArgs`](interfaces/MergeMessagesArgs.md) | The arguments for the mergeMessages command | + +#### Returns + +`Promise`\<`void`\> + +#### Defined in + +[commands/mergeMessages.ts:25](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/commands/mergeMessages.ts#L25) + +--- + +### mergeSignups + +▸ **mergeSignups**(`MergeSignupsArgs`): `Promise`\<`void`\> + +Command to merge the signups of a MACI contract + +#### Parameters + +| Name | Type | Description | +| :----------------- | :--------------------------------------------------- | :----------------------------------------- | +| `MergeSignupsArgs` | [`MergeSignupsArgs`](interfaces/MergeSignupsArgs.md) | The arguments for the mergeSignups command | + +#### Returns + +`Promise`\<`void`\> + +#### Defined in + +[commands/mergeSignups.ts:25](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/commands/mergeSignups.ts#L25) + +--- + +### proveOnChain + +▸ **proveOnChain**(`ProveOnChainArgs`): `Promise`\<`void`\> + +Command to prove the result of a poll on-chain + +#### Parameters + +| Name | Type | Description | +| :----------------- | :--------------------------------------------------- | :----------------------------------------- | +| `ProveOnChainArgs` | [`ProveOnChainArgs`](interfaces/ProveOnChainArgs.md) | The arguments for the proveOnChain command | + +#### Returns + +`Promise`\<`void`\> + +#### Defined in + +[commands/proveOnChain.ts:43](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/commands/proveOnChain.ts#L43) + +--- + +### publish + +▸ **publish**(`PublishArgs`): `Promise`\<`string`\> + +Publish a new message to a MACI Poll contract + +#### Parameters + +| Name | Type | Description | +| :------------ | :----------------------------------------- | :------------------------------------ | +| `PublishArgs` | [`PublishArgs`](interfaces/PublishArgs.md) | The arguments for the publish command | + +#### Returns + +`Promise`\<`string`\> + +The ephemeral private key used to encrypt the message + +#### Defined in + +[commands/publish.ts:17](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/commands/publish.ts#L17) + +--- + +### setVerifyingKeys + +▸ **setVerifyingKeys**(`SetVerifyingKeysArgs`): `Promise`\<`void`\> + +Function that sets the verifying keys in the VkRegistry contract + +#### Parameters + +| Name | Type | Description | +| :--------------------- | :--------------------- | :--------------------------------------------- | +| `SetVerifyingKeysArgs` | `SetVerifyingKeysArgs` | The arguments for the setVerifyingKeys command | + +#### Returns + +`Promise`\<`void`\> + +**`Note`** + +see different options for zkey files to use specific circuits https://maci.pse.dev/docs/trusted-setup, https://maci.pse.dev/docs/testing/#pre-compiled-artifacts-for-testing + +#### Defined in + +[commands/setVerifyingKeys.ts:26](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/commands/setVerifyingKeys.ts#L26) + +--- + +### signup + +▸ **signup**(`args`): `Promise`\<`ISignupData`\> + +Signup a user to the MACI contract + +#### Parameters + +| Name | Type | Description | +| :----- | :--------------------------------------- | :----------------------------------- | +| `args` | [`SignupArgs`](interfaces/SignupArgs.md) | The arguments for the signup command | + +#### Returns + +`Promise`\<`ISignupData`\> + +The state index of the user and transaction hash + +#### Defined in + +[commands/signup.ts:17](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/commands/signup.ts#L17) + +--- + +### timeTravel + +▸ **timeTravel**(`«destructured»`): `Promise`\<`void`\> + +Utility to travel in time when using a local blockchain + +#### Parameters + +| Name | Type | +| :--------------- | :--------------- | +| `«destructured»` | `TimeTravelArgs` | + +#### Returns + +`Promise`\<`void`\> + +#### Defined in + +[commands/timeTravel.ts:10](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/commands/timeTravel.ts#L10) + +--- + +### topup + +▸ **topup**(`TopupArgs`): `Promise`\<`void`\> + +Publish a topup message + +#### Parameters + +| Name | Type | Description | +| :---------- | :------------------------------------- | :---------------------------------- | +| `TopupArgs` | [`TopupArgs`](interfaces/TopupArgs.md) | The arguments for the topup command | + +#### Returns + +`Promise`\<`void`\> + +#### Defined in + +[commands/topup.ts:9](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/commands/topup.ts#L9) + +--- + +### verify + +▸ **verify**(`VerifyArgs`): `Promise`\<`void`\> + +Verify the results of a poll and optionally the subsidy results on-chain + +#### Parameters + +| Name | Type | Description | +| :----------- | :--------------------------------------- | :----------------------------------- | +| `VerifyArgs` | [`VerifyArgs`](interfaces/VerifyArgs.md) | The arguments for the verify command | + +#### Returns + +`Promise`\<`void`\> + +#### Defined in + +[commands/verify.ts:23](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/cli/ts/commands/verify.ts#L23) diff --git a/website/versioned_docs/version-v1.2/typedoc/core/.nojekyll b/website/versioned_docs/version-v1.2/typedoc/core/.nojekyll new file mode 100644 index 0000000000..e2ac6616ad --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/core/.nojekyll @@ -0,0 +1 @@ +TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false. \ No newline at end of file diff --git a/website/versioned_docs/version-v1.2/typedoc/core/classes/MaciState.md b/website/versioned_docs/version-v1.2/typedoc/core/classes/MaciState.md new file mode 100644 index 0000000000..e36fdfa929 --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/core/classes/MaciState.md @@ -0,0 +1,295 @@ +--- +title: MaciState +sidebar_label: MaciState +--- + +A representation of the MACI contract. + +## Implements + +- `IMaciState` + +## Table of contents + +### Constructors + +- [constructor](MaciState.md#constructor) + +### Properties + +- [currentPollBeingProcessed](MaciState.md#currentpollbeingprocessed) +- [numSignUps](MaciState.md#numsignups) +- [pollBeingProcessed](MaciState.md#pollbeingprocessed) +- [polls](MaciState.md#polls) +- [stateLeaves](MaciState.md#stateleaves) +- [stateTreeDepth](MaciState.md#statetreedepth) + +### Methods + +- [copy](MaciState.md#copy) +- [deployNullPoll](MaciState.md#deploynullpoll) +- [deployPoll](MaciState.md#deploypoll) +- [equals](MaciState.md#equals) +- [signUp](MaciState.md#signup) +- [toJSON](MaciState.md#tojson) +- [fromJSON](MaciState.md#fromjson) + +## Constructors + +### constructor + +• **new MaciState**(`stateTreeDepth`): [`MaciState`](MaciState.md) + +Constructs a new MaciState object. + +#### Parameters + +| Name | Type | Description | +| :--------------- | :------- | :--------------------------- | +| `stateTreeDepth` | `number` | The depth of the state tree. | + +#### Returns + +[`MaciState`](MaciState.md) + +#### Defined in + +[MaciState.ts:32](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/MaciState.ts#L32) + +## Properties + +### currentPollBeingProcessed + +• `Optional` **currentPollBeingProcessed**: `bigint` + +#### Defined in + +[MaciState.ts:26](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/MaciState.ts#L26) + +--- + +### numSignUps + +• **numSignUps**: `number` = `0` + +#### Defined in + +[MaciState.ts:21](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/MaciState.ts#L21) + +--- + +### pollBeingProcessed + +• `Optional` **pollBeingProcessed**: `boolean` + +#### Defined in + +[MaciState.ts:24](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/MaciState.ts#L24) + +--- + +### polls + +• **polls**: `Map`\<`bigint`, [`Poll`](Poll.md)\> + +#### Defined in + +[MaciState.ts:13](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/MaciState.ts#L13) + +--- + +### stateLeaves + +• **stateLeaves**: `StateLeaf`[] = `[]` + +#### Defined in + +[MaciState.ts:16](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/MaciState.ts#L16) + +--- + +### stateTreeDepth + +• **stateTreeDepth**: `number` + +#### Defined in + +[MaciState.ts:19](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/MaciState.ts#L19) + +## Methods + +### copy + +▸ **copy**(): [`MaciState`](MaciState.md) + +Create a deep copy of the MaciState object. + +#### Returns + +[`MaciState`](MaciState.md) + +A new instance of the MaciState object with the same properties. + +#### Implementation of + +IMaciState.copy + +#### Defined in + +[MaciState.ts:100](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/MaciState.ts#L100) + +--- + +### deployNullPoll + +▸ **deployNullPoll**(): `void` + +Deploy a null poll. + +#### Returns + +`void` + +#### Implementation of + +IMaciState.deployNullPoll + +#### Defined in + +[MaciState.ts:92](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/MaciState.ts#L92) + +--- + +### deployPoll + +▸ **deployPoll**(`pollEndTimestamp`, `maxValues`, `treeDepths`, `messageBatchSize`, `coordinatorKeypair`): `bigint` + +Deploy a new poll with the given parameters. + +#### Parameters + +| Name | Type | Description | +| :------------------- | :------------------------------------------ | :------------------------------------------------- | +| `pollEndTimestamp` | `bigint` | The Unix timestamp at which the poll ends. | +| `maxValues` | [`MaxValues`](../interfaces/MaxValues.md) | The maximum number of values for each vote option. | +| `treeDepths` | [`TreeDepths`](../interfaces/TreeDepths.md) | The depths of the tree. | +| `messageBatchSize` | `number` | The batch size for processing messages. | +| `coordinatorKeypair` | `Keypair` | The keypair of the MACI round coordinator. | + +#### Returns + +`bigint` + +The index of the newly deployed poll. + +#### Implementation of + +IMaciState.deployPoll + +#### Defined in + +[MaciState.ts:65](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/MaciState.ts#L65) + +--- + +### equals + +▸ **equals**(`m`): `boolean` + +Check if the MaciState object is equal to another MaciState object. + +#### Parameters + +| Name | Type | Description | +| :--- | :-------------------------- | :------------------------------- | +| `m` | [`MaciState`](MaciState.md) | The MaciState object to compare. | + +#### Returns + +`boolean` + +True if the two MaciState objects are equal, false otherwise. + +#### Implementation of + +IMaciState.equals + +#### Defined in + +[MaciState.ts:115](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/MaciState.ts#L115) + +--- + +### signUp + +▸ **signUp**(`pubKey`, `initialVoiceCreditBalance`, `timestamp`): `number` + +Sign up a user with the given public key, initial voice credit balance, and timestamp. + +#### Parameters + +| Name | Type | Description | +| :-------------------------- | :------- | :-------------------------------------------- | +| `pubKey` | `PubKey` | The public key of the user. | +| `initialVoiceCreditBalance` | `bigint` | The initial voice credit balance of the user. | +| `timestamp` | `bigint` | The timestamp of the sign-up. | + +#### Returns + +`number` + +The index of the newly signed-up user in the state tree. + +#### Implementation of + +IMaciState.signUp + +#### Defined in + +[MaciState.ts:49](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/MaciState.ts#L49) + +--- + +### toJSON + +▸ **toJSON**(): [`IJsonMaciState`](../interfaces/IJsonMaciState.md) + +Serialize the MaciState object to a JSON object. + +#### Returns + +[`IJsonMaciState`](../interfaces/IJsonMaciState.md) + +A JSON object representing the MaciState object. + +#### Implementation of + +IMaciState.toJSON + +#### Defined in + +[MaciState.ts:143](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/MaciState.ts#L143) + +--- + +### fromJSON + +▸ **fromJSON**(`json`): [`MaciState`](MaciState.md) + +Create a new MaciState object from a JSON object. + +#### Parameters + +| Name | Type | Description | +| :----- | :-------------------------------------------------- | :------------------------------------------------- | +| `json` | [`IJsonMaciState`](../interfaces/IJsonMaciState.md) | The JSON object representing the MaciState object. | + +#### Returns + +[`MaciState`](MaciState.md) + +A new instance of the MaciState object with the properties from the JSON object. + +#### Defined in + +[MaciState.ts:159](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/MaciState.ts#L159) diff --git a/website/versioned_docs/version-v1.2/typedoc/core/classes/Poll.md b/website/versioned_docs/version-v1.2/typedoc/core/classes/Poll.md new file mode 100644 index 0000000000..006d3b372a --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/core/classes/Poll.md @@ -0,0 +1,1098 @@ +--- +title: Poll +sidebar_label: Poll +--- + +A representation of the Poll contract. + +## Implements + +- `IPoll` + +## Table of contents + +### Constructors + +- [constructor](Poll.md#constructor) + +### Properties + +- [MM](Poll.md#mm) +- [WW](Poll.md#ww) +- [ballotTree](Poll.md#ballottree) +- [ballots](Poll.md#ballots) +- [batchSizes](Poll.md#batchsizes) +- [cbi](Poll.md#cbi) +- [commands](Poll.md#commands) +- [coordinatorKeypair](Poll.md#coordinatorkeypair) +- [currentMessageBatchIndex](Poll.md#currentmessagebatchindex) +- [emptyBallot](Poll.md#emptyballot) +- [emptyBallotHash](Poll.md#emptyballothash) +- [encPubKeys](Poll.md#encpubkeys) +- [maciStateRef](Poll.md#macistateref) +- [maxValues](Poll.md#maxvalues) +- [messageTree](Poll.md#messagetree) +- [messages](Poll.md#messages) +- [numBatchesProcessed](Poll.md#numbatchesprocessed) +- [numBatchesTallied](Poll.md#numbatchestallied) +- [numSignups](Poll.md#numsignups) +- [perVOSpentVoiceCredits](Poll.md#pervospentvoicecredits) +- [pollEndTimestamp](Poll.md#pollendtimestamp) +- [pollId](Poll.md#pollid) +- [preVOSpentVoiceCreditsRootSalts](Poll.md#prevospentvoicecreditsrootsalts) +- [rbi](Poll.md#rbi) +- [resultRootSalts](Poll.md#resultrootsalts) +- [sbSalts](Poll.md#sbsalts) +- [spentVoiceCreditSubtotalSalts](Poll.md#spentvoicecreditsubtotalsalts) +- [stateCopied](Poll.md#statecopied) +- [stateLeaves](Poll.md#stateleaves) +- [stateTree](Poll.md#statetree) +- [stateTreeDepth](Poll.md#statetreedepth) +- [subsidy](Poll.md#subsidy) +- [subsidySalts](Poll.md#subsidysalts) +- [tallyResult](Poll.md#tallyresult) +- [totalSpentVoiceCredits](Poll.md#totalspentvoicecredits) +- [treeDepths](Poll.md#treedepths) + +### Methods + +- [coefficientCalculation](Poll.md#coefficientcalculation) +- [copy](Poll.md#copy) +- [equals](Poll.md#equals) +- [genPerVOSpentVoiceCreditsCommitment](Poll.md#genpervospentvoicecreditscommitment) +- [genProcessMessagesCircuitInputsPartial](Poll.md#genprocessmessagescircuitinputspartial) +- [genSpentVoiceCreditSubtotalCommitment](Poll.md#genspentvoicecreditsubtotalcommitment) +- [getNumSignups](Poll.md#getnumsignups) +- [hasUnfinishedSubsidyCalculation](Poll.md#hasunfinishedsubsidycalculation) +- [hasUnprocessedMessages](Poll.md#hasunprocessedmessages) +- [hasUntalliedBallots](Poll.md#hasuntalliedballots) +- [increaseSubsidyIndex](Poll.md#increasesubsidyindex) +- [previousSubsidyIndexToString](Poll.md#previoussubsidyindextostring) +- [processAllMessages](Poll.md#processallmessages) +- [processMessage](Poll.md#processmessage) +- [processMessages](Poll.md#processmessages) +- [publishMessage](Poll.md#publishmessage) +- [setCoordinatorKeypair](Poll.md#setcoordinatorkeypair) +- [setNumSignups](Poll.md#setnumsignups) +- [subsidyCalculation](Poll.md#subsidycalculation) +- [subsidyPerBatch](Poll.md#subsidyperbatch) +- [tallyVotes](Poll.md#tallyvotes) +- [tallyVotesNonQv](Poll.md#tallyvotesnonqv) +- [toJSON](Poll.md#tojson) +- [topupMessage](Poll.md#topupmessage) +- [updatePoll](Poll.md#updatepoll) +- [fromJSON](Poll.md#fromjson) + +## Constructors + +### constructor + +• **new Poll**(`pollEndTimestamp`, `coordinatorKeypair`, `treeDepths`, `batchSizes`, `maxValues`, `maciStateRef`): [`Poll`](Poll.md) + +Constructs a new Poll object. + +#### Parameters + +| Name | Type | Description | +| :------------------- | :------------------------------------------ | :----------------------------------------------- | +| `pollEndTimestamp` | `bigint` | The Unix timestamp at which the poll ends. | +| `coordinatorKeypair` | `Keypair` | The keypair of the coordinator. | +| `treeDepths` | [`TreeDepths`](../interfaces/TreeDepths.md) | The depths of the trees used in the poll. | +| `batchSizes` | [`BatchSizes`](../interfaces/BatchSizes.md) | The sizes of the batches used in the poll. | +| `maxValues` | [`MaxValues`](../interfaces/MaxValues.md) | The maximum values the MACI circuits can accept. | +| `maciStateRef` | [`MaciState`](MaciState.md) | The reference to the MACI state. | + +#### Returns + +[`Poll`](Poll.md) + +#### Defined in + +[Poll.ts:146](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/Poll.ts#L146) + +## Properties + +### MM + +• **MM**: `number` = `50` + +#### Defined in + +[Poll.ts:124](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/Poll.ts#L124) + +--- + +### WW + +• **WW**: `number` = `4` + +#### Defined in + +[Poll.ts:126](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/Poll.ts#L126) + +--- + +### ballotTree + +• `Optional` **ballotTree**: `IncrementalQuinTree` + +#### Defined in + +[Poll.ts:73](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/Poll.ts#L73) + +--- + +### ballots + +• **ballots**: `Ballot`[] = `[]` + +#### Defined in + +[Poll.ts:71](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/Poll.ts#L71) + +--- + +### batchSizes + +• **batchSizes**: [`BatchSizes`](../interfaces/BatchSizes.md) + +#### Defined in + +[Poll.ts:62](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/Poll.ts#L62) + +--- + +### cbi + +• **cbi**: `number` = `0` + +#### Defined in + +[Poll.ts:122](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/Poll.ts#L122) + +--- + +### commands + +• **commands**: `ICommand`[] = `[]` + +#### Defined in + +[Poll.ts:79](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/Poll.ts#L79) + +--- + +### coordinatorKeypair + +• **coordinatorKeypair**: `Keypair` + +#### Defined in + +[Poll.ts:58](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/Poll.ts#L58) + +--- + +### currentMessageBatchIndex + +• `Optional` **currentMessageBatchIndex**: `number` + +#### Defined in + +[Poll.ts:92](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/Poll.ts#L92) + +--- + +### emptyBallot + +• **emptyBallot**: `Ballot` + +#### Defined in + +[Poll.ts:130](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/Poll.ts#L130) + +--- + +### emptyBallotHash + +• `Optional` **emptyBallotHash**: `bigint` + +#### Defined in + +[Poll.ts:132](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/Poll.ts#L132) + +--- + +### encPubKeys + +• **encPubKeys**: `PubKey`[] = `[]` + +#### Defined in + +[Poll.ts:81](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/Poll.ts#L81) + +--- + +### maciStateRef + +• **maciStateRef**: [`MaciState`](MaciState.md) + +#### Defined in + +[Poll.ts:94](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/Poll.ts#L94) + +--- + +### maxValues + +• **maxValues**: [`MaxValues`](../interfaces/MaxValues.md) + +#### Defined in + +[Poll.ts:64](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/Poll.ts#L64) + +--- + +### messageTree + +• **messageTree**: `IncrementalQuinTree` + +#### Defined in + +[Poll.ts:77](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/Poll.ts#L77) + +--- + +### messages + +• **messages**: `Message`[] = `[]` + +#### Defined in + +[Poll.ts:75](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/Poll.ts#L75) + +--- + +### numBatchesProcessed + +• **numBatchesProcessed**: `number` = `0` + +#### Defined in + +[Poll.ts:90](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/Poll.ts#L90) + +--- + +### numBatchesTallied + +• **numBatchesTallied**: `number` = `0` + +#### Defined in + +[Poll.ts:111](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/Poll.ts#L111) + +--- + +### numSignups + +• `Private` **numSignups**: `bigint` + +#### Defined in + +[Poll.ts:135](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/Poll.ts#L135) + +--- + +### perVOSpentVoiceCredits + +• **perVOSpentVoiceCredits**: `bigint`[] = `[]` + +#### Defined in + +[Poll.ts:109](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/Poll.ts#L109) + +--- + +### pollEndTimestamp + +• **pollEndTimestamp**: `bigint` + +#### Defined in + +[Poll.ts:69](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/Poll.ts#L69) + +--- + +### pollId + +• **pollId**: `bigint` + +#### Defined in + +[Poll.ts:96](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/Poll.ts#L96) + +--- + +### preVOSpentVoiceCreditsRootSalts + +• **preVOSpentVoiceCreditsRootSalts**: `Record`\<`string` \| `number`, `bigint`\> = `{}` + +#### Defined in + +[Poll.ts:102](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/Poll.ts#L102) + +--- + +### rbi + +• **rbi**: `number` = `0` + +#### Defined in + +[Poll.ts:120](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/Poll.ts#L120) + +--- + +### resultRootSalts + +• **resultRootSalts**: `Record`\<`string` \| `number`, `bigint`\> = `{}` + +#### Defined in + +[Poll.ts:100](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/Poll.ts#L100) + +--- + +### sbSalts + +• **sbSalts**: `Record`\<`string` \| `number`, `bigint`\> = `{}` + +#### Defined in + +[Poll.ts:98](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/Poll.ts#L98) + +--- + +### spentVoiceCreditSubtotalSalts + +• **spentVoiceCreditSubtotalSalts**: `Record`\<`string` \| `number`, `bigint`\> = `{}` + +#### Defined in + +[Poll.ts:104](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/Poll.ts#L104) + +--- + +### stateCopied + +• **stateCopied**: `boolean` = `false` + +#### Defined in + +[Poll.ts:83](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/Poll.ts#L83) + +--- + +### stateLeaves + +• **stateLeaves**: `StateLeaf`[] + +#### Defined in + +[Poll.ts:85](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/Poll.ts#L85) + +--- + +### stateTree + +• `Optional` **stateTree**: `IncrementalQuinTree` + +#### Defined in + +[Poll.ts:87](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/Poll.ts#L87) + +--- + +### stateTreeDepth + +• **stateTreeDepth**: `number` + +#### Defined in + +[Poll.ts:67](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/Poll.ts#L67) + +--- + +### subsidy + +• **subsidy**: `bigint`[] = `[]` + +#### Defined in + +[Poll.ts:116](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/Poll.ts#L116) + +--- + +### subsidySalts + +• **subsidySalts**: `Record`\<`string` \| `number`, `bigint`\> = `{}` + +#### Defined in + +[Poll.ts:118](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/Poll.ts#L118) + +--- + +### tallyResult + +• **tallyResult**: `bigint`[] = `[]` + +#### Defined in + +[Poll.ts:107](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/Poll.ts#L107) + +--- + +### totalSpentVoiceCredits + +• **totalSpentVoiceCredits**: `bigint` + +#### Defined in + +[Poll.ts:113](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/Poll.ts#L113) + +--- + +### treeDepths + +• **treeDepths**: [`TreeDepths`](../interfaces/TreeDepths.md) + +#### Defined in + +[Poll.ts:60](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/Poll.ts#L60) + +## Methods + +### coefficientCalculation + +▸ **coefficientCalculation**(`rowBallot`, `colBallot`): `bigint` + +This method calculates the coefficient for a pair of ballots. + +#### Parameters + +| Name | Type | Description | +| :---------- | :------- | :------------------------ | +| `rowBallot` | `Ballot` | The ballot in the row. | +| `colBallot` | `Ballot` | The ballot in the column. | + +#### Returns + +`bigint` + +Returns the calculated coefficient. + +#### Defined in + +[Poll.ts:1025](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/Poll.ts#L1025) + +--- + +### copy + +▸ **copy**(): [`Poll`](Poll.md) + +Create a deep copy of the Poll object. + +#### Returns + +[`Poll`](Poll.md) + +A new instance of the Poll object with the same properties. + +#### Implementation of + +IPoll.copy + +#### Defined in + +[Poll.ts:1454](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/Poll.ts#L1454) + +--- + +### equals + +▸ **equals**(`p`): `boolean` + +Check if the Poll object is equal to another Poll object. + +#### Parameters + +| Name | Type | Description | +| :--- | :---------------- | :-------------------------- | +| `p` | [`Poll`](Poll.md) | The Poll object to compare. | + +#### Returns + +`boolean` + +True if the two Poll objects are equal, false otherwise. + +#### Implementation of + +IPoll.equals + +#### Defined in + +[Poll.ts:1540](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/Poll.ts#L1540) + +--- + +### genPerVOSpentVoiceCreditsCommitment + +▸ **genPerVOSpentVoiceCreditsCommitment**(`salt`, `numBallotsToCount`, `useQuadraticVoting?`): `bigint` + +This method generates a commitment to the spent voice credits per vote option. + +This is the hash of the Merkle root of the spent voice credits per vote option and a salt, computed as Poseidon([root, _salt]). + +#### Parameters + +| Name | Type | Default value | Description | +| :------------------- | :-------- | :------------ | :------------------------------------------------------- | +| `salt` | `bigint` | `undefined` | The salt used in the hash function. | +| `numBallotsToCount` | `number` | `undefined` | The number of ballots to count for the calculation. | +| `useQuadraticVoting` | `boolean` | `true` | Whether to use quadratic voting or not. Default is true. | + +#### Returns + +`bigint` + +Returns the hash of the Merkle root of the spent voice credits per vote option and a salt, computed as Poseidon([root, _salt]). + +#### Defined in + +[Poll.ts:1428](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/Poll.ts#L1428) + +--- + +### genProcessMessagesCircuitInputsPartial + +▸ **genProcessMessagesCircuitInputsPartial**(`index`): [`CircuitInputs`](../modules.md#circuitinputs) + +Generates partial circuit inputs for processing a batch of messages + +#### Parameters + +| Name | Type | Description | +| :------ | :------- | :------------------------------ | +| `index` | `number` | The index of the partial batch. | + +#### Returns + +[`CircuitInputs`](../modules.md#circuitinputs) + +stringified partial circuit inputs + +#### Defined in + +[Poll.ts:776](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/Poll.ts#L776) + +--- + +### genSpentVoiceCreditSubtotalCommitment + +▸ **genSpentVoiceCreditSubtotalCommitment**(`salt`, `numBallotsToCount`, `useQuadraticVoting?`): `bigint` + +This method generates a commitment to the total spent voice credits. + +This is the hash of the total spent voice credits and a salt, computed as Poseidon([totalCredits, _salt]). + +#### Parameters + +| Name | Type | Default value | Description | +| :------------------- | :-------- | :------------ | :------------------------------------------------------- | +| `salt` | `bigint` | `undefined` | The salt used in the hash function. | +| `numBallotsToCount` | `number` | `undefined` | The number of ballots to count for the calculation. | +| `useQuadraticVoting` | `boolean` | `true` | Whether to use quadratic voting or not. Default is true. | + +#### Returns + +`bigint` + +Returns the hash of the total spent voice credits and a salt, computed as Poseidon([totalCredits, _salt]). + +#### Defined in + +[Poll.ts:1400](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/Poll.ts#L1400) + +--- + +### getNumSignups + +▸ **getNumSignups**(): `bigint` + +Get the number of signups + +#### Returns + +`bigint` + +The number of signups + +#### Defined in + +[Poll.ts:1665](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/Poll.ts#L1665) + +--- + +### hasUnfinishedSubsidyCalculation + +▸ **hasUnfinishedSubsidyCalculation**(): `boolean` + +This method checks if there are any unfinished subsidy calculations. + +#### Returns + +`boolean` + +Returns true if the product of the row batch index (rbi) and batch size or +the product of column batch index (cbi) and batch size is less than the length +of the ballots array, indicating that there are still ballots left to be processed. +Otherwise, it returns false. + +#### Implementation of + +IPoll.hasUnfinishedSubsidyCalculation + +#### Defined in + +[Poll.ts:906](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/Poll.ts#L906) + +--- + +### hasUnprocessedMessages + +▸ **hasUnprocessedMessages**(): `boolean` + +This method checks if there are any unprocessed messages in the Poll instance. + +#### Returns + +`boolean` + +Returns true if the number of processed batches is +less than the total number of batches, false otherwise. + +#### Implementation of + +IPoll.hasUnprocessedMessages + +#### Defined in + +[Poll.ts:411](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/Poll.ts#L411) + +--- + +### hasUntalliedBallots + +▸ **hasUntalliedBallots**(): `boolean` + +Checks whether there are any untallied ballots. + +#### Returns + +`boolean` + +Whether there are any untallied ballots + +#### Implementation of + +IPoll.hasUntalliedBallots + +#### Defined in + +[Poll.ts:897](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/Poll.ts#L897) + +--- + +### increaseSubsidyIndex + +▸ **increaseSubsidyIndex**(): `void` + +It increases the index for the subsidy calculation. + +#### Returns + +`void` + +#### Defined in + +[Poll.ts:980](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/Poll.ts#L980) + +--- + +### previousSubsidyIndexToString + +▸ **previousSubsidyIndexToString**(): `string` + +This method converts the previous subsidy index to a string. + +#### Returns + +`string` + +Returns a string representation of the previous subsidy index. +The string is in the format "rbi-cbi", where rbi and cbi are +the previous row batch index and column batch index respectively. + +#### Defined in + +[Poll.ts:997](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/Poll.ts#L997) + +--- + +### processAllMessages + +▸ **processAllMessages**(): `Object` + +Process all messages. This function does not update the ballots or state +leaves; rather, it copies and then updates them. This makes it possible +to test the result of multiple processMessage() invocations. + +#### Returns + +`Object` + +The state leaves and ballots of the poll + +| Name | Type | +| :------------ | :------------ | +| `ballots` | `Ballot`[] | +| `stateLeaves` | `StateLeaf`[] | + +#### Implementation of + +IPoll.processAllMessages + +#### Defined in + +[Poll.ts:881](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/Poll.ts#L881) + +--- + +### processMessage + +▸ **processMessage**(`message`, `encPubKey`, `qv?`): `IProcessMessagesOutput` + +Process one message. + +#### Parameters + +| Name | Type | Default value | Description | +| :---------- | :-------- | :------------ | :--------------------------------------------------------- | +| `message` | `Message` | `undefined` | The message to process. | +| `encPubKey` | `PubKey` | `undefined` | The public key associated with the encryption private key. | +| `qv` | `boolean` | `true` | - | + +#### Returns + +`IProcessMessagesOutput` + +A number of variables which will be used in the zk-SNARK circuit. + +#### Defined in + +[Poll.ts:225](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/Poll.ts#L225) + +--- + +### processMessages + +▸ **processMessages**(`pollId`, `qv?`, `quiet?`): [`IProcessMessagesCircuitInputs`](../interfaces/IProcessMessagesCircuitInputs.md) + +Process \_batchSize messages starting from the saved index. This +function will process messages even if the number of messages is not an +exact multiple of \_batchSize. e.g. if there are 10 messages, index is +8, and \_batchSize is 4, this function will only process the last two +messages in this.messages, and finally update the zeroth state leaf. +Note that this function will only process as many state leaves as there +are ballots to prevent accidental inclusion of a new user after this +poll has concluded. + +#### Parameters + +| Name | Type | Default value | Description | +| :------- | :-------- | :------------ | :--------------------------------------------------------- | +| `pollId` | `bigint` | `undefined` | The ID of the poll associated with the messages to process | +| `qv` | `boolean` | `true` | - | +| `quiet` | `boolean` | `true` | Whether to log errors or not | + +#### Returns + +[`IProcessMessagesCircuitInputs`](../interfaces/IProcessMessagesCircuitInputs.md) + +stringified circuit inputs + +#### Implementation of + +IPoll.processMessages + +#### Defined in + +[Poll.ts:437](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/Poll.ts#L437) + +--- + +### publishMessage + +▸ **publishMessage**(`message`, `encPubKey`): `void` + +Inserts a Message and the corresponding public key used to generate the +ECDH shared key which was used to encrypt said message. + +#### Parameters + +| Name | Type | Description | +| :---------- | :-------- | :----------------------------------------- | +| `message` | `Message` | The message to insert | +| `encPubKey` | `PubKey` | The public key used to encrypt the message | + +#### Returns + +`void` + +#### Implementation of + +IPoll.publishMessage + +#### Defined in + +[Poll.ts:372](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/Poll.ts#L372) + +--- + +### setCoordinatorKeypair + +▸ **setCoordinatorKeypair**(`serializedPrivateKey`): `void` + +Set the coordinator's keypair + +#### Parameters + +| Name | Type | Description | +| :--------------------- | :------- | :------------------------- | +| `serializedPrivateKey` | `string` | the serialized private key | + +#### Returns + +`void` + +#### Implementation of + +IPoll.setCoordinatorKeypair + +#### Defined in + +[Poll.ts:1649](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/Poll.ts#L1649) + +--- + +### setNumSignups + +▸ **setNumSignups**(`numSignups`): `void` + +Set the number of signups to match the ones from the contract + +#### Parameters + +| Name | Type | Description | +| :----------- | :------- | :-------------------- | +| `numSignups` | `bigint` | the number of signups | + +#### Returns + +`void` + +#### Defined in + +[Poll.ts:1657](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/Poll.ts#L1657) + +--- + +### subsidyCalculation + +▸ **subsidyCalculation**(`rowStartIndex`, `colStartIndex`): `Ballot`[][] + +This method calculates the subsidy for a batch of ballots. + +#### Parameters + +| Name | Type | Description | +| :-------------- | :------- | :----------------------------------------- | +| `rowStartIndex` | `number` | The starting index for the row ballots. | +| `colStartIndex` | `number` | The starting index for the column ballots. | + +#### Returns + +`Ballot`[][] + +Returns a 2D array of ballots. The first array contains the row ballots and the second array contains the column ballots. + +#### Defined in + +[Poll.ts:1040](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/Poll.ts#L1040) + +--- + +### subsidyPerBatch + +▸ **subsidyPerBatch**(): [`ISubsidyCircuitInputs`](../interfaces/ISubsidyCircuitInputs.md) + +This method calculates the subsidy per batch. + +#### Returns + +[`ISubsidyCircuitInputs`](../interfaces/ISubsidyCircuitInputs.md) + +Returns an array of big integers which represent the circuit inputs for the subsidy calculation. + +#### Implementation of + +IPoll.subsidyPerBatch + +#### Defined in + +[Poll.ts:915](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/Poll.ts#L915) + +--- + +### tallyVotes + +▸ **tallyVotes**(): [`ITallyCircuitInputs`](../interfaces/ITallyCircuitInputs.md) + +This method tallies a ballots and updates the tally results. + +#### Returns + +[`ITallyCircuitInputs`](../interfaces/ITallyCircuitInputs.md) + +the circuit inputs for the TallyVotes circuit. + +#### Implementation of + +IPoll.tallyVotes + +#### Defined in + +[Poll.ts:1079](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/Poll.ts#L1079) + +--- + +### tallyVotesNonQv + +▸ **tallyVotesNonQv**(): [`ITallyCircuitInputs`](../interfaces/ITallyCircuitInputs.md) + +#### Returns + +[`ITallyCircuitInputs`](../interfaces/ITallyCircuitInputs.md) + +#### Defined in + +[Poll.ts:1254](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/Poll.ts#L1254) + +--- + +### toJSON + +▸ **toJSON**(): `IJsonPoll` + +Serialize the Poll object to a JSON object + +#### Returns + +`IJsonPoll` + +a JSON object + +#### Implementation of + +IPoll.toJSON + +#### Defined in + +[Poll.ts:1576](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/Poll.ts#L1576) + +--- + +### topupMessage + +▸ **topupMessage**(`message`): `void` + +Top up the voice credit balance of a user. + +#### Parameters + +| Name | Type | Description | +| :-------- | :-------- | :--------------------------------------------- | +| `message` | `Message` | The message to top up the voice credit balance | + +#### Returns + +`void` + +#### Implementation of + +IPoll.topupMessage + +#### Defined in + +[Poll.ts:342](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/Poll.ts#L342) + +--- + +### updatePoll + +▸ **updatePoll**(`numSignups`): `void` + +Update a Poll with data from MaciState. +This is the step where we copy the state from the MaciState instance, +and set the number of signups we have so far. + +#### Parameters + +| Name | Type | +| :----------- | :------- | +| `numSignups` | `bigint` | + +#### Returns + +`void` + +#### Defined in + +[Poll.ts:184](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/Poll.ts#L184) + +--- + +### fromJSON + +▸ **fromJSON**(`json`, `maciState`): [`Poll`](Poll.md) + +Deserialize a json object into a Poll instance + +#### Parameters + +| Name | Type | Description | +| :---------- | :-------------------------- | :----------------------------------- | +| `json` | `IJsonPoll` | the json object to deserialize | +| `maciState` | [`MaciState`](MaciState.md) | the reference to the MaciState Class | + +#### Returns + +[`Poll`](Poll.md) + +a new Poll instance + +#### Defined in + +[Poll.ts:1600](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/Poll.ts#L1600) diff --git a/website/versioned_docs/version-v1.2/typedoc/core/index.md b/website/versioned_docs/version-v1.2/typedoc/core/index.md new file mode 100644 index 0000000000..71a56e2071 --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/core/index.md @@ -0,0 +1,110 @@ +--- +title: Core +sidebar_label: Core +--- + +[![NPM Package][core-npm-badge]][core-npm-link] +[![Actions Status][core-actions-badge]][core-actions-link] + +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`](https://github.com/privacy-scaling-explorations/maci/blob/dev/contracts/tests/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`](https://github.com/privacy-scaling-explorations/maci/blob/dev/contracts/ts/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 + +#### **`stateTree`** + +`stateTree` is a quinary Merkle tree, chosen over a binary tree due to the gas and circuit constraints associated with the Poseidon hash function ([details here][ethresearch-link]). Each leaf in this tree represents a participant's public key, their voice credit balance and the block timestamp at which they signed up. The tree features a configurable depth and an arity of five, with insertions starting at index 1. The zeroth leaf is reserved as a security measure against denial-of-service attacks. + +## **`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 + +#### **`messageTree`** + +`messageTree` is also a quinary Merkle tree. Each message in this tree represents an encrypted command, such as a user casting a vote in a poll or changing their public key. + +## Testing + +For more details about testing please refer to the [tests documentation](https://maci.pse.dev/docs/testing). + +[core-npm-badge]: https://img.shields.io/npm/v/maci-core.svg +[core-npm-link]: https://www.npmjs.com/package/maci-core +[core-actions-badge]: https://github.com/privacy-scaling-explorations/maci/actions/workflows/core-build.yml/badge.svg +[core-actions-link]: https://github.com/privacy-scaling-explorations/maci/actions?query=workflow%3Acore +[ethresearch-link]: https://ethresear.ch/t/gas-and-circuit-constraint-benchmarks-of-binary-and-quinary-incremental-merkle-trees-using-the-poseidon-hash-function/7446 + +## Directory Structure + +- `ts/`: The home for our core classes, `MaciState` and `Poll` +- `ts/utls/`: Contains supporting utilities +- `ts/__tests__/`: A dedicated test suite directory diff --git a/website/versioned_docs/version-v1.2/typedoc/core/interfaces/BatchSizes.md b/website/versioned_docs/version-v1.2/typedoc/core/interfaces/BatchSizes.md new file mode 100644 index 0000000000..93cc4b71b1 --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/core/interfaces/BatchSizes.md @@ -0,0 +1,50 @@ +--- +title: BatchSizes +sidebar_label: BatchSizes +--- + +This interface defines the batch sizes. + +## Table of contents + +### Properties + +- [messageBatchSize](BatchSizes.md#messagebatchsize) +- [subsidyBatchSize](BatchSizes.md#subsidybatchsize) +- [tallyBatchSize](BatchSizes.md#tallybatchsize) + +## Properties + +### messageBatchSize + +• **messageBatchSize**: `number` + +The size of the message batch. + +#### Defined in + +[utils/types.ts:46](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L46) + +--- + +### subsidyBatchSize + +• **subsidyBatchSize**: `number` + +The size of the subsidy batch. + +#### Defined in + +[utils/types.ts:47](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L47) + +--- + +### tallyBatchSize + +• **tallyBatchSize**: `number` + +The size of the tally batch. + +#### Defined in + +[utils/types.ts:45](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L45) diff --git a/website/versioned_docs/version-v1.2/typedoc/core/interfaces/IJsonMaciState.md b/website/versioned_docs/version-v1.2/typedoc/core/interfaces/IJsonMaciState.md new file mode 100644 index 0000000000..8ee3bcc0d4 --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/core/interfaces/IJsonMaciState.md @@ -0,0 +1,77 @@ +--- +title: IJsonMaciState +sidebar_label: IJsonMaciState +--- + +This interface defines the JSON representation of a MaciState + +## Table of contents + +### Properties + +- [currentPollBeingProcessed](IJsonMaciState.md#currentpollbeingprocessed) +- [numSignUps](IJsonMaciState.md#numsignups) +- [pollBeingProcessed](IJsonMaciState.md#pollbeingprocessed) +- [polls](IJsonMaciState.md#polls) +- [stateLeaves](IJsonMaciState.md#stateleaves) +- [stateTreeDepth](IJsonMaciState.md#statetreedepth) + +## Properties + +### currentPollBeingProcessed + +• **currentPollBeingProcessed**: `string` + +#### Defined in + +[utils/types.ts:130](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L130) + +--- + +### numSignUps + +• **numSignUps**: `number` + +#### Defined in + +[utils/types.ts:131](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L131) + +--- + +### pollBeingProcessed + +• **pollBeingProcessed**: `boolean` + +#### Defined in + +[utils/types.ts:129](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L129) + +--- + +### polls + +• **polls**: `IJsonPoll`[] + +#### Defined in + +[utils/types.ts:127](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L127) + +--- + +### stateLeaves + +• **stateLeaves**: `IJsonStateLeaf`[] + +#### Defined in + +[utils/types.ts:128](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L128) + +--- + +### stateTreeDepth + +• **stateTreeDepth**: `number` + +#### Defined in + +[utils/types.ts:126](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L126) diff --git a/website/versioned_docs/version-v1.2/typedoc/core/interfaces/IProcessMessagesCircuitInputs.md b/website/versioned_docs/version-v1.2/typedoc/core/interfaces/IProcessMessagesCircuitInputs.md new file mode 100644 index 0000000000..099b3ab170 --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/core/interfaces/IProcessMessagesCircuitInputs.md @@ -0,0 +1,242 @@ +--- +title: IProcessMessagesCircuitInputs +sidebar_label: IProcessMessagesCircuitInputs +--- + +An interface describing the circuit inputs to the ProcessMessage circuit + +## Table of contents + +### Properties + +- [coordPrivKey](IProcessMessagesCircuitInputs.md#coordprivkey) +- [coordPubKey](IProcessMessagesCircuitInputs.md#coordpubkey) +- [currentBallotRoot](IProcessMessagesCircuitInputs.md#currentballotroot) +- [currentBallots](IProcessMessagesCircuitInputs.md#currentballots) +- [currentBallotsPathElements](IProcessMessagesCircuitInputs.md#currentballotspathelements) +- [currentSbCommitment](IProcessMessagesCircuitInputs.md#currentsbcommitment) +- [currentSbSalt](IProcessMessagesCircuitInputs.md#currentsbsalt) +- [currentStateLeaves](IProcessMessagesCircuitInputs.md#currentstateleaves) +- [currentStateLeavesPathElements](IProcessMessagesCircuitInputs.md#currentstateleavespathelements) +- [currentStateRoot](IProcessMessagesCircuitInputs.md#currentstateroot) +- [currentVoteWeights](IProcessMessagesCircuitInputs.md#currentvoteweights) +- [currentVoteWeightsPathElements](IProcessMessagesCircuitInputs.md#currentvoteweightspathelements) +- [encPubKeys](IProcessMessagesCircuitInputs.md#encpubkeys) +- [inputHash](IProcessMessagesCircuitInputs.md#inputhash) +- [msgRoot](IProcessMessagesCircuitInputs.md#msgroot) +- [msgSubrootPathElements](IProcessMessagesCircuitInputs.md#msgsubrootpathelements) +- [msgs](IProcessMessagesCircuitInputs.md#msgs) +- [newSbCommitment](IProcessMessagesCircuitInputs.md#newsbcommitment) +- [newSbSalt](IProcessMessagesCircuitInputs.md#newsbsalt) +- [packedVals](IProcessMessagesCircuitInputs.md#packedvals) +- [pollEndTimestamp](IProcessMessagesCircuitInputs.md#pollendtimestamp) + +## Properties + +### coordPrivKey + +• **coordPrivKey**: `string` + +#### Defined in + +[utils/types.ts:159](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L159) + +--- + +### coordPubKey + +• **coordPubKey**: `string` + +#### Defined in + +[utils/types.ts:160](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L160) + +--- + +### currentBallotRoot + +• **currentBallotRoot**: `string` + +#### Defined in + +[utils/types.ts:163](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L163) + +--- + +### currentBallots + +• **currentBallots**: `string`[] + +#### Defined in + +[utils/types.ts:168](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L168) + +--- + +### currentBallotsPathElements + +• **currentBallotsPathElements**: `string`[][] + +#### Defined in + +[utils/types.ts:169](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L169) + +--- + +### currentSbCommitment + +• **currentSbCommitment**: `string` + +#### Defined in + +[utils/types.ts:164](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L164) + +--- + +### currentSbSalt + +• **currentSbSalt**: `string` + +#### Defined in + +[utils/types.ts:165](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L165) + +--- + +### currentStateLeaves + +• **currentStateLeaves**: `string`[] + +#### Defined in + +[utils/types.ts:166](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L166) + +--- + +### currentStateLeavesPathElements + +• **currentStateLeavesPathElements**: `string`[][] + +#### Defined in + +[utils/types.ts:167](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L167) + +--- + +### currentStateRoot + +• **currentStateRoot**: `string` + +#### Defined in + +[utils/types.ts:162](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L162) + +--- + +### currentVoteWeights + +• **currentVoteWeights**: `string`[] + +#### Defined in + +[utils/types.ts:170](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L170) + +--- + +### currentVoteWeightsPathElements + +• **currentVoteWeightsPathElements**: `string`[][] + +#### Defined in + +[utils/types.ts:171](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L171) + +--- + +### encPubKeys + +• **encPubKeys**: `string`[] + +#### Defined in + +[utils/types.ts:161](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L161) + +--- + +### inputHash + +• **inputHash**: `string` + +#### Defined in + +[utils/types.ts:172](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L172) + +--- + +### msgRoot + +• **msgRoot**: `string` + +#### Defined in + +[utils/types.ts:156](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L156) + +--- + +### msgSubrootPathElements + +• **msgSubrootPathElements**: `string`[][] + +#### Defined in + +[utils/types.ts:158](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L158) + +--- + +### msgs + +• **msgs**: `string`[] + +#### Defined in + +[utils/types.ts:157](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L157) + +--- + +### newSbCommitment + +• **newSbCommitment**: `string` + +#### Defined in + +[utils/types.ts:174](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L174) + +--- + +### newSbSalt + +• **newSbSalt**: `string` + +#### Defined in + +[utils/types.ts:173](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L173) + +--- + +### packedVals + +• **packedVals**: `string` + +#### Defined in + +[utils/types.ts:155](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L155) + +--- + +### pollEndTimestamp + +• **pollEndTimestamp**: `string` + +#### Defined in + +[utils/types.ts:154](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L154) diff --git a/website/versioned_docs/version-v1.2/typedoc/core/interfaces/ISubsidyCircuitInputs.md b/website/versioned_docs/version-v1.2/typedoc/core/interfaces/ISubsidyCircuitInputs.md new file mode 100644 index 0000000000..1166101285 --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/core/interfaces/ISubsidyCircuitInputs.md @@ -0,0 +1,198 @@ +--- +title: ISubsidyCircuitInputs +sidebar_label: ISubsidyCircuitInputs +--- + +An interface describing the circuit inputs to the Subsidy circuit + +## Table of contents + +### Properties + +- [ballotPathElements1](ISubsidyCircuitInputs.md#ballotpathelements1) +- [ballotPathElements2](ISubsidyCircuitInputs.md#ballotpathelements2) +- [ballotRoot](ISubsidyCircuitInputs.md#ballotroot) +- [ballots1](ISubsidyCircuitInputs.md#ballots1) +- [ballots2](ISubsidyCircuitInputs.md#ballots2) +- [currentSubsidy](ISubsidyCircuitInputs.md#currentsubsidy) +- [currentSubsidyCommitment](ISubsidyCircuitInputs.md#currentsubsidycommitment) +- [currentSubsidySalt](ISubsidyCircuitInputs.md#currentsubsidysalt) +- [inputHash](ISubsidyCircuitInputs.md#inputhash) +- [newSubsidyCommitment](ISubsidyCircuitInputs.md#newsubsidycommitment) +- [newSubsidySalt](ISubsidyCircuitInputs.md#newsubsidysalt) +- [packedVals](ISubsidyCircuitInputs.md#packedvals) +- [sbCommitment](ISubsidyCircuitInputs.md#sbcommitment) +- [sbSalt](ISubsidyCircuitInputs.md#sbsalt) +- [stateRoot](ISubsidyCircuitInputs.md#stateroot) +- [votes1](ISubsidyCircuitInputs.md#votes1) +- [votes2](ISubsidyCircuitInputs.md#votes2) + +## Properties + +### ballotPathElements1 + +• **ballotPathElements1**: `string`[] + +#### Defined in + +[utils/types.ts:222](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L222) + +--- + +### ballotPathElements2 + +• **ballotPathElements2**: `string`[] + +#### Defined in + +[utils/types.ts:223](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L223) + +--- + +### ballotRoot + +• **ballotRoot**: `string` + +#### Defined in + +[utils/types.ts:208](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L208) + +--- + +### ballots1 + +• **ballots1**: `string`[] + +#### Defined in + +[utils/types.ts:218](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L218) + +--- + +### ballots2 + +• **ballots2**: `string`[] + +#### Defined in + +[utils/types.ts:219](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L219) + +--- + +### currentSubsidy + +• **currentSubsidy**: `string`[] + +#### Defined in + +[utils/types.ts:215](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L215) + +--- + +### currentSubsidyCommitment + +• **currentSubsidyCommitment**: `string` + +#### Defined in + +[utils/types.ts:213](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L213) + +--- + +### currentSubsidySalt + +• **currentSubsidySalt**: `string` + +#### Defined in + +[utils/types.ts:210](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L210) + +--- + +### inputHash + +• **inputHash**: `string` + +#### Defined in + +[utils/types.ts:217](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L217) + +--- + +### newSubsidyCommitment + +• **newSubsidyCommitment**: `string` + +#### Defined in + +[utils/types.ts:214](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L214) + +--- + +### newSubsidySalt + +• **newSubsidySalt**: `string` + +#### Defined in + +[utils/types.ts:211](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L211) + +--- + +### packedVals + +• **packedVals**: `string` + +#### Defined in + +[utils/types.ts:216](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L216) + +--- + +### sbCommitment + +• **sbCommitment**: `string` + +#### Defined in + +[utils/types.ts:212](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L212) + +--- + +### sbSalt + +• **sbSalt**: `string` + +#### Defined in + +[utils/types.ts:209](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L209) + +--- + +### stateRoot + +• **stateRoot**: `string` + +#### Defined in + +[utils/types.ts:207](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L207) + +--- + +### votes1 + +• **votes1**: `number`[] + +#### Defined in + +[utils/types.ts:220](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L220) + +--- + +### votes2 + +• **votes2**: `number`[] + +#### Defined in + +[utils/types.ts:221](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L221) diff --git a/website/versioned_docs/version-v1.2/typedoc/core/interfaces/ITallyCircuitInputs.md b/website/versioned_docs/version-v1.2/typedoc/core/interfaces/ITallyCircuitInputs.md new file mode 100644 index 0000000000..8c708447ad --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/core/interfaces/ITallyCircuitInputs.md @@ -0,0 +1,231 @@ +--- +title: ITallyCircuitInputs +sidebar_label: ITallyCircuitInputs +--- + +An interface describing the circuit inputs to the TallyVotes circuit + +## Table of contents + +### Properties + +- [ballotPathElements](ITallyCircuitInputs.md#ballotpathelements) +- [ballotRoot](ITallyCircuitInputs.md#ballotroot) +- [ballots](ITallyCircuitInputs.md#ballots) +- [currentPerVOSpentVoiceCredits](ITallyCircuitInputs.md#currentpervospentvoicecredits) +- [currentPerVOSpentVoiceCreditsRootSalt](ITallyCircuitInputs.md#currentpervospentvoicecreditsrootsalt) +- [currentResults](ITallyCircuitInputs.md#currentresults) +- [currentResultsRootSalt](ITallyCircuitInputs.md#currentresultsrootsalt) +- [currentSpentVoiceCreditSubtotal](ITallyCircuitInputs.md#currentspentvoicecreditsubtotal) +- [currentSpentVoiceCreditSubtotalSalt](ITallyCircuitInputs.md#currentspentvoicecreditsubtotalsalt) +- [currentTallyCommitment](ITallyCircuitInputs.md#currenttallycommitment) +- [inputHash](ITallyCircuitInputs.md#inputhash) +- [newPerVOSpentVoiceCreditsRootSalt](ITallyCircuitInputs.md#newpervospentvoicecreditsrootsalt) +- [newResultsRootSalt](ITallyCircuitInputs.md#newresultsrootsalt) +- [newSpentVoiceCreditSubtotalSalt](ITallyCircuitInputs.md#newspentvoicecreditsubtotalsalt) +- [newTallyCommitment](ITallyCircuitInputs.md#newtallycommitment) +- [packedVals](ITallyCircuitInputs.md#packedvals) +- [sbCommitment](ITallyCircuitInputs.md#sbcommitment) +- [sbSalt](ITallyCircuitInputs.md#sbsalt) +- [stateRoot](ITallyCircuitInputs.md#stateroot) +- [votes](ITallyCircuitInputs.md#votes) + +## Properties + +### ballotPathElements + +• **ballotPathElements**: `PathElements` + +#### Defined in + +[utils/types.ts:190](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L190) + +--- + +### ballotRoot + +• **ballotRoot**: `string` + +#### Defined in + +[utils/types.ts:182](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L182) + +--- + +### ballots + +• **ballots**: `string`[] + +#### Defined in + +[utils/types.ts:189](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L189) + +--- + +### currentPerVOSpentVoiceCredits + +• `Optional` **currentPerVOSpentVoiceCredits**: `string`[] + +#### Defined in + +[utils/types.ts:196](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L196) + +--- + +### currentPerVOSpentVoiceCreditsRootSalt + +• `Optional` **currentPerVOSpentVoiceCreditsRootSalt**: `string` + +#### Defined in + +[utils/types.ts:197](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L197) + +--- + +### currentResults + +• **currentResults**: `string`[] + +#### Defined in + +[utils/types.ts:192](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L192) + +--- + +### currentResultsRootSalt + +• **currentResultsRootSalt**: `string` + +#### Defined in + +[utils/types.ts:193](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L193) + +--- + +### currentSpentVoiceCreditSubtotal + +• **currentSpentVoiceCreditSubtotal**: `string` + +#### Defined in + +[utils/types.ts:194](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L194) + +--- + +### currentSpentVoiceCreditSubtotalSalt + +• **currentSpentVoiceCreditSubtotalSalt**: `string` + +#### Defined in + +[utils/types.ts:195](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L195) + +--- + +### currentTallyCommitment + +• **currentTallyCommitment**: `string` + +#### Defined in + +[utils/types.ts:185](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L185) + +--- + +### inputHash + +• **inputHash**: `string` + +#### Defined in + +[utils/types.ts:188](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L188) + +--- + +### newPerVOSpentVoiceCreditsRootSalt + +• `Optional` **newPerVOSpentVoiceCreditsRootSalt**: `string` + +#### Defined in + +[utils/types.ts:199](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L199) + +--- + +### newResultsRootSalt + +• **newResultsRootSalt**: `string` + +#### Defined in + +[utils/types.ts:198](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L198) + +--- + +### newSpentVoiceCreditSubtotalSalt + +• **newSpentVoiceCreditSubtotalSalt**: `string` + +#### Defined in + +[utils/types.ts:200](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L200) + +--- + +### newTallyCommitment + +• **newTallyCommitment**: `string` + +#### Defined in + +[utils/types.ts:186](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L186) + +--- + +### packedVals + +• **packedVals**: `string` + +#### Defined in + +[utils/types.ts:187](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L187) + +--- + +### sbCommitment + +• **sbCommitment**: `string` + +#### Defined in + +[utils/types.ts:184](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L184) + +--- + +### sbSalt + +• **sbSalt**: `string` + +#### Defined in + +[utils/types.ts:183](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L183) + +--- + +### stateRoot + +• **stateRoot**: `string` + +#### Defined in + +[utils/types.ts:181](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L181) + +--- + +### votes + +• **votes**: `string`[][] + +#### Defined in + +[utils/types.ts:191](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L191) diff --git a/website/versioned_docs/version-v1.2/typedoc/core/interfaces/MaxValues.md b/website/versioned_docs/version-v1.2/typedoc/core/interfaces/MaxValues.md new file mode 100644 index 0000000000..68a422cb3a --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/core/interfaces/MaxValues.md @@ -0,0 +1,37 @@ +--- +title: MaxValues +sidebar_label: MaxValues +--- + +This interface defines the maximum values that the circuit can handle. + +## Table of contents + +### Properties + +- [maxMessages](MaxValues.md#maxmessages) +- [maxVoteOptions](MaxValues.md#maxvoteoptions) + +## Properties + +### maxMessages + +• **maxMessages**: `number` + +The maximum number of messages. + +#### Defined in + +[utils/types.ts:56](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L56) + +--- + +### maxVoteOptions + +• **maxVoteOptions**: `number` + +The maximum number of vote options. + +#### Defined in + +[utils/types.ts:57](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L57) diff --git a/website/versioned_docs/version-v1.2/typedoc/core/interfaces/TreeDepths.md b/website/versioned_docs/version-v1.2/typedoc/core/interfaces/TreeDepths.md new file mode 100644 index 0000000000..fd5c4d6e42 --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/core/interfaces/TreeDepths.md @@ -0,0 +1,63 @@ +--- +title: TreeDepths +sidebar_label: TreeDepths +--- + +This interface defines the tree depths. + +## Table of contents + +### Properties + +- [intStateTreeDepth](TreeDepths.md#intstatetreedepth) +- [messageTreeDepth](TreeDepths.md#messagetreedepth) +- [messageTreeSubDepth](TreeDepths.md#messagetreesubdepth) +- [voteOptionTreeDepth](TreeDepths.md#voteoptiontreedepth) + +## Properties + +### intStateTreeDepth + +• **intStateTreeDepth**: `number` + +The depth of the intermediate state tree. + +#### Defined in + +[utils/types.ts:32](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L32) + +--- + +### messageTreeDepth + +• **messageTreeDepth**: `number` + +The depth of the message tree. + +#### Defined in + +[utils/types.ts:33](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L33) + +--- + +### messageTreeSubDepth + +• **messageTreeSubDepth**: `number` + +The depth of the message tree sub. + +#### Defined in + +[utils/types.ts:34](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L34) + +--- + +### voteOptionTreeDepth + +• **voteOptionTreeDepth**: `number` + +The depth of the vote option tree. + +#### Defined in + +[utils/types.ts:35](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L35) diff --git a/website/versioned_docs/version-v1.2/typedoc/core/modules.md b/website/versioned_docs/version-v1.2/typedoc/core/modules.md new file mode 100644 index 0000000000..9034b53f17 --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/core/modules.md @@ -0,0 +1,289 @@ +--- +title: Core Module +sidebar_label: module +sidebar_position: 1 +--- + +## Table of contents + +### Classes + +- [MaciState](classes/MaciState.md) +- [Poll](classes/Poll.md) + +### Interfaces + +- [BatchSizes](interfaces/BatchSizes.md) +- [IJsonMaciState](interfaces/IJsonMaciState.md) +- [IProcessMessagesCircuitInputs](interfaces/IProcessMessagesCircuitInputs.md) +- [ISubsidyCircuitInputs](interfaces/ISubsidyCircuitInputs.md) +- [ITallyCircuitInputs](interfaces/ITallyCircuitInputs.md) +- [MaxValues](interfaces/MaxValues.md) +- [TreeDepths](interfaces/TreeDepths.md) + +### Type Aliases + +- [CircuitInputs](modules.md#circuitinputs) + +### Variables + +- [STATE_TREE_ARITY](modules.md#state_tree_arity) + +### Functions + +- [genProcessVkSig](modules.md#genprocessvksig) +- [genSubsidyVkSig](modules.md#gensubsidyvksig) +- [genTallyVkSig](modules.md#gentallyvksig) +- [packProcessMessageSmallVals](modules.md#packprocessmessagesmallvals) +- [packSubsidySmallVals](modules.md#packsubsidysmallvals) +- [packTallyVotesSmallVals](modules.md#packtallyvotessmallvals) +- [unpackProcessMessageSmallVals](modules.md#unpackprocessmessagesmallvals) +- [unpackTallyVotesSmallVals](modules.md#unpacktallyvotessmallvals) + +## Type Aliases + +### CircuitInputs + +Ƭ **CircuitInputs**: `Record`\<`string`, `string` \| `bigint` \| `bigint`[] \| `bigint`[][] \| `string`[] \| `bigint`[][][]\> + +A circuit inputs for the circom circuit + +#### Defined in + +[utils/types.ts:22](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/types.ts#L22) + +## Variables + +### STATE_TREE_ARITY + +• `Const` **STATE_TREE_ARITY**: `5` + +#### Defined in + +[utils/constants.ts:2](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/constants.ts#L2) + +## Functions + +### genProcessVkSig + +▸ **genProcessVkSig**(`stateTreeDepth`, `messageTreeDepth`, `voteOptionTreeDepth`, `batchSize`): `bigint` + +This function generates the signature of a ProcessMessage Verifying Key(VK). +This can be used to check if a ProcessMessages' circuit VK is registered +in a smart contract that holds several VKs. + +#### Parameters + +| Name | Type | Description | +| :-------------------- | :------- | :--------------------------------- | +| `stateTreeDepth` | `number` | The depth of the state tree. | +| `messageTreeDepth` | `number` | The depth of the message tree. | +| `voteOptionTreeDepth` | `number` | The depth of the vote option tree. | +| `batchSize` | `number` | The size of the batch. | + +#### Returns + +`bigint` + +Returns a signature for querying if a verifying key with the given parameters is already registered in the contract. + +#### Defined in + +[utils/utils.ts:14](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/utils.ts#L14) + +--- + +### genSubsidyVkSig + +▸ **genSubsidyVkSig**(`_stateTreeDepth`, `_intStateTreeDepth`, `_voteOptionTreeDepth`): `bigint` + +This function generates the signature of a Subsidy Verifying Key(VK). +This can be used to check if a SubsidyCalculations' circuit VK is registered +in a smart contract that holds several VKs. + +#### Parameters + +| Name | Type | Description | +| :--------------------- | :------- | :---------------------------------------- | +| `_stateTreeDepth` | `number` | The depth of the state tree. | +| `_intStateTreeDepth` | `number` | The depth of the intermediate state tree. | +| `_voteOptionTreeDepth` | `number` | The depth of the vote option tree. | + +#### Returns + +`bigint` + +Returns a signature for querying if a verifying key with +the given parameters is already registered in the contract. + +#### Defined in + +[utils/utils.ts:51](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/utils.ts#L51) + +--- + +### genTallyVkSig + +▸ **genTallyVkSig**(`_stateTreeDepth`, `_intStateTreeDepth`, `_voteOptionTreeDepth`): `bigint` + +This function generates the signature of a Tally Verifying Key(VK). +This can be used to check if a TallyVotes' circuit VK is registered +in a smart contract that holds several VKs. + +#### Parameters + +| Name | Type | Description | +| :--------------------- | :------- | :---------------------------------------- | +| `_stateTreeDepth` | `number` | The depth of the state tree. | +| `_intStateTreeDepth` | `number` | The depth of the intermediate state tree. | +| `_voteOptionTreeDepth` | `number` | The depth of the vote option tree. | + +#### Returns + +`bigint` + +Returns a signature for querying if a verifying key with +the given parameters is already registered in the contract. + +#### Defined in + +[utils/utils.ts:35](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/utils.ts#L35) + +--- + +### packProcessMessageSmallVals + +▸ **packProcessMessageSmallVals**(`maxVoteOptions`, `numUsers`, `batchStartIndex`, `batchEndIndex`): `bigint` + +This function packs it's parameters into a single bigint. + +#### Parameters + +| Name | Type | Description | +| :---------------- | :------- | :---------------------------------- | +| `maxVoteOptions` | `bigint` | The maximum number of vote options. | +| `numUsers` | `bigint` | The number of users. | +| `batchStartIndex` | `number` | The start index of the batch. | +| `batchEndIndex` | `number` | The end index of the batch. | + +#### Returns + +`bigint` + +Returns a single bigint that contains the packed values. + +#### Defined in + +[utils/utils.ts:65](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/utils.ts#L65) + +--- + +### packSubsidySmallVals + +▸ **packSubsidySmallVals**(`row`, `col`, `numSignUps`): `bigint` + +This function packs it's parameters into a single bigint. + +#### Parameters + +| Name | Type | Description | +| :----------- | :------- | :--------------------- | +| `row` | `number` | The row. | +| `col` | `number` | The column. | +| `numSignUps` | `number` | The number of signups. | + +#### Returns + +`bigint` + +Returns a single bigint that contains the packed values. + +#### Defined in + +[utils/utils.ts:150](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/utils.ts#L150) + +--- + +### packTallyVotesSmallVals + +▸ **packTallyVotesSmallVals**(`batchStartIndex`, `batchSize`, `numSignUps`): `bigint` + +This function packs it's parameters into a single bigint. + +#### Parameters + +| Name | Type | Description | +| :---------------- | :------- | :---------------------------- | +| `batchStartIndex` | `number` | The start index of the batch. | +| `batchSize` | `number` | The size of the batch. | +| `numSignUps` | `number` | The number of signups. | + +#### Returns + +`bigint` + +Returns a single bigint that contains the packed values. + +#### Defined in + +[utils/utils.ts:119](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/utils.ts#L119) + +--- + +### unpackProcessMessageSmallVals + +▸ **unpackProcessMessageSmallVals**(`packedVals`): `Object` + +This function unpacks partial values for the ProcessMessages circuit from a single bigint. + +#### Parameters + +| Name | Type | Description | +| :----------- | :------- | :------------------------------------------------- | +| `packedVals` | `bigint` | The single bigint that contains the packed values. | + +#### Returns + +`Object` + +Returns an object that contains the unpacked values. + +| Name | Type | +| :---------------- | :------- | +| `batchEndIndex` | `bigint` | +| `batchStartIndex` | `bigint` | +| `maxVoteOptions` | `bigint` | +| `numUsers` | `bigint` | + +#### Defined in + +[utils/utils.ts:86](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/utils.ts#L86) + +--- + +### unpackTallyVotesSmallVals + +▸ **unpackTallyVotesSmallVals**(`packedVals`): `Object` + +This function unpacks partial values for the TallyVotes circuit from a single bigint. + +#### Parameters + +| Name | Type | Description | +| :----------- | :------- | :------------------------------------------------- | +| `packedVals` | `bigint` | The single bigint that contains the packed values. | + +#### Returns + +`Object` + +Returns an object that contains the unpacked values. + +| Name | Type | +| :---------------- | :------- | +| `batchStartIndex` | `bigint` | +| `numSignUps` | `bigint` | + +#### Defined in + +[utils/utils.ts:131](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/core/ts/utils/utils.ts#L131) diff --git a/website/versioned_docs/version-v1.2/typedoc/crypto/.nojekyll b/website/versioned_docs/version-v1.2/typedoc/crypto/.nojekyll new file mode 100644 index 0000000000..e2ac6616ad --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/crypto/.nojekyll @@ -0,0 +1 @@ +TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false. \ No newline at end of file diff --git a/website/versioned_docs/version-v1.2/typedoc/crypto/classes/AccQueue.md b/website/versioned_docs/version-v1.2/typedoc/crypto/classes/AccQueue.md new file mode 100644 index 0000000000..e64745080d --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/crypto/classes/AccQueue.md @@ -0,0 +1,770 @@ +--- +title: AccQueue +sidebar_label: AccQueue +--- + +An Accumulator Queue which conforms to the implementation in AccQueue.sol. +Each enqueue() operation updates a subtree, and a merge() operation combines +all subtrees into a main tree. + +**`Notice`** + +It supports 2 or 5 elements per leaf. + +## Table of contents + +### Constructors + +- [constructor](AccQueue.md#constructor) + +### Properties + +- [MAX_DEPTH](AccQueue.md#max_depth) +- [currentSubtreeIndex](AccQueue.md#currentsubtreeindex) +- [hashFunc](AccQueue.md#hashfunc) +- [hashLength](AccQueue.md#hashlength) +- [leafQueue](AccQueue.md#leafqueue) +- [mainRoots](AccQueue.md#mainroots) +- [nextSRindexToQueue](AccQueue.md#nextsrindextoqueue) +- [numLeaves](AccQueue.md#numleaves) +- [smallSRTroot](AccQueue.md#smallsrtroot) +- [subDepth](AccQueue.md#subdepth) +- [subHashFunc](AccQueue.md#subhashfunc) +- [subRootQueue](AccQueue.md#subrootqueue) +- [subRoots](AccQueue.md#subroots) +- [subTreesMerged](AccQueue.md#subtreesmerged) +- [zeroValue](AccQueue.md#zerovalue) +- [zeros](AccQueue.md#zeros) + +### Methods + +- [arrayToMap](AccQueue.md#arraytomap) +- [calcSRTdepth](AccQueue.md#calcsrtdepth) +- [copy](AccQueue.md#copy) +- [enqueue](AccQueue.md#enqueue) +- [enqueueOp](AccQueue.md#enqueueop) +- [fill](AccQueue.md#fill) +- [fillOp](AccQueue.md#fillop) +- [getHashLength](AccQueue.md#gethashlength) +- [getMainRoots](AccQueue.md#getmainroots) +- [getRoot](AccQueue.md#getroot) +- [getSmallSRTroot](AccQueue.md#getsmallsrtroot) +- [getSubDepth](AccQueue.md#getsubdepth) +- [getSubRoot](AccQueue.md#getsubroot) +- [getSubRoots](AccQueue.md#getsubroots) +- [getZeros](AccQueue.md#getzeros) +- [hasRoot](AccQueue.md#hasroot) +- [hash](AccQueue.md#hash) +- [insertSubTree](AccQueue.md#insertsubtree) +- [mapToArray](AccQueue.md#maptoarray) +- [merge](AccQueue.md#merge) +- [mergeDirect](AccQueue.md#mergedirect) +- [mergeSubRoots](AccQueue.md#mergesubroots) +- [queueSubRoot](AccQueue.md#queuesubroot) + +## Constructors + +### constructor + +• **new AccQueue**(`subDepth`, `hashLength`, `zeroValue`): [`AccQueue`](AccQueue.md) + +Create a new instance of AccQueue + +#### Parameters + +| Name | Type | Description | +| :----------- | :------- | :--------------------------------- | +| `subDepth` | `number` | the depth of the subtrees | +| `hashLength` | `number` | the number of leaves per node | +| `zeroValue` | `bigint` | the default value for empty leaves | + +#### Returns + +[`AccQueue`](AccQueue.md) + +#### Defined in + +[crypto/ts/AccQueue.ts:76](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/AccQueue.ts#L76) + +## Properties + +### MAX_DEPTH + +• `Private` **MAX_DEPTH**: `number` = `32` + +#### Defined in + +[crypto/ts/AccQueue.ts:17](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/AccQueue.ts#L17) + +--- + +### currentSubtreeIndex + +• `Private` **currentSubtreeIndex**: `number` = `0` + +#### Defined in + +[crypto/ts/AccQueue.ts:30](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/AccQueue.ts#L30) + +--- + +### hashFunc + +• `Readonly` **hashFunc**: (`leaves`: `bigint`[]) => `bigint` + +#### Type declaration + +▸ (`leaves`): `bigint` + +##### Parameters + +| Name | Type | +| :------- | :--------- | +| `leaves` | `bigint`[] | + +##### Returns + +`bigint` + +#### Defined in + +[crypto/ts/AccQueue.ts:68](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/AccQueue.ts#L68) + +--- + +### hashLength + +• `Private` **hashLength**: `number` + +#### Defined in + +[crypto/ts/AccQueue.ts:23](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/AccQueue.ts#L23) + +--- + +### leafQueue + +• `Private` **leafQueue**: [`Queue`](../interfaces/Queue.md) + +#### Defined in + +[crypto/ts/AccQueue.ts:36](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/AccQueue.ts#L36) + +--- + +### mainRoots + +• `Private` **mainRoots**: `bigint`[] = `[]` + +#### Defined in + +[crypto/ts/AccQueue.ts:55](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/AccQueue.ts#L55) + +--- + +### nextSRindexToQueue + +• `Private` **nextSRindexToQueue**: `number` = `0` + +#### Defined in + +[crypto/ts/AccQueue.ts:42](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/AccQueue.ts#L42) + +--- + +### numLeaves + +• `Private` **numLeaves**: `number` = `0` + +#### Defined in + +[crypto/ts/AccQueue.ts:33](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/AccQueue.ts#L33) + +--- + +### smallSRTroot + +• `Private` **smallSRTroot**: `bigint` + +#### Defined in + +[crypto/ts/AccQueue.ts:44](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/AccQueue.ts#L44) + +--- + +### subDepth + +• `Private` **subDepth**: `number` + +#### Defined in + +[crypto/ts/AccQueue.ts:20](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/AccQueue.ts#L20) + +--- + +### subHashFunc + +• `Readonly` **subHashFunc**: (`leaves`: `bigint`[]) => `bigint` + +#### Type declaration + +▸ (`leaves`): `bigint` + +##### Parameters + +| Name | Type | +| :------- | :--------- | +| `leaves` | `bigint`[] | + +##### Returns + +`bigint` + +#### Defined in + +[crypto/ts/AccQueue.ts:65](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/AccQueue.ts#L65) + +--- + +### subRootQueue + +• `Private` **subRootQueue**: [`Queue`](../interfaces/Queue.md) + +#### Defined in + +[crypto/ts/AccQueue.ts:46](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/AccQueue.ts#L46) + +--- + +### subRoots + +• `Private` **subRoots**: `bigint`[] = `[]` + +#### Defined in + +[crypto/ts/AccQueue.ts:52](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/AccQueue.ts#L52) + +--- + +### subTreesMerged + +• `Private` **subTreesMerged**: `boolean` = `false` + +#### Defined in + +[crypto/ts/AccQueue.ts:62](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/AccQueue.ts#L62) + +--- + +### zeroValue + +• `Private` **zeroValue**: `bigint` + +#### Defined in + +[crypto/ts/AccQueue.ts:26](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/AccQueue.ts#L26) + +--- + +### zeros + +• `Private` **zeros**: `bigint`[] = `[]` + +#### Defined in + +[crypto/ts/AccQueue.ts:59](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/AccQueue.ts#L59) + +## Methods + +### arrayToMap + +▸ **arrayToMap**(`array`): `Map`\<`number`, `Map`\<`number`, `bigint`\>\> + +Convert 2D array to its map representation + +#### Parameters + +| Name | Type | Description | +| :------ | :----------- | :---------- | +| `array` | `bigint`[][] | 2D array | + +#### Returns + +`Map`\<`number`, `Map`\<`number`, `bigint`\>\> + +map representation of 2D array + +#### Defined in + +[crypto/ts/AccQueue.ts:614](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/AccQueue.ts#L614) + +--- + +### calcSRTdepth + +▸ **calcSRTdepth**(): `number` + +Calculate the depth of the smallest possible Merkle tree which fits all + +#### Returns + +`number` + +the depth of the smallest possible Merkle tree which fits all + +#### Defined in + +[crypto/ts/AccQueue.ts:343](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/AccQueue.ts#L343) + +--- + +### copy + +▸ **copy**(): [`AccQueue`](AccQueue.md) + +#### Returns + +[`AccQueue`](AccQueue.md) + +a deep copy of this object + +**`Notice`** + +Deep-copies this object + +#### Defined in + +[crypto/ts/AccQueue.ts:572](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/AccQueue.ts#L572) + +--- + +### enqueue + +▸ **enqueue**(`leaf`): `number` + +Enqueue a leaf into the current subtree + +#### Parameters + +| Name | Type | Description | +| :----- | :------- | :------------------ | +| `leaf` | `bigint` | The leaf to insert. | + +#### Returns + +`number` + +The index of the leaf + +#### Defined in + +[crypto/ts/AccQueue.ts:185](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/AccQueue.ts#L185) + +--- + +### enqueueOp + +▸ **enqueueOp**(`leaf`, `level`): `void` + +Private function that performs the actual enqueue operation + +#### Parameters + +| Name | Type | Description | +| :------ | :------- | :----------------------- | +| `leaf` | `bigint` | The leaf to insert | +| `level` | `number` | The level of the subtree | + +#### Returns + +`void` + +#### Defined in + +[crypto/ts/AccQueue.ts:226](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/AccQueue.ts#L226) + +--- + +### fill + +▸ **fill**(): `void` + +Fill any empty leaves of the last subtree with zeros and store the +resulting subroot. + +#### Returns + +`void` + +#### Defined in + +[crypto/ts/AccQueue.ts:267](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/AccQueue.ts#L267) + +--- + +### fillOp + +▸ **fillOp**(`level`): `void` + +Private function that performs the actual fill operation + +#### Parameters + +| Name | Type | Description | +| :------ | :------- | :----------------------- | +| `level` | `number` | The level of the subtree | + +#### Returns + +`void` + +#### Defined in + +[crypto/ts/AccQueue.ts:307](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/AccQueue.ts#L307) + +--- + +### getHashLength + +▸ **getHashLength**(): `number` + +Get the number of inputs per hash function + +#### Returns + +`number` + +the number of inputs + +#### Defined in + +[crypto/ts/AccQueue.ts:176](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/AccQueue.ts#L176) + +--- + +### getMainRoots + +▸ **getMainRoots**(): `bigint`[] + +Get the root of merged subtrees + +#### Returns + +`bigint`[] + +the root of merged subtrees + +#### Defined in + +[crypto/ts/AccQueue.ts:149](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/AccQueue.ts#L149) + +--- + +### getRoot + +▸ **getRoot**(`depth`): `undefined` \| `null` \| `bigint` + +Get the root at a certain depth + +#### Parameters + +| Name | Type | Description | +| :------ | :------- | :-------------------- | +| `depth` | `number` | The depth of the tree | + +#### Returns + +`undefined` \| `null` \| `bigint` + +the root + +#### Defined in + +[crypto/ts/AccQueue.ts:554](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/AccQueue.ts#L554) + +--- + +### getSmallSRTroot + +▸ **getSmallSRTroot**(): `bigint` + +Get the small SRT root + +#### Returns + +`bigint` + +small SRT root + +#### Defined in + +[crypto/ts/AccQueue.ts:125](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/AccQueue.ts#L125) + +--- + +### getSubDepth + +▸ **getSubDepth**(): `number` + +Get the subdepth + +#### Returns + +`number` + +subdepth + +#### Defined in + +[crypto/ts/AccQueue.ts:141](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/AccQueue.ts#L141) + +--- + +### getSubRoot + +▸ **getSubRoot**(`index`): `bigint` + +Get the subroot at a given index + +#### Parameters + +| Name | Type | Description | +| :------ | :------- | :----------------------- | +| `index` | `number` | The index of the subroot | + +#### Returns + +`bigint` + +the subroot + +#### Defined in + +[crypto/ts/AccQueue.ts:167](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/AccQueue.ts#L167) + +--- + +### getSubRoots + +▸ **getSubRoots**(): `bigint`[] + +Get the subroots + +#### Returns + +`bigint`[] + +subroots + +#### Defined in + +[crypto/ts/AccQueue.ts:133](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/AccQueue.ts#L133) + +--- + +### getZeros + +▸ **getZeros**(): `bigint`[] + +Get the zero values per level. i.e. zeros[0] is zeroValue, +zeros[1] is the hash of leavesPerNode zeros, and so on. + +#### Returns + +`bigint`[] + +zeros + +#### Defined in + +[crypto/ts/AccQueue.ts:158](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/AccQueue.ts#L158) + +--- + +### hasRoot + +▸ **hasRoot**(`depth`): `boolean` + +Check if the root at a certain depth exists (subtree root) + +#### Parameters + +| Name | Type | Description | +| :------ | :------- | :-------------------- | +| `depth` | `number` | the depth of the tree | + +#### Returns + +`boolean` + +whether the root exists + +#### Defined in + +[crypto/ts/AccQueue.ts:563](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/AccQueue.ts#L563) + +--- + +### hash + +▸ **hash**(`leaves`): `bigint` + +Hash an array of leaves + +#### Parameters + +| Name | Type | Description | +| :------- | :--------- | :----------------- | +| `leaves` | `bigint`[] | The leaves to hash | + +#### Returns + +`bigint` + +the hash value of the leaves + +#### Defined in + +[crypto/ts/AccQueue.ts:623](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/AccQueue.ts#L623) + +--- + +### insertSubTree + +▸ **insertSubTree**(`subRoot`): `void` + +Insert a subtree into the queue. This is used when the subtree is +already computed. + +#### Parameters + +| Name | Type | Description | +| :-------- | :------- | :---------------------- | +| `subRoot` | `bigint` | The root of the subtree | + +#### Returns + +`void` + +#### Defined in + +[crypto/ts/AccQueue.ts:359](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/AccQueue.ts#L359) + +--- + +### mapToArray + +▸ **mapToArray**(`map`): `bigint`[][] + +Convert map to 2D array + +#### Parameters + +| Name | Type | Description | +| :---- | :--------------------------------------------- | :----------------------------- | +| `map` | `Map`\<`number`, `Map`\<`number`, `bigint`\>\> | map representation of 2D array | + +#### Returns + +`bigint`[][] + +2D array + +#### Defined in + +[crypto/ts/AccQueue.ts:604](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/AccQueue.ts#L604) + +--- + +### merge + +▸ **merge**(`depth`): `void` + +Merge all the subroots into a tree of a specified depth. +It requires this.mergeSubRoots() to be run first. + +#### Parameters + +| Name | Type | +| :------ | :------- | +| `depth` | `number` | + +#### Returns + +`void` + +#### Defined in + +[crypto/ts/AccQueue.ts:381](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/AccQueue.ts#L381) + +--- + +### mergeDirect + +▸ **mergeDirect**(`depth`): `void` + +Merge all the subroots into a tree of a specified depth. +Uses an IncrementalQuinTree instead of the two-step method that +AccQueue.sol uses. + +#### Parameters + +| Name | Type | +| :------ | :------- | +| `depth` | `number` | + +#### Returns + +`void` + +#### Defined in + +[crypto/ts/AccQueue.ts:415](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/AccQueue.ts#L415) + +--- + +### mergeSubRoots + +▸ **mergeSubRoots**(`numSrQueueOps?`): `void` + +Merge all subroots into the smallest possible Merkle tree which fits +them. e.g. if there are 5 subroots and hashLength == 2, the tree depth +is 3 since 2 \*\* 3 = 8 which is the next power of 2. + +#### Parameters + +| Name | Type | Default value | Description | +| :-------------- | :------- | :------------ | :------------------------------------------- | +| `numSrQueueOps` | `number` | `0` | The number of subroots to queue into the SRT | + +#### Returns + +`void` + +#### Defined in + +[crypto/ts/AccQueue.ts:462](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/AccQueue.ts#L462) + +--- + +### queueSubRoot + +▸ **queueSubRoot**(`leaf`, `level`, `maxDepth`): `void` + +Queues the leaf (a subroot) into queuedSRTlevels + +#### Parameters + +| Name | Type | Description | +| :--------- | :------- | :---------------------------- | +| `leaf` | `bigint` | The leaf to insert | +| `level` | `number` | The level of the subtree | +| `maxDepth` | `number` | The maximum depth of the tree | + +#### Returns + +`void` + +#### Defined in + +[crypto/ts/AccQueue.ts:523](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/AccQueue.ts#L523) diff --git a/website/versioned_docs/version-v1.2/typedoc/crypto/classes/G1Point.md b/website/versioned_docs/version-v1.2/typedoc/crypto/classes/G1Point.md new file mode 100644 index 0000000000..4aaadca0a1 --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/crypto/classes/G1Point.md @@ -0,0 +1,115 @@ +--- +title: G1Point +sidebar_label: G1Point +--- + +**`Notice`** + +A class representing a point on the first group (G1) +of the Jubjub curve + +## Table of contents + +### Constructors + +- [constructor](G1Point.md#constructor) + +### Properties + +- [x](G1Point.md#x) +- [y](G1Point.md#y) + +### Methods + +- [asContractParam](G1Point.md#ascontractparam) +- [equals](G1Point.md#equals) + +## Constructors + +### constructor + +• **new G1Point**(`x`, `y`): [`G1Point`](G1Point.md) + +Create a new instance of G1Point + +#### Parameters + +| Name | Type | Description | +| :--- | :------- | :--------------- | +| `x` | `bigint` | the x coordinate | +| `y` | `bigint` | the y coordinate | + +#### Returns + +[`G1Point`](G1Point.md) + +#### Defined in + +[crypto/ts/babyjub.ts:22](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/babyjub.ts#L22) + +## Properties + +### x + +• **x**: `bigint` + +#### Defined in + +[crypto/ts/babyjub.ts:13](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/babyjub.ts#L13) + +--- + +### y + +• **y**: `bigint` + +#### Defined in + +[crypto/ts/babyjub.ts:15](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/babyjub.ts#L15) + +## Methods + +### asContractParam + +▸ **asContractParam**(): `Object` + +Return the point as a contract param in the form of an object + +#### Returns + +`Object` + +the point as a contract param + +| Name | Type | +| :--- | :------- | +| `x` | `string` | +| `y` | `string` | + +#### Defined in + +[crypto/ts/babyjub.ts:42](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/babyjub.ts#L42) + +--- + +### equals + +▸ **equals**(`pt`): `boolean` + +Check whether two points are equal + +#### Parameters + +| Name | Type | Description | +| :--- | :---------------------- | :------------------------ | +| `pt` | [`G1Point`](G1Point.md) | the point to compare with | + +#### Returns + +`boolean` + +whether they are equal or not + +#### Defined in + +[crypto/ts/babyjub.ts:34](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/babyjub.ts#L34) diff --git a/website/versioned_docs/version-v1.2/typedoc/crypto/classes/G2Point.md b/website/versioned_docs/version-v1.2/typedoc/crypto/classes/G2Point.md new file mode 100644 index 0000000000..3479f97887 --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/crypto/classes/G2Point.md @@ -0,0 +1,140 @@ +--- +title: G2Point +sidebar_label: G2Point +--- + +**`Notice`** + +A class representing a point on the second group (G2) +of the Jubjub curve. This is usually an extension field of the +base field of the curve. + +## Table of contents + +### Constructors + +- [constructor](G2Point.md#constructor) + +### Properties + +- [x](G2Point.md#x) +- [y](G2Point.md#y) + +### Methods + +- [asContractParam](G2Point.md#ascontractparam) +- [checkPointsRange](G2Point.md#checkpointsrange) +- [equals](G2Point.md#equals) + +## Constructors + +### constructor + +• **new G2Point**(`x`, `y`): [`G2Point`](G2Point.md) + +Create a new instance of G2Point + +#### Parameters + +| Name | Type | Description | +| :--- | :--------- | :--------------- | +| `x` | `bigint`[] | the x coordinate | +| `y` | `bigint`[] | the y coordinate | + +#### Returns + +[`G2Point`](G2Point.md) + +#### Defined in + +[crypto/ts/babyjub.ts:65](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/babyjub.ts#L65) + +## Properties + +### x + +• **x**: `bigint`[] + +#### Defined in + +[crypto/ts/babyjub.ts:56](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/babyjub.ts#L56) + +--- + +### y + +• **y**: `bigint`[] + +#### Defined in + +[crypto/ts/babyjub.ts:58](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/babyjub.ts#L58) + +## Methods + +### asContractParam + +▸ **asContractParam**(): `Object` + +Return the point as a contract param in the form of an object + +#### Returns + +`Object` + +the point as a contract param + +| Name | Type | +| :--- | :--------- | +| `x` | `string`[] | +| `y` | `string`[] | + +#### Defined in + +[crypto/ts/babyjub.ts:86](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/babyjub.ts#L86) + +--- + +### checkPointsRange + +▸ **checkPointsRange**(`x`, `type`): `void` + +Check whether the points are in range + +#### Parameters + +| Name | Type | Description | +| :----- | :------------- | :------------------------- | +| `x` | `bigint`[] | the x coordinate | +| `type` | `"x"` \| `"y"` | the type of the coordinate | + +#### Returns + +`void` + +#### Defined in + +[crypto/ts/babyjub.ts:98](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/babyjub.ts#L98) + +--- + +### equals + +▸ **equals**(`pt`): `boolean` + +Check whether two points are equal + +#### Parameters + +| Name | Type | Description | +| :--- | :---------------------- | :------------------------ | +| `pt` | [`G2Point`](G2Point.md) | the point to compare with | + +#### Returns + +`boolean` + +whether they are equal or not + +#### Defined in + +[crypto/ts/babyjub.ts:78](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/babyjub.ts#L78) diff --git a/website/versioned_docs/version-v1.2/typedoc/crypto/classes/IncrementalQuinTree.md b/website/versioned_docs/version-v1.2/typedoc/crypto/classes/IncrementalQuinTree.md new file mode 100644 index 0000000000..203d11a759 --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/crypto/classes/IncrementalQuinTree.md @@ -0,0 +1,470 @@ +--- +title: IncrementalQuinTree +sidebar_label: IncrementalQuinTree +--- + +An implementation of an incremental Merkle tree + +**`Dev`** + +adapted from https://github.com/weijiekoh/optimisedmt + +## Table of contents + +### Constructors + +- [constructor](IncrementalQuinTree.md#constructor) + +### Properties + +- [arity](IncrementalQuinTree.md#arity) +- [capacity](IncrementalQuinTree.md#capacity) +- [depth](IncrementalQuinTree.md#depth) +- [hashFunc](IncrementalQuinTree.md#hashfunc) +- [nextIndex](IncrementalQuinTree.md#nextindex) +- [nodes](IncrementalQuinTree.md#nodes) +- [numNodes](IncrementalQuinTree.md#numnodes) +- [root](IncrementalQuinTree.md#root) +- [zeroValue](IncrementalQuinTree.md#zerovalue) +- [zeros](IncrementalQuinTree.md#zeros) + +### Methods + +- [calcChildIndices](IncrementalQuinTree.md#calcchildindices) +- [calcInitialVals](IncrementalQuinTree.md#calcinitialvals) +- [calcLeafIndices](IncrementalQuinTree.md#calcleafindices) +- [calcParentIndices](IncrementalQuinTree.md#calcparentindices) +- [copy](IncrementalQuinTree.md#copy) +- [genProof](IncrementalQuinTree.md#genproof) +- [genSubrootProof](IncrementalQuinTree.md#gensubrootproof) +- [getNode](IncrementalQuinTree.md#getnode) +- [insert](IncrementalQuinTree.md#insert) +- [setNode](IncrementalQuinTree.md#setnode) +- [update](IncrementalQuinTree.md#update) +- [verifyProof](IncrementalQuinTree.md#verifyproof) + +## Constructors + +### constructor + +• **new IncrementalQuinTree**(`depth`, `zeroValue`, `arity`, `hashFunc`): [`IncrementalQuinTree`](IncrementalQuinTree.md) + +Create a new instance of the MaciQuinTree + +#### Parameters + +| Name | Type | Description | +| :---------- | :--------------------------------- | :---------------------------- | +| `depth` | `number` | The depth of the tree | +| `zeroValue` | `bigint` | The zero value of the tree | +| `arity` | `number` | The arity of the tree | +| `hashFunc` | (`leaves`: `bigint`[]) => `bigint` | The hash function of the tree | + +#### Returns + +[`IncrementalQuinTree`](IncrementalQuinTree.md) + +#### Defined in + +[crypto/ts/quinTree.ts:42](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/quinTree.ts#L42) + +## Properties + +### arity + +• **arity**: `number` + +#### Defined in + +[crypto/ts/quinTree.ts:15](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/quinTree.ts#L15) + +--- + +### capacity + +• **capacity**: `number` + +#### Defined in + +[crypto/ts/quinTree.ts:33](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/quinTree.ts#L33) + +--- + +### depth + +• **depth**: `number` + +#### Defined in + +[crypto/ts/quinTree.ts:9](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/quinTree.ts#L9) + +--- + +### hashFunc + +• **hashFunc**: (`leaves`: `bigint`[]) => `bigint` + +#### Type declaration + +▸ (`leaves`): `bigint` + +##### Parameters + +| Name | Type | +| :------- | :--------- | +| `leaves` | `bigint`[] | + +##### Returns + +`bigint` + +#### Defined in + +[crypto/ts/quinTree.ts:18](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/quinTree.ts#L18) + +--- + +### nextIndex + +• **nextIndex**: `number` = `0` + +#### Defined in + +[crypto/ts/quinTree.ts:21](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/quinTree.ts#L21) + +--- + +### nodes + +• **nodes**: `Node` + +#### Defined in + +[crypto/ts/quinTree.ts:29](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/quinTree.ts#L29) + +--- + +### numNodes + +• **numNodes**: `number` + +#### Defined in + +[crypto/ts/quinTree.ts:31](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/quinTree.ts#L31) + +--- + +### root + +• **root**: `bigint` + +#### Defined in + +[crypto/ts/quinTree.ts:27](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/quinTree.ts#L27) + +--- + +### zeroValue + +• **zeroValue**: `bigint` + +#### Defined in + +[crypto/ts/quinTree.ts:12](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/quinTree.ts#L12) + +--- + +### zeros + +• **zeros**: `bigint`[] = `[]` + +#### Defined in + +[crypto/ts/quinTree.ts:25](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/quinTree.ts#L25) + +## Methods + +### calcChildIndices + +▸ **calcChildIndices**(`index`): `number`[] + +Calculate the indices of the children of a node + +#### Parameters + +| Name | Type | Description | +| :------ | :------- | :-------------------- | +| `index` | `number` | The index of the node | + +#### Returns + +`number`[] + +The indices of the children + +#### Defined in + +[crypto/ts/quinTree.ts:272](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/quinTree.ts#L272) + +--- + +### calcInitialVals + +▸ **calcInitialVals**(`arity`, `depth`, `zeroValue`, `hashFunc`): `Object` + +Calculate the zeroes and the root of a tree + +#### Parameters + +| Name | Type | Description | +| :---------- | :--------------------------------- | :---------------------------- | +| `arity` | `number` | The arity of the tree | +| `depth` | `number` | The depth of the tree | +| `zeroValue` | `bigint` | The zero value of the tree | +| `hashFunc` | (`leaves`: `bigint`[]) => `bigint` | The hash function of the tree | + +#### Returns + +`Object` + +The zeros and the root + +| Name | Type | +| :------ | :--------- | +| `root` | `bigint` | +| `zeros` | `bigint`[] | + +#### Defined in + +[crypto/ts/quinTree.ts:358](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/quinTree.ts#L358) + +--- + +### calcLeafIndices + +▸ **calcLeafIndices**(`index`): `number`[] + +Calculate the indices of the leaves in the path to the root + +#### Parameters + +| Name | Type | Description | +| :------ | :------- | :-------------------- | +| `index` | `number` | The index of the leaf | + +#### Returns + +`number`[] + +The indices of the leaves in the path to the root + +#### Defined in + +[crypto/ts/quinTree.ts:105](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/quinTree.ts#L105) + +--- + +### calcParentIndices + +▸ **calcParentIndices**(`index`): `number`[] + +Calculate the indices of the parent + +#### Parameters + +| Name | Type | Description | +| :------ | :------- | :-------------------- | +| `index` | `number` | The index of the leaf | + +#### Returns + +`number`[] + +The indices of the parent + +#### Defined in + +[crypto/ts/quinTree.ts:248](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/quinTree.ts#L248) + +--- + +### copy + +▸ **copy**(): [`IncrementalQuinTree`](IncrementalQuinTree.md) + +Copy the tree to a new instance + +#### Returns + +[`IncrementalQuinTree`](IncrementalQuinTree.md) + +The new instance + +#### Defined in + +[crypto/ts/quinTree.ts:338](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/quinTree.ts#L338) + +--- + +### genProof + +▸ **genProof**(`index`): `IMerkleProof` + +Generate a proof for a given leaf index + +#### Parameters + +| Name | Type | Description | +| :------ | :------- | :-------------------------------------------- | +| `index` | `number` | The index of the leaf to generate a proof for | + +#### Returns + +`IMerkleProof` + +The proof + +#### Defined in + +[crypto/ts/quinTree.ts:122](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/quinTree.ts#L122) + +--- + +### genSubrootProof + +▸ **genSubrootProof**(`startIndex`, `endIndex`): `IMerkleProof` + +Generates a Merkle proof from a subroot to the root. + +#### Parameters + +| Name | Type | Description | +| :----------- | :------- | :-------------------------- | +| `startIndex` | `number` | The index of the first leaf | +| `endIndex` | `number` | The index of the last leaf | + +#### Returns + +`IMerkleProof` + +The Merkle proof + +#### Defined in + +[crypto/ts/quinTree.ts:168](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/quinTree.ts#L168) + +--- + +### getNode + +▸ **getNode**(`index`): `bigint` + +Get a node at a given index + +#### Parameters + +| Name | Type | Description | +| :------ | :------- | :-------------------- | +| `index` | `number` | The index of the node | + +#### Returns + +`bigint` + +The node + +#### Defined in + +[crypto/ts/quinTree.ts:299](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/quinTree.ts#L299) + +--- + +### insert + +▸ **insert**(`value`): `void` + +Insert a leaf at the next available index + +#### Parameters + +| Name | Type | Description | +| :------ | :------- | :------------------ | +| `value` | `bigint` | The value to insert | + +#### Returns + +`void` + +#### Defined in + +[crypto/ts/quinTree.ts:68](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/quinTree.ts#L68) + +--- + +### setNode + +▸ **setNode**(`index`, `value`): `void` + +Set a node (not the root) + +#### Parameters + +| Name | Type | Description | +| :------ | :------- | :-------------------- | +| `index` | `number` | the index of the node | +| `value` | `bigint` | the value of the node | + +#### Returns + +`void` + +#### Defined in + +[crypto/ts/quinTree.ts:327](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/quinTree.ts#L327) + +--- + +### update + +▸ **update**(`index`, `value`): `void` + +Update a leaf at a given index + +#### Parameters + +| Name | Type | Description | +| :------ | :------- | :-------------------------------- | +| `index` | `number` | The index of the leaf to update | +| `value` | `bigint` | The value to update the leaf with | + +#### Returns + +`void` + +#### Defined in + +[crypto/ts/quinTree.ts:79](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/quinTree.ts#L79) + +--- + +### verifyProof + +▸ **verifyProof**(`proof`): `boolean` + +Verify a proof + +#### Parameters + +| Name | Type | Description | +| :------ | :------------- | :------------------ | +| `proof` | `IMerkleProof` | The proof to verify | + +#### Returns + +`boolean` + +Whether the proof is valid + +#### Defined in + +[crypto/ts/quinTree.ts:221](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/quinTree.ts#L221) diff --git a/website/versioned_docs/version-v1.2/typedoc/crypto/index.md b/website/versioned_docs/version-v1.2/typedoc/crypto/index.md new file mode 100644 index 0000000000..fd3d88b6a1 --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/crypto/index.md @@ -0,0 +1,44 @@ +--- +title: Crypto +sidebar_label: Crypto +--- + +[![NPM Package][crypto-npm-badge]][crypto-npm-link] +[![Actions Status][crypto-actions-badge]][crypto-actions-link] + +This module implements abstractions over cryptographic functions which MACI +employs. + +## AccQueue + +AccQueue is an implementation of an Accumulator Queue. This is used to manage a queue of elements in merkle-tree like structure. This TypeScript class conforms with the smart contract implemented in _maci-contracts_ - AccQueue.sol. + +The main tree is divided into subtrees to allow for easier management. Each of the subtrees has its own root and leaves, with the depth being defined by the _subDepth_ property of the AccQueue class. When a new leaf is "enqued", this is actually added to the current subtree. If this is full, we calculate the root of the subtree and store it, while the new leaf is added to the next subtree. + +The use of subtrees allows to more efficiently fill the tree, where instead of computing the root each time a new leaf is added, we only need to compute the root of the subtrees. + +## Crypto + +Various cryptographic utilities, which can be used to hash values with the Poseidon hash function, and to generate and manage points on the Baby jubjub curve. + +## Test + +To run the tests, execute the following command: + +```bash +pnpm run test +``` + +To run tests on the individual files, you can execute the following commands: + +```bash +pnpm run test-crypto +pnpm run test-accQueue +``` + +For more details about testing please refer to the [tests documentation](https://maci.pse.dev/docs/testing). + +[crypto-npm-badge]: https://img.shields.io/npm/v/maci-crypto.svg +[crypto-npm-link]: https://www.npmjs.com/package/maci-crypto +[crypto-actions-badge]: https://github.com/privacy-scaling-explorations/maci/actions/workflows/crypto-build.yml/badge.svg +[crypto-actions-link]: https://github.com/privacy-scaling-explorations/maci/actions?query=workflow%3Acrypto diff --git a/website/versioned_docs/version-v1.2/typedoc/crypto/interfaces/Keypair.md b/website/versioned_docs/version-v1.2/typedoc/crypto/interfaces/Keypair.md new file mode 100644 index 0000000000..cbada331f5 --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/crypto/interfaces/Keypair.md @@ -0,0 +1,33 @@ +--- +title: Keypair +sidebar_label: Keypair +--- + +A private key and a public key + +## Table of contents + +### Properties + +- [privKey](Keypair.md#privkey) +- [pubKey](Keypair.md#pubkey) + +## Properties + +### privKey + +• **privKey**: `SnarkBigNumber` + +#### Defined in + +[crypto/ts/types.ts:38](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/types.ts#L38) + +--- + +### pubKey + +• **pubKey**: [`PubKey`](../modules.md#pubkey)\<`bigint`\> + +#### Defined in + +[crypto/ts/types.ts:39](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/types.ts#L39) diff --git a/website/versioned_docs/version-v1.2/typedoc/crypto/interfaces/PoseidonFuncs.md b/website/versioned_docs/version-v1.2/typedoc/crypto/interfaces/PoseidonFuncs.md new file mode 100644 index 0000000000..a5356c15db --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/crypto/interfaces/PoseidonFuncs.md @@ -0,0 +1,115 @@ +--- +title: PoseidonFuncs +sidebar_label: PoseidonFuncs +--- + +A interface for poseidon hash functions + +## Indexable + +▪ [key: `number`]: (`inputs`: `bigint`[]) => `bigint` + +## Table of contents + +### Properties + +- [2](PoseidonFuncs.md#2) +- [3](PoseidonFuncs.md#3) +- [4](PoseidonFuncs.md#4) +- [5](PoseidonFuncs.md#5) + +## Properties + +### 2 + +• **2**: (`inputs`: `bigint`[]) => `bigint` + +#### Type declaration + +▸ (`inputs`): `bigint` + +##### Parameters + +| Name | Type | +| :------- | :--------- | +| `inputs` | `bigint`[] | + +##### Returns + +`bigint` + +#### Defined in + +[crypto/ts/types.ts:57](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/types.ts#L57) + +--- + +### 3 + +• **3**: (`inputs`: `bigint`[]) => `bigint` + +#### Type declaration + +▸ (`inputs`): `bigint` + +##### Parameters + +| Name | Type | +| :------- | :--------- | +| `inputs` | `bigint`[] | + +##### Returns + +`bigint` + +#### Defined in + +[crypto/ts/types.ts:58](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/types.ts#L58) + +--- + +### 4 + +• **4**: (`inputs`: `bigint`[]) => `bigint` + +#### Type declaration + +▸ (`inputs`): `bigint` + +##### Parameters + +| Name | Type | +| :------- | :--------- | +| `inputs` | `bigint`[] | + +##### Returns + +`bigint` + +#### Defined in + +[crypto/ts/types.ts:59](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/types.ts#L59) + +--- + +### 5 + +• **5**: (`inputs`: `bigint`[]) => `bigint` + +#### Type declaration + +▸ (`inputs`): `bigint` + +##### Parameters + +| Name | Type | +| :------- | :--------- | +| `inputs` | `bigint`[] | + +##### Returns + +`bigint` + +#### Defined in + +[crypto/ts/types.ts:60](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/types.ts#L60) diff --git a/website/versioned_docs/version-v1.2/typedoc/crypto/interfaces/Queue.md b/website/versioned_docs/version-v1.2/typedoc/crypto/interfaces/Queue.md new file mode 100644 index 0000000000..5c706bd75f --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/crypto/interfaces/Queue.md @@ -0,0 +1,33 @@ +--- +title: Queue +sidebar_label: Queue +--- + +A acc queue + +## Table of contents + +### Properties + +- [indices](Queue.md#indices) +- [levels](Queue.md#levels) + +## Properties + +### indices + +• **indices**: `number`[] + +#### Defined in + +[crypto/ts/types.ts:31](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/types.ts#L31) + +--- + +### levels + +• **levels**: `Map`\<`number`, `Map`\<`number`, `bigint`\>\> + +#### Defined in + +[crypto/ts/types.ts:30](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/types.ts#L30) diff --git a/website/versioned_docs/version-v1.2/typedoc/crypto/interfaces/Signature.md b/website/versioned_docs/version-v1.2/typedoc/crypto/interfaces/Signature.md new file mode 100644 index 0000000000..b5bdc23e84 --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/crypto/interfaces/Signature.md @@ -0,0 +1,37 @@ +--- +title: Signature +sidebar_label: Signature +--- + +## Type parameters + +| Name | Type | +| :--- | :--------------- | +| `N` | `SnarkBigNumber` | + +## Table of contents + +### Properties + +- [R8](Signature.md#r8) +- [S](Signature.md#s) + +## Properties + +### R8 + +• **R8**: [`Point`](../modules.md#point)\<`N`\> + +#### Defined in + +[crypto/ts/types.ts:48](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/types.ts#L48) + +--- + +### S + +• **S**: `N` + +#### Defined in + +[crypto/ts/types.ts:49](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/types.ts#L49) diff --git a/website/versioned_docs/version-v1.2/typedoc/crypto/modules.md b/website/versioned_docs/version-v1.2/typedoc/crypto/modules.md new file mode 100644 index 0000000000..05cea08eeb --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/crypto/modules.md @@ -0,0 +1,913 @@ +--- +title: Crypto Module +sidebar_label: module +sidebar_position: 1 +--- + +## Table of contents + +### Classes + +- [AccQueue](classes/AccQueue.md) +- [G1Point](classes/G1Point.md) +- [G2Point](classes/G2Point.md) +- [IncrementalQuinTree](classes/IncrementalQuinTree.md) + +### Interfaces + +- [Keypair](interfaces/Keypair.md) +- [PoseidonFuncs](interfaces/PoseidonFuncs.md) +- [Queue](interfaces/Queue.md) +- [Signature](interfaces/Signature.md) + +### Type Aliases + +- [Ciphertext](modules.md#ciphertext) +- [EcdhSharedKey](modules.md#ecdhsharedkey) +- [Leaf](modules.md#leaf) +- [PathElements](modules.md#pathelements) +- [Plaintext](modules.md#plaintext) +- [Point](modules.md#point) +- [PrivKey](modules.md#privkey) +- [PubKey](modules.md#pubkey) + +### Variables + +- [NOTHING_UP_MY_SLEEVE](modules.md#nothing_up_my_sleeve) +- [SNARK_FIELD_SIZE](modules.md#snark_field_size) + +### Functions + +- [bigInt2Buffer](modules.md#bigint2buffer) +- [calcDepthFromNumLeaves](modules.md#calcdepthfromnumleaves) +- [deepCopyBigIntArray](modules.md#deepcopybigintarray) +- [formatPrivKeyForBabyJub](modules.md#formatprivkeyforbabyjub) +- [genEcdhSharedKey](modules.md#genecdhsharedkey) +- [genKeypair](modules.md#genkeypair) +- [genPrivKey](modules.md#genprivkey) +- [genPubKey](modules.md#genpubkey) +- [genRandomBabyJubValue](modules.md#genrandombabyjubvalue) +- [genRandomSalt](modules.md#genrandomsalt) +- [genTreeCommitment](modules.md#gentreecommitment) +- [genTreeProof](modules.md#gentreeproof) +- [hash13](modules.md#hash13) +- [hash2](modules.md#hash2) +- [hash3](modules.md#hash3) +- [hash4](modules.md#hash4) +- [hash5](modules.md#hash5) +- [hashLeftRight](modules.md#hashleftright) +- [hashN](modules.md#hashn) +- [hashOne](modules.md#hashone) +- [packPubKey](modules.md#packpubkey) +- [poseidonDecrypt](modules.md#poseidondecrypt) +- [poseidonDecryptWithoutCheck](modules.md#poseidondecryptwithoutcheck) +- [poseidonEncrypt](modules.md#poseidonencrypt) +- [sha256Hash](modules.md#sha256hash) +- [sign](modules.md#sign) +- [stringifyBigInts](modules.md#stringifybigints) +- [unpackPubKey](modules.md#unpackpubkey) +- [unstringifyBigInts](modules.md#unstringifybigints) +- [verifySignature](modules.md#verifysignature) + +## Type Aliases + +### Ciphertext + +Ƭ **Ciphertext**\<`N`\>: `N`[] + +#### Type parameters + +| Name | Type | +| :--- | :------- | +| `N` | `bigint` | + +#### Defined in + +[crypto/ts/types.ts:21](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/types.ts#L21) + +--- + +### EcdhSharedKey + +Ƭ **EcdhSharedKey**\<`N`\>: [`N`, `N`] + +#### Type parameters + +| Name | Type | +| :--- | :------- | +| `N` | `bigint` | + +#### Defined in + +[crypto/ts/types.ts:12](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/types.ts#L12) + +--- + +### Leaf + +Ƭ **Leaf**: `bigint` + +#### Defined in + +[crypto/ts/types.ts:64](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/types.ts#L64) + +--- + +### PathElements + +Ƭ **PathElements**: `bigint`[][] + +#### Defined in + +[crypto/ts/types.ts:24](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/types.ts#L24) + +--- + +### Plaintext + +Ƭ **Plaintext**\<`N`\>: `N`[] + +#### Type parameters + +| Name | Type | +| :--- | :------- | +| `N` | `bigint` | + +#### Defined in + +[crypto/ts/types.ts:18](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/types.ts#L18) + +--- + +### Point + +Ƭ **Point**\<`N`\>: [`N`, `N`] + +#### Type parameters + +| Name | Type | +| :--- | :--------------- | +| `N` | `SnarkBigNumber` | + +#### Defined in + +[crypto/ts/types.ts:15](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/types.ts#L15) + +--- + +### PrivKey + +Ƭ **PrivKey**: `SnarkBigNumber` + +#### Defined in + +[crypto/ts/types.ts:6](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/types.ts#L6) + +--- + +### PubKey + +Ƭ **PubKey**\<`N`\>: [`N`, `N`] + +#### Type parameters + +| Name | Type | +| :--- | :------- | +| `N` | `bigint` | + +#### Defined in + +[crypto/ts/types.ts:9](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/types.ts#L9) + +## Variables + +### NOTHING_UP_MY_SLEEVE + +• `Const` **NOTHING_UP_MY_SLEEVE**: `bigint` + +#### Defined in + +[crypto/ts/constants.ts:10](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/constants.ts#L10) + +--- + +### SNARK_FIELD_SIZE + +• `Const` **SNARK_FIELD_SIZE**: `bigint` = `r` + +#### Defined in + +[crypto/ts/constants.ts:6](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/constants.ts#L6) + +## Functions + +### bigInt2Buffer + +▸ **bigInt2Buffer**(`i`): `Buffer` + +Convert a BigInt to a Buffer + +#### Parameters + +| Name | Type | Description | +| :--- | :------- | :-------------------- | +| `i` | `bigint` | the bigint to convert | + +#### Returns + +`Buffer` + +the buffer + +#### Defined in + +[crypto/ts/bigIntUtils.ts:127](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/bigIntUtils.ts#L127) + +--- + +### calcDepthFromNumLeaves + +▸ **calcDepthFromNumLeaves**(`hashLength`, `numLeaves`): `number` + +Calculate the depth of a tree given the number of leaves + +#### Parameters + +| Name | Type | Description | +| :----------- | :------- | :-------------------------------- | +| `hashLength` | `number` | the hashing function param length | +| `numLeaves` | `number` | how many leaves | + +#### Returns + +`number` + +the depth + +#### Defined in + +[crypto/ts/utils.ts:10](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/utils.ts#L10) + +--- + +### deepCopyBigIntArray + +▸ **deepCopyBigIntArray**(`arr`): `bigint`[] + +Create a copy of a bigint array + +#### Parameters + +| Name | Type | Description | +| :---- | :--------- | :--------------------------- | +| `arr` | `bigint`[] | the array of bigints to copy | + +#### Returns + +`bigint`[] + +a deep copy of the array + +#### Defined in + +[crypto/ts/bigIntUtils.ts:110](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/bigIntUtils.ts#L110) + +--- + +### formatPrivKeyForBabyJub + +▸ **formatPrivKeyForBabyJub**(`privKey`): `bigint` + +An internal function which formats a random private key to be compatible +with the BabyJub curve. This is the format which should be passed into the +PubKey and other circuits. + +#### Parameters + +| Name | Type | Description | +| :-------- | :--------------- | :----------------------------------------- | +| `privKey` | `SnarkBigNumber` | A private key generated using genPrivKey() | + +#### Returns + +`bigint` + +A BabyJub-compatible private key. + +#### Defined in + +[crypto/ts/keys.ts:28](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/keys.ts#L28) + +--- + +### genEcdhSharedKey + +▸ **genEcdhSharedKey**(`privKey`, `pubKey`): [`EcdhSharedKey`](modules.md#ecdhsharedkey) + +Generates an Elliptic-Curve Diffie–Hellman (ECDH) shared key given a private +key and a public key. + +#### Parameters + +| Name | Type | Description | +| :-------- | :---------------------------- | :----------------------------------------- | +| `privKey` | `SnarkBigNumber` | A private key generated using genPrivKey() | +| `pubKey` | [`PubKey`](modules.md#pubkey) | A public key generated using genPubKey() | + +#### Returns + +[`EcdhSharedKey`](modules.md#ecdhsharedkey) + +The ECDH shared key. + +#### Defined in + +[crypto/ts/keys.ts:76](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/keys.ts#L76) + +--- + +### genKeypair + +▸ **genKeypair**(): [`Keypair`](interfaces/Keypair.md) + +Generates a keypair. + +#### Returns + +[`Keypair`](interfaces/Keypair.md) + +a keypair + +#### Defined in + +[crypto/ts/keys.ts:60](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/keys.ts#L60) + +--- + +### genPrivKey + +▸ **genPrivKey**(): `bigint` + +Generate a private key + +#### Returns + +`bigint` + +A random seed for a private key. + +#### Defined in + +[crypto/ts/keys.ts:13](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/keys.ts#L13) + +--- + +### genPubKey + +▸ **genPubKey**(`privKey`): [`PubKey`](modules.md#pubkey) + +#### Parameters + +| Name | Type | Description | +| :-------- | :--------------- | :----------------------------------------- | +| `privKey` | `SnarkBigNumber` | A private key generated using genPrivKey() | + +#### Returns + +[`PubKey`](modules.md#pubkey) + +A public key associated with the private key + +#### Defined in + +[crypto/ts/keys.ts:51](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/keys.ts#L51) + +--- + +### genRandomBabyJubValue + +▸ **genRandomBabyJubValue**(): `bigint` + +Returns a BabyJub-compatible random value. We create it by first generating +a random value (initially 256 bits large) modulo the snark field size as +described in EIP197. This results in a key size of roughly 253 bits and no +more than 254 bits. To prevent modulo bias, we then use this efficient +algorithm: +http://cvsweb.openbsd.org/cgi-bin/cvsweb/~checkout~/src/lib/libc/crypt/arc4random_uniform.c + +#### Returns + +`bigint` + +A BabyJub-compatible random value. + +#### Defined in + +[crypto/ts/babyjub.ts:115](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/babyjub.ts#L115) + +--- + +### genRandomSalt + +▸ **genRandomSalt**(): `bigint` + +Generate a random value + +#### Returns + +`bigint` + +A BabyJub-compatible salt. + +#### Defined in + +[crypto/ts/keys.ts:19](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/keys.ts#L19) + +--- + +### genTreeCommitment + +▸ **genTreeCommitment**(`leaves`, `salt`, `depth`): `bigint` + +A helper function which hashes a list of results with a salt and returns the +hash. + +#### Parameters + +| Name | Type | Description | +| :------- | :--------- | :--------------- | +| `leaves` | `bigint`[] | A list of values | +| `salt` | `bigint` | A random salt | +| `depth` | `number` | The tree depth | + +#### Returns + +`bigint` + +The hash of the leaves and the salt, with the salt last + +#### Defined in + +[crypto/ts/utils.ts:30](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/utils.ts#L30) + +--- + +### genTreeProof + +▸ **genTreeProof**(`index`, `leaves`, `depth`): `bigint`[][] + +A helper function to generate the tree proof for the value at the given index in the leaves + +#### Parameters + +| Name | Type | Description | +| :------- | :--------- | :----------------------------------------------- | +| `index` | `number` | The index of the value to generate the proof for | +| `leaves` | `bigint`[] | A list of values | +| `depth` | `number` | The tree depth | + +#### Returns + +`bigint`[][] + +The proof + +#### Defined in + +[crypto/ts/utils.ts:47](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/utils.ts#L47) + +--- + +### hash13 + +▸ **hash13**(`elements`): `bigint` + +A convenience function to use Poseidon to hash a Plaintext with +no more than 13 elements + +#### Parameters + +| Name | Type | Description | +| :--------- | :---------------------------------- | :------------------- | +| `elements` | [`Plaintext`](modules.md#plaintext) | The elements to hash | + +#### Returns + +`bigint` + +The hash of the elements + +#### Defined in + +[crypto/ts/hashing.ts:130](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/hashing.ts#L130) + +--- + +### hash2 + +▸ **hash2**(`elements`): `bigint` + +#### Parameters + +| Name | Type | +| :--------- | :---------------------------------- | +| `elements` | [`Plaintext`](modules.md#plaintext) | + +#### Returns + +`bigint` + +#### Defined in + +[crypto/ts/hashing.ts:119](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/hashing.ts#L119) + +--- + +### hash3 + +▸ **hash3**(`elements`): `bigint` + +#### Parameters + +| Name | Type | +| :--------- | :---------------------------------- | +| `elements` | [`Plaintext`](modules.md#plaintext) | + +#### Returns + +`bigint` + +#### Defined in + +[crypto/ts/hashing.ts:120](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/hashing.ts#L120) + +--- + +### hash4 + +▸ **hash4**(`elements`): `bigint` + +#### Parameters + +| Name | Type | +| :--------- | :---------------------------------- | +| `elements` | [`Plaintext`](modules.md#plaintext) | + +#### Returns + +`bigint` + +#### Defined in + +[crypto/ts/hashing.ts:121](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/hashing.ts#L121) + +--- + +### hash5 + +▸ **hash5**(`elements`): `bigint` + +#### Parameters + +| Name | Type | +| :--------- | :---------------------------------- | +| `elements` | [`Plaintext`](modules.md#plaintext) | + +#### Returns + +`bigint` + +#### Defined in + +[crypto/ts/hashing.ts:122](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/hashing.ts#L122) + +--- + +### hashLeftRight + +▸ **hashLeftRight**(`left`, `right`): `bigint` + +Hash two BigInts with the Poseidon hash function + +#### Parameters + +| Name | Type | Description | +| :------ | :------- | :----------------------------- | +| `left` | `bigint` | The left-hand element to hash | +| `right` | `bigint` | The right-hand element to hash | + +#### Returns + +`bigint` + +The hash of the two elements + +#### Defined in + +[crypto/ts/hashing.ts:85](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/hashing.ts#L85) + +--- + +### hashN + +▸ **hashN**(`numElements`, `elements`): `bigint` + +Hash up to N elements + +#### Parameters + +| Name | Type | Description | +| :------------ | :---------------------------------- | :----------------------------- | +| `numElements` | `number` | The number of elements to hash | +| `elements` | [`Plaintext`](modules.md#plaintext) | The elements to hash | + +#### Returns + +`bigint` + +The hash of the elements + +#### Defined in + +[crypto/ts/hashing.ts:101](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/hashing.ts#L101) + +--- + +### hashOne + +▸ **hashOne**(`preImage`): `bigint` + +Hash a single BigInt with the Poseidon hash function + +#### Parameters + +| Name | Type | Description | +| :--------- | :------- | :------------------ | +| `preImage` | `bigint` | The element to hash | + +#### Returns + +`bigint` + +The hash of the element + +#### Defined in + +[crypto/ts/hashing.ts:160](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/hashing.ts#L160) + +--- + +### packPubKey + +▸ **packPubKey**(`pubKey`): `bigint` + +Losslessly reduces the size of the representation of a public key + +#### Parameters + +| Name | Type | Description | +| :------- | :---------------------------- | :--------------------- | +| `pubKey` | [`PubKey`](modules.md#pubkey) | The public key to pack | + +#### Returns + +`bigint` + +A packed public key + +#### Defined in + +[crypto/ts/keys.ts:35](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/keys.ts#L35) + +--- + +### poseidonDecrypt + +▸ **poseidonDecrypt**(`ciphertext`, `key`, `nonce`, `length`): `PlainText`\<`bigint`\> + +Decrypt some ciphertext using poseidon encryption + +#### Parameters + +| Name | Type | Description | +| :----------- | :-------------------------- | :-------------------------- | +| `ciphertext` | `CipherText`\<`bigint`\> | the ciphertext to decrypt | +| `key` | `EncryptionKey`\<`bigint`\> | the key to decrypt with | +| `nonce` | `bigint` | the nonce used to encrypt | +| `length` | `number` | the length of the plaintext | + +#### Returns + +`PlainText`\<`bigint`\> + +the plaintext + +#### Defined in + +node_modules/.pnpm/@zk-kit+poseidon-cipher@0.2.1/node_modules/@zk-kit/poseidon-cipher/dist/types/poseidonCipher.d.ts:18 + +--- + +### poseidonDecryptWithoutCheck + +▸ **poseidonDecryptWithoutCheck**(`ciphertext`, `key`, `nonce`, `length`): `PlainText`\<`bigint`\> + +Decrypt some ciphertext using poseidon encryption + +#### Parameters + +| Name | Type | Description | +| :----------- | :-------------------------- | :-------------------------- | +| `ciphertext` | `CipherText`\<`bigint`\> | the ciphertext to decrypt | +| `key` | `EncryptionKey`\<`bigint`\> | the key to decrypt with | +| `nonce` | `bigint` | the nonce used to encrypt | +| `length` | `number` | the length of the plaintext | + +#### Returns + +`PlainText`\<`bigint`\> + +the plaintext + +**`Dev`** + +Do not throw if the plaintext is invalid + +#### Defined in + +node_modules/.pnpm/@zk-kit+poseidon-cipher@0.2.1/node_modules/@zk-kit/poseidon-cipher/dist/types/poseidonCipher.d.ts:28 + +--- + +### poseidonEncrypt + +▸ **poseidonEncrypt**(`msg`, `key`, `nonce`): `CipherText`\<`bigint`\> + +Encrypt some plaintext using poseidon encryption + +#### Parameters + +| Name | Type | Description | +| :------ | :-------------------------- | :-------------------------------- | +| `msg` | `PlainText`\<`bigint`\> | the message to encrypt | +| `key` | `EncryptionKey`\<`bigint`\> | the key to encrypt with | +| `nonce` | `bigint` | the nonce to avoid replay attacks | + +#### Returns + +`CipherText`\<`bigint`\> + +the ciphertext + +#### Defined in + +node_modules/.pnpm/@zk-kit+poseidon-cipher@0.2.1/node_modules/@zk-kit/poseidon-cipher/dist/types/poseidonCipher.d.ts:9 + +--- + +### sha256Hash + +▸ **sha256Hash**(`input`): `bigint` + +Hash an array of uint256 values the same way that the EVM does. + +#### Parameters + +| Name | Type | Description | +| :------ | :--------- | :-------------------------- | +| `input` | `bigint`[] | the array of values to hash | + +#### Returns + +`bigint` + +a EVM compatible sha256 hash + +#### Defined in + +[crypto/ts/hashing.ts:15](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/hashing.ts#L15) + +--- + +### sign + +▸ **sign**(`privateKey`, `message`): `Signature`\<`string`\> + +Signs a message using the provided private key, employing Poseidon hashing and +EdDSA with the Baby Jubjub elliptic curve. + +#### Parameters + +| Name | Type | Description | +| :----------- | :------------- | :---------------------------------------- | +| `privateKey` | `BigNumberish` | The private key used to sign the message. | +| `message` | `BigNumberish` | The message to be signed. | + +#### Returns + +`Signature`\<`string`\> + +The signature object, containing properties relevant to EdDSA signatures, such as 'R8' and 'S' values. + +#### Defined in + +node_modules/.pnpm/@zk-kit+eddsa-poseidon@0.5.1/node_modules/@zk-kit/eddsa-poseidon/dist/types/eddsa-poseidon.d.ts:32 + +--- + +### stringifyBigInts + +▸ **stringifyBigInts**(`input`): `StringifiedBigInts` + +Given an input of bigint values, convert them to their string representations + +#### Parameters + +| Name | Type | Description | +| :------ | :--------------- | :------------------- | +| `input` | `BigIntVariants` | The input to convert | + +#### Returns + +`StringifiedBigInts` + +The input with bigint values converted to string + +#### Defined in + +[crypto/ts/bigIntUtils.ts:78](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/bigIntUtils.ts#L78) + +--- + +### unpackPubKey + +▸ **unpackPubKey**(`packed`): [`PubKey`](modules.md#pubkey) + +Restores the original PubKey from its packed representation + +#### Parameters + +| Name | Type | Description | +| :------- | :------- | :------------------ | +| `packed` | `bigint` | The value to unpack | + +#### Returns + +[`PubKey`](modules.md#pubkey) + +The unpacked public key + +#### Defined in + +[crypto/ts/keys.ts:42](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/keys.ts#L42) + +--- + +### unstringifyBigInts + +▸ **unstringifyBigInts**(`input`): `BigIntVariants` + +Given an input containing string values, convert them +to bigint + +#### Parameters + +| Name | Type | Description | +| :------ | :------------------- | :------------------- | +| `input` | `StringifiedBigInts` | The input to convert | + +#### Returns + +`BigIntVariants` + +the input with string values converted to bigint + +#### Defined in + +[crypto/ts/bigIntUtils.ts:9](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/crypto/ts/bigIntUtils.ts#L9) + +--- + +### verifySignature + +▸ **verifySignature**(`message`, `signature`, `publicKey`): `boolean` + +Verifies an EdDSA signature using the Baby Jubjub elliptic curve and Poseidon hash function. + +#### Parameters + +| Name | Type | Description | +| :---------- | :------------- | :----------------------------------------------------------------------- | +| `message` | `BigNumberish` | The original message that was be signed. | +| `signature` | `Signature` | The EdDSA signature to be verified. | +| `publicKey` | `Point` | The public key associated with the private key used to sign the message. | + +#### Returns + +`boolean` + +Returns true if the signature is valid and corresponds to the message and public key, false otherwise. + +#### Defined in + +node_modules/.pnpm/@zk-kit+eddsa-poseidon@0.5.1/node_modules/@zk-kit/eddsa-poseidon/dist/types/eddsa-poseidon.d.ts:40 diff --git a/website/versioned_docs/version-v1.2/typedoc/domainobjs/.nojekyll b/website/versioned_docs/version-v1.2/typedoc/domainobjs/.nojekyll new file mode 100644 index 0000000000..e2ac6616ad --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/domainobjs/.nojekyll @@ -0,0 +1 @@ +TypeDoc added this file to prevent GitHub Pages from using Jekyll. You can turn off this behavior by setting the `githubPages` option to false. \ No newline at end of file diff --git a/website/versioned_docs/version-v1.2/typedoc/domainobjs/classes/Ballot.md b/website/versioned_docs/version-v1.2/typedoc/domainobjs/classes/Ballot.md new file mode 100644 index 0000000000..bbdda4f7dd --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/domainobjs/classes/Ballot.md @@ -0,0 +1,274 @@ +--- +title: Ballot +sidebar_label: Ballot +--- + +A Ballot represents a User's votes in a Poll, as well as their next valid +nonce. + +## Table of contents + +### Constructors + +- [constructor](Ballot.md#constructor) + +### Properties + +- [nonce](Ballot.md#nonce) +- [voteOptionTreeDepth](Ballot.md#voteoptiontreedepth) +- [votes](Ballot.md#votes) + +### Methods + +- [asArray](Ballot.md#asarray) +- [asCircuitInputs](Ballot.md#ascircuitinputs) +- [copy](Ballot.md#copy) +- [equals](Ballot.md#equals) +- [hash](Ballot.md#hash) +- [toJSON](Ballot.md#tojson) +- [fromJSON](Ballot.md#fromjson) +- [genBlankBallot](Ballot.md#genblankballot) +- [genRandomBallot](Ballot.md#genrandomballot) + +## Constructors + +### constructor + +• **new Ballot**(`_numVoteOptions`, `_voteOptionTreeDepth`): [`Ballot`](Ballot.md) + +Create a new Ballot instance + +#### Parameters + +| Name | Type | Description | +| :--------------------- | :------- | :---------------------------------------------------- | +| `_numVoteOptions` | `number` | How many vote options are available in the poll | +| `_voteOptionTreeDepth` | `number` | The depth of the merkle tree holding the vote options | + +#### Returns + +[`Ballot`](Ballot.md) + +#### Defined in + +[ballot.ts:23](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/ballot.ts#L23) + +## Properties + +### nonce + +• **nonce**: `bigint` + +#### Defined in + +[ballot.ts:14](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/ballot.ts#L14) + +--- + +### voteOptionTreeDepth + +• **voteOptionTreeDepth**: `number` + +#### Defined in + +[ballot.ts:16](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/ballot.ts#L16) + +--- + +### votes + +• **votes**: `bigint`[] = `[]` + +#### Defined in + +[ballot.ts:12](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/ballot.ts#L12) + +## Methods + +### asArray + +▸ **asArray**(): `bigint`[] + +Convert in a an array of bigints + +#### Returns + +`bigint`[] + +the ballot as a bigint array + +**`Notice`** + +this is the nonce and the root of the vote option tree + +#### Defined in + +[ballot.ts:52](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/ballot.ts#L52) + +--- + +### asCircuitInputs + +▸ **asCircuitInputs**(): `bigint`[] + +Convert in a format suitable for the circuit + +#### Returns + +`bigint`[] + +the ballot as a BigInt array + +#### Defined in + +[ballot.ts:45](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/ballot.ts#L45) + +--- + +### copy + +▸ **copy**(): [`Ballot`](Ballot.md) + +Create a deep clone of this Ballot + +#### Returns + +[`Ballot`](Ballot.md) + +a copy of the ballot + +#### Defined in + +[ballot.ts:68](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/ballot.ts#L68) + +--- + +### equals + +▸ **equals**(`b`): `boolean` + +Check if two ballots are equal (same votes and same nonce) + +#### Parameters + +| Name | Type | Description | +| :--- | :-------------------- | :------------------------- | +| `b` | [`Ballot`](Ballot.md) | The ballot to compare with | + +#### Returns + +`boolean` + +whether the two ballots are equal + +#### Defined in + +[ballot.ts:81](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/ballot.ts#L81) + +--- + +### hash + +▸ **hash**(): `bigint` + +Generate an hash of this ballot + +#### Returns + +`bigint` + +The hash of the ballot + +#### Defined in + +[ballot.ts:36](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/ballot.ts#L36) + +--- + +### toJSON + +▸ **toJSON**(): [`IJsonBallot`](../interfaces/IJsonBallot.md) + +Serialize to a JSON object + +#### Returns + +[`IJsonBallot`](../interfaces/IJsonBallot.md) + +#### Defined in + +[ballot.ts:112](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/ballot.ts#L112) + +--- + +### fromJSON + +▸ **fromJSON**(`json`): [`Ballot`](Ballot.md) + +Deserialize into a Ballot instance + +#### Parameters + +| Name | Type | Description | +| :----- | :-------------------------------------------- | :---------------------- | +| `json` | [`IJsonBallot`](../interfaces/IJsonBallot.md) | the json representation | + +#### Returns + +[`Ballot`](Ballot.md) + +the deserialized object as a Ballot instance + +#### Defined in + +[ballot.ts:125](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/ballot.ts#L125) + +--- + +### genBlankBallot + +▸ **genBlankBallot**(`numVoteOptions`, `voteOptionTreeDepth`): [`Ballot`](Ballot.md) + +Generate a blank ballot + +#### Parameters + +| Name | Type | Description | +| :-------------------- | :------- | :--------------------------------------------------- | +| `numVoteOptions` | `number` | How many vote options are available | +| `voteOptionTreeDepth` | `number` | How deep is the merkle tree holding the vote options | + +#### Returns + +[`Ballot`](Ballot.md) + +a Blank Ballot object + +#### Defined in + +[ballot.ts:104](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/ballot.ts#L104) + +--- + +### genRandomBallot + +▸ **genRandomBallot**(`numVoteOptions`, `voteOptionTreeDepth`): [`Ballot`](Ballot.md) + +Generate a random ballot + +#### Parameters + +| Name | Type | Description | +| :-------------------- | :------- | :--------------------------------------------------- | +| `numVoteOptions` | `number` | How many vote options are available | +| `voteOptionTreeDepth` | `number` | How deep is the merkle tree holding the vote options | + +#### Returns + +[`Ballot`](Ballot.md) + +a random Ballot + +#### Defined in + +[ballot.ts:92](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/ballot.ts#L92) diff --git a/website/versioned_docs/version-v1.2/typedoc/domainobjs/classes/Keypair.md b/website/versioned_docs/version-v1.2/typedoc/domainobjs/classes/Keypair.md new file mode 100644 index 0000000000..bc815400ef --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/domainobjs/classes/Keypair.md @@ -0,0 +1,181 @@ +--- +title: Keypair +sidebar_label: Keypair +--- + +**`Notice`** + +A KeyPair is a pair of public and private keys +This is a MACI keypair, which is not to be +confused with an Ethereum public and private keypair. +A MACI keypair is comprised of a MACI public key and a MACI private key + +## Table of contents + +### Constructors + +- [constructor](Keypair.md#constructor) + +### Properties + +- [privKey](Keypair.md#privkey) +- [pubKey](Keypair.md#pubkey) + +### Methods + +- [copy](Keypair.md#copy) +- [equals](Keypair.md#equals) +- [toJSON](Keypair.md#tojson) +- [fromJSON](Keypair.md#fromjson) +- [genEcdhSharedKey](Keypair.md#genecdhsharedkey) + +## Constructors + +### constructor + +• **new Keypair**(`privKey?`): [`Keypair`](Keypair.md) + +Create a new instance of a Keypair + +#### Parameters + +| Name | Type | Description | +| :--------- | :---------------------- | :------------------------- | +| `privKey?` | [`PrivKey`](PrivKey.md) | the private key (optional) | + +#### Returns + +[`Keypair`](Keypair.md) + +**`Notice`** + +if no privKey is passed, it will automatically generate a new private key + +#### Defined in + +[keyPair.ts:26](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/keyPair.ts#L26) + +## Properties + +### privKey + +• **privKey**: [`PrivKey`](PrivKey.md) + +#### Defined in + +[keyPair.ts:17](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/keyPair.ts#L17) + +--- + +### pubKey + +• **pubKey**: [`PubKey`](PubKey.md) + +#### Defined in + +[keyPair.ts:19](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/keyPair.ts#L19) + +## Methods + +### copy + +▸ **copy**(): [`Keypair`](Keypair.md) + +Create a deep clone of this Keypair + +#### Returns + +[`Keypair`](Keypair.md) + +a copy of the Keypair + +#### Defined in + +[keyPair.ts:41](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/keyPair.ts#L41) + +--- + +### equals + +▸ **equals**(`keypair`): `boolean` + +Check whether two Keypairs are equal + +#### Parameters + +| Name | Type | Description | +| :-------- | :---------------------- | :-------------------------- | +| `keypair` | [`Keypair`](Keypair.md) | the keypair to compare with | + +#### Returns + +`boolean` + +whether they are equal or not + +#### Defined in + +[keyPair.ts:58](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/keyPair.ts#L58) + +--- + +### toJSON + +▸ **toJSON**(): [`IJsonKeyPair`](../interfaces/IJsonKeyPair.md) + +Serialize into a JSON object + +#### Returns + +[`IJsonKeyPair`](../interfaces/IJsonKeyPair.md) + +#### Defined in + +[keyPair.ts:75](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/keyPair.ts#L75) + +--- + +### fromJSON + +▸ **fromJSON**(`json`): [`Keypair`](Keypair.md) + +Deserialize into a Keypair instance + +#### Parameters + +| Name | Type | +| :----- | :---------------------------------------------- | +| `json` | [`IJsonKeyPair`](../interfaces/IJsonKeyPair.md) | + +#### Returns + +[`Keypair`](Keypair.md) + +a keypair instance + +#### Defined in + +[keyPair.ts:87](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/keyPair.ts#L87) + +--- + +### genEcdhSharedKey + +▸ **genEcdhSharedKey**(`privKey`, `pubKey`): `EcdhSharedKey` + +Generate a shared key + +#### Parameters + +| Name | Type | +| :-------- | :---------------------- | +| `privKey` | [`PrivKey`](PrivKey.md) | +| `pubKey` | [`PubKey`](PubKey.md) | + +#### Returns + +`EcdhSharedKey` + +#### Defined in + +[keyPair.ts:49](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/keyPair.ts#L49) diff --git a/website/versioned_docs/version-v1.2/typedoc/domainobjs/classes/Message.md b/website/versioned_docs/version-v1.2/typedoc/domainobjs/classes/Message.md new file mode 100644 index 0000000000..fbfa9c6a36 --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/domainobjs/classes/Message.md @@ -0,0 +1,244 @@ +--- +title: Message +sidebar_label: Message +--- + +**`Notice`** + +An encrypted command and signature. + +## Table of contents + +### Constructors + +- [constructor](Message.md#constructor) + +### Properties + +- [data](Message.md#data) +- [msgType](Message.md#msgtype) +- [DATA_LENGTH](Message.md#data_length) + +### Methods + +- [asArray](Message.md#asarray) +- [asCircuitInputs](Message.md#ascircuitinputs) +- [asContractParam](Message.md#ascontractparam) +- [copy](Message.md#copy) +- [equals](Message.md#equals) +- [hash](Message.md#hash) +- [toJSON](Message.md#tojson) +- [fromJSON](Message.md#fromjson) + +## Constructors + +### constructor + +• **new Message**(`msgType`, `data`): [`Message`](Message.md) + +Create a new instance of a Message + +#### Parameters + +| Name | Type | Description | +| :-------- | :--------- | :---------------------- | +| `msgType` | `bigint` | the type of the message | +| `data` | `bigint`[] | the data of the message | + +#### Returns + +[`Message`](Message.md) + +#### Defined in + +[message.ts:23](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/message.ts#L23) + +## Properties + +### data + +• **data**: `bigint`[] + +#### Defined in + +[message.ts:14](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/message.ts#L14) + +--- + +### msgType + +• **msgType**: `bigint` + +#### Defined in + +[message.ts:12](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/message.ts#L12) + +--- + +### DATA_LENGTH + +▪ `Static` **DATA_LENGTH**: `number` = `10` + +#### Defined in + +[message.ts:16](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/message.ts#L16) + +## Methods + +### asArray + +▸ **asArray**(): `bigint`[] + +Return the message as an array of bigints + +#### Returns + +`bigint`[] + +the message as an array of bigints + +#### Defined in + +[message.ts:33](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/message.ts#L33) + +--- + +### asCircuitInputs + +▸ **asCircuitInputs**(): `bigint`[] + +Return the message as a circuit input + +#### Returns + +`bigint`[] + +the message as a circuit input + +#### Defined in + +[message.ts:48](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/message.ts#L48) + +--- + +### asContractParam + +▸ **asContractParam**(): [`IMessageContractParams`](../interfaces/IMessageContractParams.md) + +Return the message as a contract param + +#### Returns + +[`IMessageContractParams`](../interfaces/IMessageContractParams.md) + +the message as a contract param + +#### Defined in + +[message.ts:39](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/message.ts#L39) + +--- + +### copy + +▸ **copy**(): [`Message`](Message.md) + +Create a copy of the message + +#### Returns + +[`Message`](Message.md) + +a copy of the message + +#### Defined in + +[message.ts:61](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/message.ts#L61) + +--- + +### equals + +▸ **equals**(`m`): `boolean` + +Check if two messages are equal + +#### Parameters + +| Name | Type | Description | +| :--- | :---------------------- | :-------------------------- | +| `m` | [`Message`](Message.md) | the message to compare with | + +#### Returns + +`boolean` + +the result of the comparison + +#### Defined in + +[message.ts:72](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/message.ts#L72) + +--- + +### hash + +▸ **hash**(`encPubKey`): `bigint` + +Hash the message data and a public key + +#### Parameters + +| Name | Type | Description | +| :---------- | :-------------------- | :-------------------------------------------------- | +| `encPubKey` | [`PubKey`](PubKey.md) | the public key that is used to encrypt this message | + +#### Returns + +`bigint` + +the hash of the message data and the public key + +#### Defined in + +[message.ts:55](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/message.ts#L55) + +--- + +### toJSON + +▸ **toJSON**(): [`IMessageContractParams`](../interfaces/IMessageContractParams.md) + +Serialize to a JSON object + +#### Returns + +[`IMessageContractParams`](../interfaces/IMessageContractParams.md) + +#### Defined in + +[message.ts:86](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/message.ts#L86) + +--- + +### fromJSON + +▸ **fromJSON**(`json`): [`Message`](Message.md) + +Deserialize into a Message instance + +#### Parameters + +| Name | Type | Description | +| :----- | :------------------------------------------------------------------ | :---------------------- | +| `json` | [`IMessageContractParams`](../interfaces/IMessageContractParams.md) | the json representation | + +#### Returns + +[`Message`](Message.md) + +the deserialized object as a Message instance + +#### Defined in + +[message.ts:95](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/message.ts#L95) diff --git a/website/versioned_docs/version-v1.2/typedoc/domainobjs/classes/PCommand.md b/website/versioned_docs/version-v1.2/typedoc/domainobjs/classes/PCommand.md new file mode 100644 index 0000000000..b5c4d972e6 --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/domainobjs/classes/PCommand.md @@ -0,0 +1,409 @@ +--- +title: PCommand +sidebar_label: PCommand +--- + +**`Notice`** + +Unencrypted data whose fields include the user's public key, vote etc. +This represents a Vote command. + +## Implements + +- [`ICommand`](../interfaces/ICommand.md) + +## Table of contents + +### Constructors + +- [constructor](PCommand.md#constructor) + +### Properties + +- [cmdType](PCommand.md#cmdtype) +- [newPubKey](PCommand.md#newpubkey) +- [newVoteWeight](PCommand.md#newvoteweight) +- [nonce](PCommand.md#nonce) +- [pollId](PCommand.md#pollid) +- [salt](PCommand.md#salt) +- [stateIndex](PCommand.md#stateindex) +- [voteOptionIndex](PCommand.md#voteoptionindex) + +### Methods + +- [asArray](PCommand.md#asarray) +- [asCircuitInputs](PCommand.md#ascircuitinputs) +- [copy](PCommand.md#copy) +- [encrypt](PCommand.md#encrypt) +- [equals](PCommand.md#equals) +- [hash](PCommand.md#hash) +- [sign](PCommand.md#sign) +- [toJSON](PCommand.md#tojson) +- [verifySignature](PCommand.md#verifysignature) +- [decrypt](PCommand.md#decrypt) +- [fromJSON](PCommand.md#fromjson) + +## Constructors + +### constructor + +• **new PCommand**(`stateIndex`, `newPubKey`, `voteOptionIndex`, `newVoteWeight`, `nonce`, `pollId`, `salt?`): [`PCommand`](PCommand.md) + +Create a new PCommand + +#### Parameters + +| Name | Type | Description | +| :---------------- | :-------------------- | :------------------------------ | +| `stateIndex` | `bigint` | the state index of the user | +| `newPubKey` | [`PubKey`](PubKey.md) | the new public key of the user | +| `voteOptionIndex` | `bigint` | the index of the vote option | +| `newVoteWeight` | `bigint` | the new vote weight of the user | +| `nonce` | `bigint` | the nonce of the message | +| `pollId` | `bigint` | the poll ID | +| `salt` | `bigint` | the salt of the message | + +#### Returns + +[`PCommand`](PCommand.md) + +#### Defined in + +[commands/PCommand.ts:59](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/commands/PCommand.ts#L59) + +## Properties + +### cmdType + +• **cmdType**: `bigint` + +#### Implementation of + +[ICommand](../interfaces/ICommand.md).[cmdType](../interfaces/ICommand.md#cmdtype) + +#### Defined in + +[commands/PCommand.ts:33](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/commands/PCommand.ts#L33) + +--- + +### newPubKey + +• **newPubKey**: [`PubKey`](PubKey.md) + +#### Defined in + +[commands/PCommand.ts:37](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/commands/PCommand.ts#L37) + +--- + +### newVoteWeight + +• **newVoteWeight**: `bigint` + +#### Defined in + +[commands/PCommand.ts:41](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/commands/PCommand.ts#L41) + +--- + +### nonce + +• **nonce**: `bigint` + +#### Defined in + +[commands/PCommand.ts:43](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/commands/PCommand.ts#L43) + +--- + +### pollId + +• **pollId**: `bigint` + +#### Defined in + +[commands/PCommand.ts:45](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/commands/PCommand.ts#L45) + +--- + +### salt + +• **salt**: `bigint` + +#### Defined in + +[commands/PCommand.ts:47](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/commands/PCommand.ts#L47) + +--- + +### stateIndex + +• **stateIndex**: `bigint` + +#### Defined in + +[commands/PCommand.ts:35](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/commands/PCommand.ts#L35) + +--- + +### voteOptionIndex + +• **voteOptionIndex**: `bigint` + +#### Defined in + +[commands/PCommand.ts:39](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/commands/PCommand.ts#L39) + +## Methods + +### asArray + +▸ **asArray**(): `bigint`[] + +#### Returns + +`bigint`[] + +bigint[] - the command as an array + +**`Notice`** + +Returns this Command as an array. Note that 5 of the Command's fields +are packed into a single 250-bit value. This allows Messages to be +smaller and thereby save gas when the user publishes a message. + +#### Defined in + +[commands/PCommand.ts:107](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/commands/PCommand.ts#L107) + +--- + +### asCircuitInputs + +▸ **asCircuitInputs**(): `bigint`[] + +#### Returns + +`bigint`[] + +#### Defined in + +[commands/PCommand.ts:123](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/commands/PCommand.ts#L123) + +--- + +### copy + +▸ **copy**\<`T`\>(): `T` + +Create a deep clone of this PCommand + +#### Type parameters + +| Name | Type | +| :--- | :-------------------------------- | +| `T` | extends [`PCommand`](PCommand.md) | + +#### Returns + +`T` + +a copy of the PCommand + +#### Implementation of + +[ICommand](../interfaces/ICommand.md).[copy](../interfaces/ICommand.md#copy) + +#### Defined in + +[commands/PCommand.ts:90](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/commands/PCommand.ts#L90) + +--- + +### encrypt + +▸ **encrypt**(`signature`, `sharedKey`): [`Message`](Message.md) + +#### Parameters + +| Name | Type | +| :---------- | :------------------------------ | +| `signature` | `Signature`\<`SnarkBigNumber`\> | +| `sharedKey` | `EcdhSharedKey` | + +#### Returns + +[`Message`](Message.md) + +**`Notice`** + +Encrypts this command along with a signature to produce a Message. +To save gas, we can constrain the following values to 50 bits and pack +them into a 250-bit value: 0. state index 3. vote option index 4. new vote weight 5. nonce 6. poll ID + +#### Defined in + +[commands/PCommand.ts:162](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/commands/PCommand.ts#L162) + +--- + +### equals + +▸ **equals**(`command`): `boolean` + +#### Parameters + +| Name | Type | +| :-------- | :------------------------ | +| `command` | [`PCommand`](PCommand.md) | + +#### Returns + +`boolean` + +#### Implementation of + +[ICommand](../interfaces/ICommand.md).[equals](../interfaces/ICommand.md#equals) + +#### Defined in + +[commands/PCommand.ts:128](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/commands/PCommand.ts#L128) + +--- + +### hash + +▸ **hash**(): `bigint` + +#### Returns + +`bigint` + +#### Defined in + +[commands/PCommand.ts:137](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/commands/PCommand.ts#L137) + +--- + +### sign + +▸ **sign**(`privKey`): `Signature`\<`SnarkBigNumber`\> + +#### Parameters + +| Name | Type | +| :-------- | :---------------------- | +| `privKey` | [`PrivKey`](PrivKey.md) | + +#### Returns + +`Signature`\<`SnarkBigNumber`\> + +**`Notice`** + +Signs this command and returns a Signature. + +#### Defined in + +[commands/PCommand.ts:142](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/commands/PCommand.ts#L142) + +--- + +### toJSON + +▸ **toJSON**(): [`IJsonPCommand`](../interfaces/IJsonPCommand.md) + +Serialize into a JSON object + +#### Returns + +[`IJsonPCommand`](../interfaces/IJsonPCommand.md) + +#### Implementation of + +[ICommand](../interfaces/ICommand.md).[toJSON](../interfaces/ICommand.md#tojson) + +#### Defined in + +[commands/PCommand.ts:226](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/commands/PCommand.ts#L226) + +--- + +### verifySignature + +▸ **verifySignature**(`signature`, `pubKey`): `boolean` + +#### Parameters + +| Name | Type | +| :---------- | :------------------------------ | +| `signature` | `Signature`\<`SnarkBigNumber`\> | +| `pubKey` | [`PubKey`](PubKey.md) | + +#### Returns + +`boolean` + +**`Notice`** + +Returns true if the given signature is a correct signature of this +command and signed by the private key associated with the given public +key. + +#### Defined in + +[commands/PCommand.ts:149](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/commands/PCommand.ts#L149) + +--- + +### decrypt + +▸ **decrypt**(`message`, `sharedKey`, `force?`): `IDecryptMessage` + +Decrypts a Message to produce a Command. + +#### Parameters + +| Name | Type | Default value | Description | +| :---------- | :---------------------- | :------------ | :----------------------------------- | +| `message` | [`Message`](Message.md) | `undefined` | the message to decrypt | +| `sharedKey` | `EcdhSharedKey` | `undefined` | the shared key to use for decryption | +| `force` | `boolean` | `false` | whether to force decryption or not | + +#### Returns + +`IDecryptMessage` + +**`Dev`** + +You can force decrypt the message by setting `force` to true. +This is useful in case you don't want an invalid message to throw an error. + +#### Defined in + +[commands/PCommand.ts:182](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/commands/PCommand.ts#L182) + +--- + +### fromJSON + +▸ **fromJSON**(`json`): [`PCommand`](PCommand.md) + +Deserialize into a PCommand instance + +#### Parameters + +| Name | Type | +| :----- | :------------------------------------------------ | +| `json` | [`IJsonPCommand`](../interfaces/IJsonPCommand.md) | + +#### Returns + +[`PCommand`](PCommand.md) + +a PComamnd instance + +#### Defined in + +[commands/PCommand.ts:244](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/commands/PCommand.ts#L244) diff --git a/website/versioned_docs/version-v1.2/typedoc/domainobjs/classes/PrivKey.md b/website/versioned_docs/version-v1.2/typedoc/domainobjs/classes/PrivKey.md new file mode 100644 index 0000000000..050e80aaaf --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/domainobjs/classes/PrivKey.md @@ -0,0 +1,206 @@ +--- +title: PrivKey +sidebar_label: PrivKey +--- + +**`Notice`** + +PrivKey is a TS Class representing a MACI PrivateKey (on the jubjub curve) +This is a MACI private key, which is not to be +confused with an Ethereum private key. +A serialized MACI private key is prefixed by 'macisk.' +A raw MACI private key can be thought as a point on the baby jubjub curve + +## Table of contents + +### Constructors + +- [constructor](PrivKey.md#constructor) + +### Properties + +- [rawPrivKey](PrivKey.md#rawprivkey) + +### Methods + +- [asCircuitInputs](PrivKey.md#ascircuitinputs) +- [copy](PrivKey.md#copy) +- [serialize](PrivKey.md#serialize) +- [toJSON](PrivKey.md#tojson) +- [deserialize](PrivKey.md#deserialize) +- [fromJSON](PrivKey.md#fromjson) +- [isValidSerializedPrivKey](PrivKey.md#isvalidserializedprivkey) + +## Constructors + +### constructor + +• **new PrivKey**(`rawPrivKey`): [`PrivKey`](PrivKey.md) + +Generate a new Private key object + +#### Parameters + +| Name | Type | Description | +| :----------- | :--------------- | :----------------------------- | +| `rawPrivKey` | `SnarkBigNumber` | the raw private key (a bigint) | + +#### Returns + +[`PrivKey`](PrivKey.md) + +#### Defined in + +[privateKey.ts:21](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/privateKey.ts#L21) + +## Properties + +### rawPrivKey + +• **rawPrivKey**: `SnarkBigNumber` + +#### Defined in + +[privateKey.ts:15](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/privateKey.ts#L15) + +## Methods + +### asCircuitInputs + +▸ **asCircuitInputs**(): `string` + +Return this Private key as a circuit input + +#### Returns + +`string` + +the Private key as a circuit input + +#### Defined in + +[privateKey.ts:35](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/privateKey.ts#L35) + +--- + +### copy + +▸ **copy**(): [`PrivKey`](PrivKey.md) + +Create a copy of this Private key + +#### Returns + +[`PrivKey`](PrivKey.md) + +a copy of the Private key + +#### Defined in + +[privateKey.ts:29](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/privateKey.ts#L29) + +--- + +### serialize + +▸ **serialize**(): `string` + +Serialize the private key + +#### Returns + +`string` + +the serialized private key + +#### Defined in + +[privateKey.ts:41](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/privateKey.ts#L41) + +--- + +### toJSON + +▸ **toJSON**(): [`IJsonPrivateKey`](../modules.md#ijsonprivatekey) + +Serialize this object + +#### Returns + +[`IJsonPrivateKey`](../modules.md#ijsonprivatekey) + +#### Defined in + +[privateKey.ts:75](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/privateKey.ts#L75) + +--- + +### deserialize + +▸ **deserialize**(`s`): [`PrivKey`](PrivKey.md) + +Deserialize the private key + +#### Parameters + +| Name | Type | Description | +| :--- | :------- | :------------------------- | +| `s` | `string` | the serialized private key | + +#### Returns + +[`PrivKey`](PrivKey.md) + +the deserialized private key + +#### Defined in + +[privateKey.ts:55](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/privateKey.ts#L55) + +--- + +### fromJSON + +▸ **fromJSON**(`json`): [`PrivKey`](PrivKey.md) + +Deserialize this object from a JSON object + +#### Parameters + +| Name | Type | Description | +| :----- | :------------------------------------------------- | :-------------- | +| `json` | [`IJsonPrivateKey`](../modules.md#ijsonprivatekey) | the json object | + +#### Returns + +[`PrivKey`](PrivKey.md) + +the deserialized object as a PrivKey instance + +#### Defined in + +[privateKey.ts:86](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/privateKey.ts#L86) + +--- + +### isValidSerializedPrivKey + +▸ **isValidSerializedPrivKey**(`s`): `boolean` + +Check if the serialized private key is valid + +#### Parameters + +| Name | Type | Description | +| :--- | :------- | :------------------------- | +| `s` | `string` | the serialized private key | + +#### Returns + +`boolean` + +whether it is a valid serialized private key + +#### Defined in + +[privateKey.ts:65](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/privateKey.ts#L65) diff --git a/website/versioned_docs/version-v1.2/typedoc/domainobjs/classes/PubKey.md b/website/versioned_docs/version-v1.2/typedoc/domainobjs/classes/PubKey.md new file mode 100644 index 0000000000..01afbd00b4 --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/domainobjs/classes/PubKey.md @@ -0,0 +1,289 @@ +--- +title: PubKey +sidebar_label: PubKey +--- + +**`Notice`** + +A class representing a public key +This is a MACI public key, which is not to be +confused with an Ethereum public key. +A serialized MACI public key is prefixed by 'macipk.' +A raw MACI public key can be thought as a pair of +BigIntegers (x, y) representing a point on the baby jubjub curve + +## Table of contents + +### Constructors + +- [constructor](PubKey.md#constructor) + +### Properties + +- [rawPubKey](PubKey.md#rawpubkey) + +### Methods + +- [asArray](PubKey.md#asarray) +- [asCircuitInputs](PubKey.md#ascircuitinputs) +- [asContractParam](PubKey.md#ascontractparam) +- [copy](PubKey.md#copy) +- [equals](PubKey.md#equals) +- [hash](PubKey.md#hash) +- [serialize](PubKey.md#serialize) +- [toJSON](PubKey.md#tojson) +- [deserialize](PubKey.md#deserialize) +- [fromJSON](PubKey.md#fromjson) +- [isValidSerializedPubKey](PubKey.md#isvalidserializedpubkey) + +## Constructors + +### constructor + +• **new PubKey**(`rawPubKey`): [`PubKey`](PubKey.md) + +Create a new instance of a public key + +#### Parameters + +| Name | Type | Description | +| :---------- | :------- | :----------------- | +| `rawPubKey` | `PubKey` | the raw public key | + +#### Returns + +[`PubKey`](PubKey.md) + +#### Defined in + +[publicKey.ts:24](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/publicKey.ts#L24) + +## Properties + +### rawPubKey + +• **rawPubKey**: `PubKey` + +#### Defined in + +[publicKey.ts:18](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/publicKey.ts#L18) + +## Methods + +### asArray + +▸ **asArray**(): `bigint`[] + +Return this public key as an array of bigints + +#### Returns + +`bigint`[] + +the public key as an array of bigints + +#### Defined in + +[publicKey.ts:59](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/publicKey.ts#L59) + +--- + +### asCircuitInputs + +▸ **asCircuitInputs**(): `string`[] + +Return this public key as circuit inputs + +#### Returns + +`string`[] + +an array of strings + +#### Defined in + +[publicKey.ts:53](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/publicKey.ts#L53) + +--- + +### asContractParam + +▸ **asContractParam**(): [`IG1ContractParams`](../interfaces/IG1ContractParams.md) + +Return this public key as smart contract parameters + +#### Returns + +[`IG1ContractParams`](../interfaces/IG1ContractParams.md) + +the public key as smart contract parameters + +#### Defined in + +[publicKey.ts:40](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/publicKey.ts#L40) + +--- + +### copy + +▸ **copy**(): [`PubKey`](PubKey.md) + +Create a copy of the public key + +#### Returns + +[`PubKey`](PubKey.md) + +a copy of the public key + +#### Defined in + +[publicKey.ts:34](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/publicKey.ts#L34) + +--- + +### equals + +▸ **equals**(`p`): `boolean` + +Check whether this public key equals to another public key + +#### Parameters + +| Name | Type | Description | +| :--- | :-------------------- | :----------------------------- | +| `p` | [`PubKey`](PubKey.md) | the public key to compare with | + +#### Returns + +`boolean` + +whether they match + +#### Defined in + +[publicKey.ts:92](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/publicKey.ts#L92) + +--- + +### hash + +▸ **hash**(): `bigint` + +Hash the two baby jubjub coordinates + +#### Returns + +`bigint` + +the hash of this public key + +#### Defined in + +[publicKey.ts:85](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/publicKey.ts#L85) + +--- + +### serialize + +▸ **serialize**(): `string` + +Generate a serialized public key from this public key object + +#### Returns + +`string` + +the string representation of a serialized public key + +#### Defined in + +[publicKey.ts:65](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/publicKey.ts#L65) + +--- + +### toJSON + +▸ **toJSON**(): [`IJsonPublicKey`](../modules.md#ijsonpublickey) + +Serialize this object + +#### Returns + +[`IJsonPublicKey`](../modules.md#ijsonpublickey) + +#### Defined in + +[publicKey.ts:128](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/publicKey.ts#L128) + +--- + +### deserialize + +▸ **deserialize**(`s`): [`PubKey`](PubKey.md) + +Deserialize a serialized public key + +#### Parameters + +| Name | Type | Description | +| :--- | :------- | :------------------------ | +| `s` | `string` | the serialized public key | + +#### Returns + +[`PubKey`](PubKey.md) + +the deserialized public key + +#### Defined in + +[publicKey.ts:99](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/publicKey.ts#L99) + +--- + +### fromJSON + +▸ **fromJSON**(`json`): [`PubKey`](PubKey.md) + +Deserialize a JSON object into a PubKey instance + +#### Parameters + +| Name | Type | Description | +| :----- | :----------------------------------------------- | :-------------- | +| `json` | [`IJsonPublicKey`](../modules.md#ijsonpublickey) | the json object | + +#### Returns + +[`PubKey`](PubKey.md) + +PubKey + +#### Defined in + +[publicKey.ts:139](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/publicKey.ts#L139) + +--- + +### isValidSerializedPubKey + +▸ **isValidSerializedPubKey**(`s`): `boolean` + +Check whether a serialized public key is serialized correctly + +#### Parameters + +| Name | Type | Description | +| :--- | :------- | :------------------------ | +| `s` | `string` | the serialized public key | + +#### Returns + +`boolean` + +whether the serialized public key is valid + +#### Defined in + +[publicKey.ts:114](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/publicKey.ts#L114) diff --git a/website/versioned_docs/version-v1.2/typedoc/domainobjs/classes/StateLeaf.md b/website/versioned_docs/version-v1.2/typedoc/domainobjs/classes/StateLeaf.md new file mode 100644 index 0000000000..fa7d1521f8 --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/domainobjs/classes/StateLeaf.md @@ -0,0 +1,340 @@ +--- +title: StateLeaf +sidebar_label: StateLeaf +--- + +**`Notice`** + +A leaf in the state tree, which maps +public keys to voice credit balances + +## Implements + +- [`IStateLeaf`](../interfaces/IStateLeaf.md) + +## Table of contents + +### Constructors + +- [constructor](StateLeaf.md#constructor) + +### Properties + +- [pubKey](StateLeaf.md#pubkey) +- [timestamp](StateLeaf.md#timestamp) +- [voiceCreditBalance](StateLeaf.md#voicecreditbalance) + +### Methods + +- [asArray](StateLeaf.md#asarray) +- [asCircuitInputs](StateLeaf.md#ascircuitinputs) +- [asContractParam](StateLeaf.md#ascontractparam) +- [copy](StateLeaf.md#copy) +- [equals](StateLeaf.md#equals) +- [hash](StateLeaf.md#hash) +- [serialize](StateLeaf.md#serialize) +- [toJSON](StateLeaf.md#tojson) +- [deserialize](StateLeaf.md#deserialize) +- [fromJSON](StateLeaf.md#fromjson) +- [genBlankLeaf](StateLeaf.md#genblankleaf) +- [genRandomLeaf](StateLeaf.md#genrandomleaf) + +## Constructors + +### constructor + +• **new StateLeaf**(`pubKey`, `voiceCreditBalance`, `timestamp`): [`StateLeaf`](StateLeaf.md) + +Create a new instance of a state leaf + +#### Parameters + +| Name | Type | Description | +| :------------------- | :-------------------- | :--------------------------------------- | +| `pubKey` | [`PubKey`](PubKey.md) | the public key of the user signin up | +| `voiceCreditBalance` | `bigint` | the voice credit balance of the user | +| `timestamp` | `bigint` | the timestamp of when the user signed-up | + +#### Returns + +[`StateLeaf`](StateLeaf.md) + +#### Defined in + +[stateLeaf.ts:25](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/stateLeaf.ts#L25) + +## Properties + +### pubKey + +• **pubKey**: [`PubKey`](PubKey.md) + +#### Implementation of + +[IStateLeaf](../interfaces/IStateLeaf.md).[pubKey](../interfaces/IStateLeaf.md#pubkey) + +#### Defined in + +[stateLeaf.ts:13](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/stateLeaf.ts#L13) + +--- + +### timestamp + +• **timestamp**: `bigint` + +#### Defined in + +[stateLeaf.ts:17](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/stateLeaf.ts#L17) + +--- + +### voiceCreditBalance + +• **voiceCreditBalance**: `bigint` + +#### Implementation of + +[IStateLeaf](../interfaces/IStateLeaf.md).[voiceCreditBalance](../interfaces/IStateLeaf.md#voicecreditbalance) + +#### Defined in + +[stateLeaf.ts:15](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/stateLeaf.ts#L15) + +## Methods + +### asArray + +▸ **asArray**(): `bigint`[] + +Return this state leaf as an array of bigints + +#### Returns + +`bigint`[] + +the state leaf as an array of bigints + +#### Defined in + +[stateLeaf.ts:79](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/stateLeaf.ts#L79) + +--- + +### asCircuitInputs + +▸ **asCircuitInputs**(): `bigint`[] + +Return this state leaf as an array of bigints + +#### Returns + +`bigint`[] + +the state leaf as an array of bigints + +#### Defined in + +[stateLeaf.ts:85](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/stateLeaf.ts#L85) + +--- + +### asContractParam + +▸ **asContractParam**(): [`IStateLeafContractParams`](../interfaces/IStateLeafContractParams.md) + +Return this state leaf as a contract param + +#### Returns + +[`IStateLeafContractParams`](../interfaces/IStateLeafContractParams.md) + +the state leaf as a contract param (object) + +#### Defined in + +[stateLeaf.ts:97](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/stateLeaf.ts#L97) + +--- + +### copy + +▸ **copy**(): [`StateLeaf`](StateLeaf.md) + +Crate a deep copy of the object + +#### Returns + +[`StateLeaf`](StateLeaf.md) + +a copy of the state leaf + +#### Defined in + +[stateLeaf.ts:35](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/stateLeaf.ts#L35) + +--- + +### equals + +▸ **equals**(`s`): `boolean` + +Check if two state leaves are equal + +#### Parameters + +| Name | Type | Description | +| :--- | :-------------------------- | :----------------------------- | +| `s` | [`StateLeaf`](StateLeaf.md) | the state leaf to compare with | + +#### Returns + +`boolean` + +whether they are equal or not + +#### Defined in + +[stateLeaf.ts:110](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/stateLeaf.ts#L110) + +--- + +### hash + +▸ **hash**(): `bigint` + +Hash this state leaf (first convert as array) + +#### Returns + +`bigint` + +the has of the state leaf elements + +#### Defined in + +[stateLeaf.ts:91](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/stateLeaf.ts#L91) + +--- + +### serialize + +▸ **serialize**(): `string` + +Serialize the state leaf + +#### Returns + +`string` + +**`Notice`** + +serialize the public key + +**`Notice`** + +convert the voice credit balance and timestamp to a hex string + +#### Defined in + +[stateLeaf.ts:122](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/stateLeaf.ts#L122) + +--- + +### toJSON + +▸ **toJSON**(): [`IJsonStateLeaf`](../interfaces/IJsonStateLeaf.md) + +Serialize to a JSON object + +#### Returns + +[`IJsonStateLeaf`](../interfaces/IJsonStateLeaf.md) + +#### Defined in + +[stateLeaf.ts:143](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/stateLeaf.ts#L143) + +--- + +### deserialize + +▸ **deserialize**(`serialized`): [`StateLeaf`](StateLeaf.md) + +Deserialize the state leaf + +#### Parameters + +| Name | Type | Description | +| :----------- | :------- | :------------------------ | +| `serialized` | `string` | the serialized state leaf | + +#### Returns + +[`StateLeaf`](StateLeaf.md) + +a deserialized state leaf + +#### Defined in + +[stateLeaf.ts:133](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/stateLeaf.ts#L133) + +--- + +### fromJSON + +▸ **fromJSON**(`json`): [`StateLeaf`](StateLeaf.md) + +Deserialize into a StateLeaf instance + +#### Parameters + +| Name | Type | Description | +| :----- | :-------------------------------------------------- | :---------------------- | +| `json` | [`IJsonStateLeaf`](../interfaces/IJsonStateLeaf.md) | the json representation | + +#### Returns + +[`StateLeaf`](StateLeaf.md) + +the deserialized object as a StateLeaf instance + +#### Defined in + +[stateLeaf.ts:156](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/stateLeaf.ts#L156) + +--- + +### genBlankLeaf + +▸ **genBlankLeaf**(): [`StateLeaf`](StateLeaf.md) + +Generate a blank state leaf + +#### Returns + +[`StateLeaf`](StateLeaf.md) + +a blank state leaf + +#### Defined in + +[stateLeaf.ts:47](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/stateLeaf.ts#L47) + +--- + +### genRandomLeaf + +▸ **genRandomLeaf**(): [`StateLeaf`](StateLeaf.md) + +Generate a random leaf (random salt and random key pair) + +#### Returns + +[`StateLeaf`](StateLeaf.md) + +a random state leaf + +#### Defined in + +[stateLeaf.ts:70](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/stateLeaf.ts#L70) diff --git a/website/versioned_docs/version-v1.2/typedoc/domainobjs/classes/TCommand.md b/website/versioned_docs/version-v1.2/typedoc/domainobjs/classes/TCommand.md new file mode 100644 index 0000000000..3454a0c541 --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/domainobjs/classes/TCommand.md @@ -0,0 +1,200 @@ +--- +title: TCommand +sidebar_label: TCommand +--- + +**`Notice`** + +Command for submitting a topup request + +## Implements + +- [`ICommand`](../interfaces/ICommand.md) + +## Table of contents + +### Constructors + +- [constructor](TCommand.md#constructor) + +### Properties + +- [amount](TCommand.md#amount) +- [cmdType](TCommand.md#cmdtype) +- [pollId](TCommand.md#pollid) +- [stateIndex](TCommand.md#stateindex) + +### Methods + +- [copy](TCommand.md#copy) +- [equals](TCommand.md#equals) +- [toJSON](TCommand.md#tojson) +- [fromJSON](TCommand.md#fromjson) + +## Constructors + +### constructor + +• **new TCommand**(`stateIndex`, `amount`, `pollId`): [`TCommand`](TCommand.md) + +Create a new TCommand + +#### Parameters + +| Name | Type | Description | +| :----------- | :------- | :-------------------------- | +| `stateIndex` | `bigint` | the state index of the user | +| `amount` | `bigint` | the amount of voice credits | +| `pollId` | `bigint` | the poll ID | + +#### Returns + +[`TCommand`](TCommand.md) + +#### Defined in + +[commands/TCommand.ts:21](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/commands/TCommand.ts#L21) + +## Properties + +### amount + +• **amount**: `bigint` + +#### Defined in + +[commands/TCommand.ts:11](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/commands/TCommand.ts#L11) + +--- + +### cmdType + +• **cmdType**: `bigint` + +#### Implementation of + +[ICommand](../interfaces/ICommand.md).[cmdType](../interfaces/ICommand.md#cmdtype) + +#### Defined in + +[commands/TCommand.ts:7](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/commands/TCommand.ts#L7) + +--- + +### pollId + +• **pollId**: `bigint` + +#### Defined in + +[commands/TCommand.ts:13](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/commands/TCommand.ts#L13) + +--- + +### stateIndex + +• **stateIndex**: `bigint` + +#### Defined in + +[commands/TCommand.ts:9](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/commands/TCommand.ts#L9) + +## Methods + +### copy + +▸ **copy**\<`T`\>(): `T` + +Create a deep clone of this TCommand + +#### Type parameters + +| Name | Type | +| :--- | :-------------------------------- | +| `T` | extends [`TCommand`](TCommand.md) | + +#### Returns + +`T` + +a copy of the TCommand + +#### Implementation of + +[ICommand](../interfaces/ICommand.md).[copy](../interfaces/ICommand.md#copy) + +#### Defined in + +[commands/TCommand.ts:32](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/commands/TCommand.ts#L32) + +--- + +### equals + +▸ **equals**(`command`): `boolean` + +Check whether this command has deep equivalence to another command + +#### Parameters + +| Name | Type | Description | +| :-------- | :------------------------ | :-------------------------- | +| `command` | [`TCommand`](TCommand.md) | the command to compare with | + +#### Returns + +`boolean` + +whether they are equal or not + +#### Implementation of + +[ICommand](../interfaces/ICommand.md).[equals](../interfaces/ICommand.md#equals) + +#### Defined in + +[commands/TCommand.ts:39](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/commands/TCommand.ts#L39) + +--- + +### toJSON + +▸ **toJSON**(): [`IJsonTCommand`](../interfaces/IJsonTCommand.md) + +Serialize into a JSON object + +#### Returns + +[`IJsonTCommand`](../interfaces/IJsonTCommand.md) + +#### Implementation of + +[ICommand](../interfaces/ICommand.md).[toJSON](../interfaces/ICommand.md#tojson) + +#### Defined in + +[commands/TCommand.ts:48](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/commands/TCommand.ts#L48) + +--- + +### fromJSON + +▸ **fromJSON**(`json`): [`TCommand`](TCommand.md) + +Deserialize into a TCommand object + +#### Parameters + +| Name | Type | Description | +| :----- | :------------------------------------------------ | :---------------------- | +| `json` | [`IJsonTCommand`](../interfaces/IJsonTCommand.md) | the json representation | + +#### Returns + +[`TCommand`](TCommand.md) + +the TCommand instance + +#### Defined in + +[commands/TCommand.ts:62](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/commands/TCommand.ts#L62) diff --git a/website/versioned_docs/version-v1.2/typedoc/domainobjs/classes/VerifyingKey.md b/website/versioned_docs/version-v1.2/typedoc/domainobjs/classes/VerifyingKey.md new file mode 100644 index 0000000000..4055df78e1 --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/domainobjs/classes/VerifyingKey.md @@ -0,0 +1,240 @@ +--- +title: VerifyingKey +sidebar_label: VerifyingKey +--- + +**`Notice`** + +A TS Class representing a zk-SNARK VerifyingKey + +## Table of contents + +### Constructors + +- [constructor](VerifyingKey.md#constructor) + +### Properties + +- [alpha1](VerifyingKey.md#alpha1) +- [beta2](VerifyingKey.md#beta2) +- [delta2](VerifyingKey.md#delta2) +- [gamma2](VerifyingKey.md#gamma2) +- [ic](VerifyingKey.md#ic) + +### Methods + +- [asContractParam](VerifyingKey.md#ascontractparam) +- [copy](VerifyingKey.md#copy) +- [equals](VerifyingKey.md#equals) +- [fromContract](VerifyingKey.md#fromcontract) +- [fromJSON](VerifyingKey.md#fromjson) +- [fromObj](VerifyingKey.md#fromobj) + +## Constructors + +### constructor + +• **new VerifyingKey**(`alpha1`, `beta2`, `gamma2`, `delta2`, `ic`): [`VerifyingKey`](VerifyingKey.md) + +Generate a new VerifyingKey + +#### Parameters + +| Name | Type | Description | +| :------- | :---------- | :--------------- | +| `alpha1` | `G1Point` | the alpha1 point | +| `beta2` | `G2Point` | the beta2 point | +| `gamma2` | `G2Point` | the gamma2 point | +| `delta2` | `G2Point` | the delta2 point | +| `ic` | `G1Point`[] | the ic points | + +#### Returns + +[`VerifyingKey`](VerifyingKey.md) + +#### Defined in + +[verifyingKey.ts:27](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/verifyingKey.ts#L27) + +## Properties + +### alpha1 + +• **alpha1**: `G1Point` + +#### Defined in + +[verifyingKey.ts:9](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/verifyingKey.ts#L9) + +--- + +### beta2 + +• **beta2**: `G2Point` + +#### Defined in + +[verifyingKey.ts:11](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/verifyingKey.ts#L11) + +--- + +### delta2 + +• **delta2**: `G2Point` + +#### Defined in + +[verifyingKey.ts:15](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/verifyingKey.ts#L15) + +--- + +### gamma2 + +• **gamma2**: `G2Point` + +#### Defined in + +[verifyingKey.ts:13](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/verifyingKey.ts#L13) + +--- + +### ic + +• **ic**: `G1Point`[] + +#### Defined in + +[verifyingKey.ts:17](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/verifyingKey.ts#L17) + +## Methods + +### asContractParam + +▸ **asContractParam**(): [`IVkContractParams`](../interfaces/IVkContractParams.md) + +Return this as an object which can be passed +to the smart contract + +#### Returns + +[`IVkContractParams`](../interfaces/IVkContractParams.md) + +the object representation of this + +#### Defined in + +[verifyingKey.ts:40](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/verifyingKey.ts#L40) + +--- + +### copy + +▸ **copy**(): [`VerifyingKey`](VerifyingKey.md) + +Produce a copy of this verifying key + +#### Returns + +[`VerifyingKey`](VerifyingKey.md) + +the copy + +#### Defined in + +[verifyingKey.ts:94](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/verifyingKey.ts#L94) + +--- + +### equals + +▸ **equals**(`vk`): `boolean` + +Check whether this is equal to another verifying key + +#### Parameters + +| Name | Type | Description | +| :--- | :-------------------------------- | :---------------------- | +| `vk` | [`VerifyingKey`](VerifyingKey.md) | the other verifying key | + +#### Returns + +`boolean` + +whether this is equal to the other verifying key + +#### Defined in + +[verifyingKey.ts:73](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/verifyingKey.ts#L73) + +--- + +### fromContract + +▸ **fromContract**(`data`): [`VerifyingKey`](VerifyingKey.md) + +Create a new verifying key from a contract representation of the VK + +#### Parameters + +| Name | Type | Description | +| :----- | :-------------------------------------------------------- | :------------------------ | +| `data` | [`IVkContractParams`](../interfaces/IVkContractParams.md) | the object representation | + +#### Returns + +[`VerifyingKey`](VerifyingKey.md) + +a new VerifyingKey + +#### Defined in + +[verifyingKey.ts:55](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/verifyingKey.ts#L55) + +--- + +### fromJSON + +▸ **fromJSON**(`json`): [`VerifyingKey`](VerifyingKey.md) + +Deserialize into a VerifyingKey instance + +#### Parameters + +| Name | Type | Description | +| :----- | :------- | :---------------------- | +| `json` | `string` | the JSON representation | + +#### Returns + +[`VerifyingKey`](VerifyingKey.md) + +the VerifyingKey + +#### Defined in + +[verifyingKey.ts:115](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/verifyingKey.ts#L115) + +--- + +### fromObj + +▸ **fromObj**(`data`): [`VerifyingKey`](VerifyingKey.md) + +Convert an object representation to a VerifyingKey + +#### Parameters + +| Name | Type | Description | +| :----- | :---------------------------------------------------- | :------------------------ | +| `data` | [`IVkObjectParams`](../interfaces/IVkObjectParams.md) | the object representation | + +#### Returns + +[`VerifyingKey`](VerifyingKey.md) + +the VerifyingKey + +#### Defined in + +[verifyingKey.ts:125](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/verifyingKey.ts#L125) diff --git a/website/versioned_docs/version-v1.2/typedoc/domainobjs/index.md b/website/versioned_docs/version-v1.2/typedoc/domainobjs/index.md new file mode 100644 index 0000000000..eae0b87b20 --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/domainobjs/index.md @@ -0,0 +1,81 @@ +--- +title: Domainobjs +sidebar_label: Domainobjs +--- + +[![NPM Package][domainobjs-npm-badge]][domainobjs-npm-link] +[![Actions Status][domainobjs-actions-badge]][domainobjs-actions-link] + +This module implements domain objects. A domain object is: + +> a logical container of purely domain information, usually representing a +> logical entity in the problem domain space + +https://wiki.c2.com/?DomainObject + +In effect, domain objects are representations of objects shared between other +modules in this codebase. They also encapsulate helper functions which make it +easy to use them with said modules. + +## `PrivKey` + +A private key. Provides helper functions to do with passing it into a circuit +in the right format, serialisation and deserialisation, and deep copying. + +This is a MACI private key, which is not to be confused with an Ethereum private key. +A serialized MACI private key is prefixed by 'macisk.' +A raw MACI private key can be thought as a point on the baby jubjub curve. + +## `PubKey` + +A public key. Provides helper functions to do with passing it into a contract +function or circuit in the right format, hashing, serialisation and +deserialisation, and deep copying. + +This is a MACI public key, which is not to be confused with an Ethereum public key. A serialized MACI public key is prefixed by 'macipk.' A raw MACI public key can be thought as a pair of BigIntegers (x, y) representing a point on the baby jubjub curve. + +## `Keypair` + +Encapsulates a `PrivKey` and `PubKey`. Also provides `genEcdhSharedKey` which +generates an ECDH shared key from a public key and a private key. + +This is a MACI keypair, which is not to be confused with an Ethereum keypair. +A MACI keypair is comprised of a MACI public key and a MACI private key + +## `Command` + +The `Command` domain object represents a request by a user to cast a vote +and/or change one's public key. + +## `Message` + +The `Message` domain object is an encrypted `Command` and signature. That is, a +`Message` is a `Ciphertext` (defined in [`maci-crypto`](../crypto/index.md)) +which is the encrypted `Command` and its `Signature` (also defined in +`maci-crypto`). In other terms: + +``` +Message = Encrypt([Command, Signature], Key) +``` + +## `Ballot` + +Represents a User's votes in a Poll, as well as their next valid nonce. + +## `StateLeaf` + +Represents a leaf in the state tree, which maps public keys to voice credit +balances, as well as the timestamp at which it was inserted. + +## `VerifyingKey` + +Encapsulates a Groth16 zk-SNARK verifying key. + +## `Proof` + +Encapsulates a Groth16 zk-SNARK proof. + +[domainobjs-npm-badge]: https://img.shields.io/npm/v/maci-domainobjs.svg +[domainobjs-npm-link]: https://www.npmjs.com/package/maci-domainobjs +[domainobjs-actions-badge]: https://github.com/privacy-scaling-explorations/maci/actions/workflows/domainobjs-build.yml/badge.svg +[domainobjs-actions-link]: https://github.com/privacy-scaling-explorations/maci/actions?query=workflow%3Adomainobjs diff --git a/website/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/ICommand.md b/website/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/ICommand.md new file mode 100644 index 0000000000..2015feb17e --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/ICommand.md @@ -0,0 +1,104 @@ +--- +title: ICommand +sidebar_label: ICommand +--- + +**`Notice`** + +A parent interface for all the commands + +## Implemented by + +- [`PCommand`](../classes/PCommand.md) +- [`TCommand`](../classes/TCommand.md) + +## Table of contents + +### Properties + +- [cmdType](ICommand.md#cmdtype) +- [copy](ICommand.md#copy) +- [equals](ICommand.md#equals) +- [toJSON](ICommand.md#tojson) + +## Properties + +### cmdType + +• **cmdType**: `bigint` + +#### Defined in + +[commands/types.ts:5](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/commands/types.ts#L5) + +--- + +### copy + +• **copy**: \() => `T` + +#### Type declaration + +▸ \<`T`\>(): `T` + +##### Type parameters + +| Name | Type | +| :--- | :-------------------------------- | +| `T` | extends [`ICommand`](ICommand.md) | + +##### Returns + +`T` + +#### Defined in + +[commands/types.ts:6](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/commands/types.ts#L6) + +--- + +### equals + +• **equals**: \(`command`: `T`) => `boolean` + +#### Type declaration + +▸ \<`T`\>(`command`): `boolean` + +##### Type parameters + +| Name | Type | +| :--- | :-------------------------------- | +| `T` | extends [`ICommand`](ICommand.md) | + +##### Parameters + +| Name | Type | +| :-------- | :--- | +| `command` | `T` | + +##### Returns + +`boolean` + +#### Defined in + +[commands/types.ts:7](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/commands/types.ts#L7) + +--- + +### toJSON + +• **toJSON**: () => `unknown` + +#### Type declaration + +▸ (): `unknown` + +##### Returns + +`unknown` + +#### Defined in + +[commands/types.ts:8](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/commands/types.ts#L8) diff --git a/website/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IG1ContractParams.md b/website/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IG1ContractParams.md new file mode 100644 index 0000000000..02e2533df7 --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IG1ContractParams.md @@ -0,0 +1,31 @@ +--- +title: IG1ContractParams +sidebar_label: IG1ContractParams +--- + +## Table of contents + +### Properties + +- [x](IG1ContractParams.md#x) +- [y](IG1ContractParams.md#y) + +## Properties + +### x + +• **x**: `BigNumberish` + +#### Defined in + +[types.ts:46](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/types.ts#L46) + +--- + +### y + +• **y**: `BigNumberish` + +#### Defined in + +[types.ts:47](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/types.ts#L47) diff --git a/website/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IG2ContractParams.md b/website/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IG2ContractParams.md new file mode 100644 index 0000000000..0300aefb0a --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IG2ContractParams.md @@ -0,0 +1,31 @@ +--- +title: IG2ContractParams +sidebar_label: IG2ContractParams +--- + +## Table of contents + +### Properties + +- [x](IG2ContractParams.md#x) +- [y](IG2ContractParams.md#y) + +## Properties + +### x + +• **x**: `BigNumberish`[] + +#### Defined in + +[types.ts:51](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/types.ts#L51) + +--- + +### y + +• **y**: `BigNumberish`[] + +#### Defined in + +[types.ts:52](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/types.ts#L52) diff --git a/website/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IJsonBallot.md b/website/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IJsonBallot.md new file mode 100644 index 0000000000..6c0fce0b1a --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IJsonBallot.md @@ -0,0 +1,42 @@ +--- +title: IJsonBallot +sidebar_label: IJsonBallot +--- + +## Table of contents + +### Properties + +- [nonce](IJsonBallot.md#nonce) +- [voteOptionTreeDepth](IJsonBallot.md#voteoptiontreedepth) +- [votes](IJsonBallot.md#votes) + +## Properties + +### nonce + +• **nonce**: `BigNumberish` + +#### Defined in + +[types.ts:88](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/types.ts#L88) + +--- + +### voteOptionTreeDepth + +• **voteOptionTreeDepth**: `BigNumberish` + +#### Defined in + +[types.ts:89](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/types.ts#L89) + +--- + +### votes + +• **votes**: `BigNumberish`[] + +#### Defined in + +[types.ts:87](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/types.ts#L87) diff --git a/website/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IJsonCommand.md b/website/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IJsonCommand.md new file mode 100644 index 0000000000..630651ab88 --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IJsonCommand.md @@ -0,0 +1,32 @@ +--- +title: IJsonCommand +sidebar_label: IJsonCommand +--- + +**`Notice`** + +An interface representing a generic json command + +## Hierarchy + +- **`IJsonCommand`** + + ↳ [`IJsonTCommand`](IJsonTCommand.md) + + ↳ [`IJsonPCommand`](IJsonPCommand.md) + +## Table of contents + +### Properties + +- [cmdType](IJsonCommand.md#cmdtype) + +## Properties + +### cmdType + +• **cmdType**: `string` + +#### Defined in + +[commands/types.ts:15](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/commands/types.ts#L15) diff --git a/website/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IJsonKeyPair.md b/website/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IJsonKeyPair.md new file mode 100644 index 0000000000..6f08551362 --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IJsonKeyPair.md @@ -0,0 +1,31 @@ +--- +title: IJsonKeyPair +sidebar_label: IJsonKeyPair +--- + +## Table of contents + +### Properties + +- [privKey](IJsonKeyPair.md#privkey) +- [pubKey](IJsonKeyPair.md#pubkey) + +## Properties + +### privKey + +• **privKey**: `string` + +#### Defined in + +[types.ts:29](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/types.ts#L29) + +--- + +### pubKey + +• **pubKey**: `string` + +#### Defined in + +[types.ts:30](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/types.ts#L30) diff --git a/website/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IJsonPCommand.md b/website/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IJsonPCommand.md new file mode 100644 index 0000000000..77bde3aa9e --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IJsonPCommand.md @@ -0,0 +1,111 @@ +--- +title: IJsonPCommand +sidebar_label: IJsonPCommand +--- + +**`Notice`** + +An interface representing a json P command + +## Hierarchy + +- [`IJsonCommand`](IJsonCommand.md) + + ↳ **`IJsonPCommand`** + +## Table of contents + +### Properties + +- [cmdType](IJsonPCommand.md#cmdtype) +- [newPubKey](IJsonPCommand.md#newpubkey) +- [newVoteWeight](IJsonPCommand.md#newvoteweight) +- [nonce](IJsonPCommand.md#nonce) +- [pollId](IJsonPCommand.md#pollid) +- [salt](IJsonPCommand.md#salt) +- [stateIndex](IJsonPCommand.md#stateindex) +- [voteOptionIndex](IJsonPCommand.md#voteoptionindex) + +## Properties + +### cmdType + +• **cmdType**: `string` + +#### Inherited from + +[IJsonCommand](IJsonCommand.md).[cmdType](IJsonCommand.md#cmdtype) + +#### Defined in + +[commands/types.ts:15](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/commands/types.ts#L15) + +--- + +### newPubKey + +• **newPubKey**: `string` + +#### Defined in + +[commands/types.ts:32](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/commands/types.ts#L32) + +--- + +### newVoteWeight + +• **newVoteWeight**: `string` + +#### Defined in + +[commands/types.ts:34](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/commands/types.ts#L34) + +--- + +### nonce + +• **nonce**: `string` + +#### Defined in + +[commands/types.ts:35](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/commands/types.ts#L35) + +--- + +### pollId + +• **pollId**: `string` + +#### Defined in + +[commands/types.ts:36](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/commands/types.ts#L36) + +--- + +### salt + +• **salt**: `string` + +#### Defined in + +[commands/types.ts:37](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/commands/types.ts#L37) + +--- + +### stateIndex + +• **stateIndex**: `string` + +#### Defined in + +[commands/types.ts:31](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/commands/types.ts#L31) + +--- + +### voteOptionIndex + +• **voteOptionIndex**: `string` + +#### Defined in + +[commands/types.ts:33](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/commands/types.ts#L33) diff --git a/website/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IJsonStateLeaf.md b/website/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IJsonStateLeaf.md new file mode 100644 index 0000000000..e8a2aa8136 --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IJsonStateLeaf.md @@ -0,0 +1,42 @@ +--- +title: IJsonStateLeaf +sidebar_label: IJsonStateLeaf +--- + +## Table of contents + +### Properties + +- [pubKey](IJsonStateLeaf.md#pubkey) +- [timestamp](IJsonStateLeaf.md#timestamp) +- [voiceCreditBalance](IJsonStateLeaf.md#voicecreditbalance) + +## Properties + +### pubKey + +• **pubKey**: `string` + +#### Defined in + +[types.ts:38](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/types.ts#L38) + +--- + +### timestamp + +• **timestamp**: `string` + +#### Defined in + +[types.ts:40](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/types.ts#L40) + +--- + +### voiceCreditBalance + +• **voiceCreditBalance**: `string` + +#### Defined in + +[types.ts:39](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/types.ts#L39) diff --git a/website/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IJsonTCommand.md b/website/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IJsonTCommand.md new file mode 100644 index 0000000000..c0a86e31ae --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IJsonTCommand.md @@ -0,0 +1,67 @@ +--- +title: IJsonTCommand +sidebar_label: IJsonTCommand +--- + +**`Notice`** + +An interface representing a json T command + +## Hierarchy + +- [`IJsonCommand`](IJsonCommand.md) + + ↳ **`IJsonTCommand`** + +## Table of contents + +### Properties + +- [amount](IJsonTCommand.md#amount) +- [cmdType](IJsonTCommand.md#cmdtype) +- [pollId](IJsonTCommand.md#pollid) +- [stateIndex](IJsonTCommand.md#stateindex) + +## Properties + +### amount + +• **amount**: `string` + +#### Defined in + +[commands/types.ts:23](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/commands/types.ts#L23) + +--- + +### cmdType + +• **cmdType**: `string` + +#### Inherited from + +[IJsonCommand](IJsonCommand.md).[cmdType](IJsonCommand.md#cmdtype) + +#### Defined in + +[commands/types.ts:15](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/commands/types.ts#L15) + +--- + +### pollId + +• **pollId**: `string` + +#### Defined in + +[commands/types.ts:24](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/commands/types.ts#L24) + +--- + +### stateIndex + +• **stateIndex**: `string` + +#### Defined in + +[commands/types.ts:22](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/commands/types.ts#L22) diff --git a/website/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IMessageContractParams.md b/website/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IMessageContractParams.md new file mode 100644 index 0000000000..d8bf2e8824 --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IMessageContractParams.md @@ -0,0 +1,31 @@ +--- +title: IMessageContractParams +sidebar_label: IMessageContractParams +--- + +## Table of contents + +### Properties + +- [data](IMessageContractParams.md#data) +- [msgType](IMessageContractParams.md#msgtype) + +## Properties + +### data + +• **data**: `BigNumberish`[] + +#### Defined in + +[types.ts:83](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/types.ts#L83) + +--- + +### msgType + +• **msgType**: `string` + +#### Defined in + +[types.ts:82](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/types.ts#L82) diff --git a/website/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IStateLeaf.md b/website/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IStateLeaf.md new file mode 100644 index 0000000000..300315d3e9 --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IStateLeaf.md @@ -0,0 +1,39 @@ +--- +title: IStateLeaf +sidebar_label: IStateLeaf +--- + +**`Notice`** + +An interface representing a MACI state leaf + +## Implemented by + +- [`StateLeaf`](../classes/StateLeaf.md) + +## Table of contents + +### Properties + +- [pubKey](IStateLeaf.md#pubkey) +- [voiceCreditBalance](IStateLeaf.md#voicecreditbalance) + +## Properties + +### pubKey + +• **pubKey**: [`PubKey`](../classes/PubKey.md) + +#### Defined in + +[types.ts:17](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/types.ts#L17) + +--- + +### voiceCreditBalance + +• **voiceCreditBalance**: `bigint` + +#### Defined in + +[types.ts:18](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/types.ts#L18) diff --git a/website/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IStateLeafContractParams.md b/website/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IStateLeafContractParams.md new file mode 100644 index 0000000000..fd0d0b6bea --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IStateLeafContractParams.md @@ -0,0 +1,42 @@ +--- +title: IStateLeafContractParams +sidebar_label: IStateLeafContractParams +--- + +## Table of contents + +### Properties + +- [pubKey](IStateLeafContractParams.md#pubkey) +- [timestamp](IStateLeafContractParams.md#timestamp) +- [voiceCreditBalance](IStateLeafContractParams.md#voicecreditbalance) + +## Properties + +### pubKey + +• **pubKey**: [`IG1ContractParams`](IG1ContractParams.md) + +#### Defined in + +[types.ts:76](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/types.ts#L76) + +--- + +### timestamp + +• **timestamp**: `BigNumberish` + +#### Defined in + +[types.ts:78](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/types.ts#L78) + +--- + +### voiceCreditBalance + +• **voiceCreditBalance**: `BigNumberish` + +#### Defined in + +[types.ts:77](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/types.ts#L77) diff --git a/website/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IVkContractParams.md b/website/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IVkContractParams.md new file mode 100644 index 0000000000..aac464480a --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IVkContractParams.md @@ -0,0 +1,64 @@ +--- +title: IVkContractParams +sidebar_label: IVkContractParams +--- + +## Table of contents + +### Properties + +- [alpha1](IVkContractParams.md#alpha1) +- [beta2](IVkContractParams.md#beta2) +- [delta2](IVkContractParams.md#delta2) +- [gamma2](IVkContractParams.md#gamma2) +- [ic](IVkContractParams.md#ic) + +## Properties + +### alpha1 + +• **alpha1**: [`IG1ContractParams`](IG1ContractParams.md) + +#### Defined in + +[types.ts:56](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/types.ts#L56) + +--- + +### beta2 + +• **beta2**: [`IG2ContractParams`](IG2ContractParams.md) + +#### Defined in + +[types.ts:57](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/types.ts#L57) + +--- + +### delta2 + +• **delta2**: [`IG2ContractParams`](IG2ContractParams.md) + +#### Defined in + +[types.ts:59](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/types.ts#L59) + +--- + +### gamma2 + +• **gamma2**: [`IG2ContractParams`](IG2ContractParams.md) + +#### Defined in + +[types.ts:58](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/types.ts#L58) + +--- + +### ic + +• **ic**: [`IG1ContractParams`](IG1ContractParams.md)[] + +#### Defined in + +[types.ts:60](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/types.ts#L60) diff --git a/website/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IVkObjectParams.md b/website/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IVkObjectParams.md new file mode 100644 index 0000000000..2739dbae4e --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/IVkObjectParams.md @@ -0,0 +1,108 @@ +--- +title: IVkObjectParams +sidebar_label: IVkObjectParams +--- + +## Table of contents + +### Properties + +- [IC](IVkObjectParams.md#ic) +- [curve](IVkObjectParams.md#curve) +- [nPublic](IVkObjectParams.md#npublic) +- [protocol](IVkObjectParams.md#protocol) +- [vk_alpha_1](IVkObjectParams.md#vk_alpha_1) +- [vk_alphabeta_12](IVkObjectParams.md#vk_alphabeta_12) +- [vk_beta_2](IVkObjectParams.md#vk_beta_2) +- [vk_delta_2](IVkObjectParams.md#vk_delta_2) +- [vk_gamma_2](IVkObjectParams.md#vk_gamma_2) + +## Properties + +### IC + +• **IC**: `BigNumberish`[][] + +#### Defined in + +[types.ts:72](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/types.ts#L72) + +--- + +### curve + +• **curve**: `BigNumberish` + +#### Defined in + +[types.ts:65](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/types.ts#L65) + +--- + +### nPublic + +• **nPublic**: `BigNumberish` + +#### Defined in + +[types.ts:66](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/types.ts#L66) + +--- + +### protocol + +• **protocol**: `BigNumberish` + +#### Defined in + +[types.ts:64](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/types.ts#L64) + +--- + +### vk_alpha_1 + +• **vk_alpha_1**: `BigNumberish`[] + +#### Defined in + +[types.ts:67](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/types.ts#L67) + +--- + +### vk_alphabeta_12 + +• **vk_alphabeta_12**: `BigNumberish`[][][] + +#### Defined in + +[types.ts:71](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/types.ts#L71) + +--- + +### vk_beta_2 + +• **vk_beta_2**: `BigNumberish`[][] + +#### Defined in + +[types.ts:68](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/types.ts#L68) + +--- + +### vk_delta_2 + +• **vk_delta_2**: `BigNumberish`[][] + +#### Defined in + +[types.ts:70](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/types.ts#L70) + +--- + +### vk_gamma_2 + +• **vk_gamma_2**: `BigNumberish`[][] + +#### Defined in + +[types.ts:69](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/types.ts#L69) diff --git a/website/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/Proof.md b/website/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/Proof.md new file mode 100644 index 0000000000..f7d0b09761 --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/Proof.md @@ -0,0 +1,46 @@ +--- +title: Proof +sidebar_label: Proof +--- + +**`Notice`** + +An interface representing a zk-SNARK proof + +## Table of contents + +### Properties + +- [a](Proof.md#a) +- [b](Proof.md#b) +- [c](Proof.md#c) + +## Properties + +### a + +• **a**: `G1Point` + +#### Defined in + +[types.ts:8](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/types.ts#L8) + +--- + +### b + +• **b**: `G2Point` + +#### Defined in + +[types.ts:9](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/types.ts#L9) + +--- + +### c + +• **c**: `G1Point` + +#### Defined in + +[types.ts:10](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/types.ts#L10) diff --git a/website/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/VoteOptionTreeLeaf.md b/website/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/VoteOptionTreeLeaf.md new file mode 100644 index 0000000000..8ce9cef85d --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/domainobjs/interfaces/VoteOptionTreeLeaf.md @@ -0,0 +1,24 @@ +--- +title: VoteOptionTreeLeaf +sidebar_label: VoteOptionTreeLeaf +--- + +**`Notice`** + +An interface representing a MACI vote option leaf + +## Table of contents + +### Properties + +- [votes](VoteOptionTreeLeaf.md#votes) + +## Properties + +### votes + +• **votes**: `bigint` + +#### Defined in + +[types.ts:25](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/types.ts#L25) diff --git a/website/versioned_docs/version-v1.2/typedoc/domainobjs/modules.md b/website/versioned_docs/version-v1.2/typedoc/domainobjs/modules.md new file mode 100644 index 0000000000..664b4f7e98 --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/domainobjs/modules.md @@ -0,0 +1,110 @@ +--- +title: Domainobjs Module +sidebar_label: module +sidebar_position: 1 +--- + +## Table of contents + +### Classes + +- [Ballot](classes/Ballot.md) +- [Keypair](classes/Keypair.md) +- [Message](classes/Message.md) +- [PCommand](classes/PCommand.md) +- [PrivKey](classes/PrivKey.md) +- [PubKey](classes/PubKey.md) +- [StateLeaf](classes/StateLeaf.md) +- [TCommand](classes/TCommand.md) +- [VerifyingKey](classes/VerifyingKey.md) + +### Interfaces + +- [ICommand](interfaces/ICommand.md) +- [IG1ContractParams](interfaces/IG1ContractParams.md) +- [IG2ContractParams](interfaces/IG2ContractParams.md) +- [IJsonBallot](interfaces/IJsonBallot.md) +- [IJsonCommand](interfaces/IJsonCommand.md) +- [IJsonKeyPair](interfaces/IJsonKeyPair.md) +- [IJsonPCommand](interfaces/IJsonPCommand.md) +- [IJsonStateLeaf](interfaces/IJsonStateLeaf.md) +- [IJsonTCommand](interfaces/IJsonTCommand.md) +- [IMessageContractParams](interfaces/IMessageContractParams.md) +- [IStateLeaf](interfaces/IStateLeaf.md) +- [IStateLeafContractParams](interfaces/IStateLeafContractParams.md) +- [IVkContractParams](interfaces/IVkContractParams.md) +- [IVkObjectParams](interfaces/IVkObjectParams.md) +- [Proof](interfaces/Proof.md) +- [VoteOptionTreeLeaf](interfaces/VoteOptionTreeLeaf.md) + +### Type Aliases + +- [IJsonPrivateKey](modules.md#ijsonprivatekey) +- [IJsonPublicKey](modules.md#ijsonpublickey) + +### Variables + +- [SERIALIZED_PRIV_KEY_PREFIX](modules.md#serialized_priv_key_prefix) +- [SERIALIZED_PUB_KEY_PREFIX](modules.md#serialized_pub_key_prefix) +- [blankStateLeaf](modules.md#blankstateleaf) +- [blankStateLeafHash](modules.md#blankstateleafhash) + +## Type Aliases + +### IJsonPrivateKey + +Ƭ **IJsonPrivateKey**: `Pick`\<[`IJsonKeyPair`](interfaces/IJsonKeyPair.md), `"privKey"`\> + +#### Defined in + +[types.ts:33](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/types.ts#L33) + +--- + +### IJsonPublicKey + +Ƭ **IJsonPublicKey**: `Pick`\<[`IJsonKeyPair`](interfaces/IJsonKeyPair.md), `"pubKey"`\> + +#### Defined in + +[types.ts:35](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/types.ts#L35) + +## Variables + +### SERIALIZED_PRIV_KEY_PREFIX + +• `Const` **SERIALIZED_PRIV_KEY_PREFIX**: `"macisk."` + +#### Defined in + +[privateKey.ts:5](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/privateKey.ts#L5) + +--- + +### SERIALIZED_PUB_KEY_PREFIX + +• `Const` **SERIALIZED_PUB_KEY_PREFIX**: `"macipk."` + +#### Defined in + +[publicKey.ts:7](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/publicKey.ts#L7) + +--- + +### blankStateLeaf + +• `Const` **blankStateLeaf**: [`StateLeaf`](classes/StateLeaf.md) + +#### Defined in + +[constants.ts:3](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/constants.ts#L3) + +--- + +### blankStateLeafHash + +• `Const` **blankStateLeafHash**: `bigint` + +#### Defined in + +[constants.ts:4](https://github.com/privacy-scaling-explorations/maci/blob/6a905de08/domainobjs/ts/constants.ts#L4) diff --git a/website/versioned_docs/version-v1.2/typedoc/index.md b/website/versioned_docs/version-v1.2/typedoc/index.md new file mode 100644 index 0000000000..f11403ef2f --- /dev/null +++ b/website/versioned_docs/version-v1.2/typedoc/index.md @@ -0,0 +1,4 @@ +--- +title: Typedoc +sidebar_label: Typedoc +--- diff --git a/website/versioned_docs/version-v1.2/versioning.md b/website/versioned_docs/version-v1.2/versioning.md index 6f5455bc9c..05132b44db 100644 --- a/website/versioned_docs/version-v1.2/versioning.md +++ b/website/versioned_docs/version-v1.2/versioning.md @@ -11,7 +11,7 @@ This document outlines the approach to versioning and releasing the MACI project ## MACI code -MACI code consists 3 core parts: Circom circuits, Solidity contracts and JS (TS) libraries, from which we release a total of 7 NPM packages. See the [codebase overview](/docs/overview) for more details. +MACI code consists 3 core parts: Circom circuits, Solidity contracts and JS (TS) libraries, from which we release a total of 7 NPM packages. See the [codebase overview](/docs/v1.2/overview) for more details. ## MACI versioning diff --git a/website/versioned_docs/version-v1.2/workflow.md b/website/versioned_docs/version-v1.2/workflow.md index 21cf7ead03..50c583a46d 100644 --- a/website/versioned_docs/version-v1.2/workflow.md +++ b/website/versioned_docs/version-v1.2/workflow.md @@ -65,15 +65,15 @@ Therefore, even if a coordinator is corrupt, they are unable to change a user’ To explain the MACI workflow, let's give a quick overview of the key smart contracts. -See our [smart contract docs](/docs/contracts) or our [contract source code](https://github.com/privacy-scaling-explorations/maci/tree/dev/contracts/contracts) for a more in-depth explanation of all smart contracts. +See our [smart contract docs](/docs/v1.2/contracts) or our [contract source code](https://github.com/privacy-scaling-explorations/maci/tree/dev/contracts/contracts) for a more in-depth explanation of all smart contracts. ### MACI.sol -The MACI contract is responsible for registering user signups by recording the initial public key for each user (via the [`signUp` function](/docs/solidity-docs/MACI#signup-1)). To conduct a voting round, the coordinator can deploy a Poll via MACI (with the [`deployPoll` function](/docs/solidity-docs/MACI#deploypoll)). +The MACI contract is responsible for registering user signups by recording the initial public key for each user (via the [`signUp` function](/docs/v1.2/solidity-docs/MACI#signup-1)). To conduct a voting round, the coordinator can deploy a Poll via MACI (with the [`deployPoll` function](/docs/v1.2/solidity-docs/MACI#deploypoll)). ### Poll.sol -The Poll contract is where users submit their votes (via the [`publishMessage` function](/docs/typedoc/core/classes/Poll#publishmessage)). One MACI contract can be used for multiple Poll contracts. In other words, a user that signed up to the MACI contract can vote on multiple issues, with each issue represented by a distinct Poll contract. +The Poll contract is where users submit their votes (via the [`publishMessage` function](/docs/v1.2/typedoc/core/classes/Poll#publishmessage)). One MACI contract can be used for multiple Poll contracts. In other words, a user that signed up to the MACI contract can vote on multiple issues, with each issue represented by a distinct Poll contract. ### MessageProcessor.sol and Tally.sol @@ -120,13 +120,13 @@ At this point, the coordinator must process all the messages, tally the results, Once the voting period has completed for a specific poll, the coordinator will use the `MessageProcessor` contract to first prove that they have correctly decrypted each message and applied them to correctly create an updated state tree. This state tree keeps an account of all the valid votes that should be counted. So, when processing the messages, the coordinator will not keep messages that are later overridden by a newer message inside the state tree. For example, if a user votes for option A, but then later sends a new message to vote for option B, the coordinator will only count the vote for option B. -The coordinator must process messages in batches so that proving on chain does not exceed the data limit. The coordinator then creates a zk-SNARK proving their state tree correctly contains only the valid messages. Once the proof is ready, the coordinator calls [`MessageProcessor.processMessages()`](/docs/solidity-docs/MessageProcessor#processmessages), providing a hash of the state tree and the zk-SNARK proof as an input parameters. +The coordinator must process messages in batches so that proving on chain does not exceed the data limit. The coordinator then creates a zk-SNARK proving their state tree correctly contains only the valid messages. Once the proof is ready, the coordinator calls [`MessageProcessor.processMessages()`](/docs/v1.2/solidity-docs/MessageProcessor#processmessages), providing a hash of the state tree and the zk-SNARK proof as an input parameters. The `MessageProcessor` contract will send the proof to a separate verifier contract. The verifier contract is specifically built to read MACI zk-SNARK proofs and tell if they are valid or not. So, if the verifier contract returns true, then everyone can see on-chain that the coordinator correctly processed that batch of messages. The coordinator repeats this process until all messages have been processed. #### Tally Results -Finally, once all messages have been processed, the coordinator tallies the votes of the valid messages (off-chain). The coordinator creates a zk-SNARK proving that the valid messages in the state tree (proved in Process Messages step) contain votes that sum to the given tally result. Then, they call [`Tally.tallyVotes()`](/docs/solidity-docs/Tally#tallyvotes) with a hash of the correct tally results and the zk-SNARK proof. Similarly to the processMessages function, the `tallyVotes` function will send the proof to a verifier contract to ensure that it is valid. +Finally, once all messages have been processed, the coordinator tallies the votes of the valid messages (off-chain). The coordinator creates a zk-SNARK proving that the valid messages in the state tree (proved in Process Messages step) contain votes that sum to the given tally result. Then, they call [`Tally.tallyVotes()`](/docs/v1.2/solidity-docs/Tally#tallyvotes) with a hash of the correct tally results and the zk-SNARK proof. Similarly to the processMessages function, the `tallyVotes` function will send the proof to a verifier contract to ensure that it is valid.