IPoll
Poll interface
joinPoll
function joinPoll(uint256 _nullifier, struct DomainObjs.PubKey _pubKey, uint256 _stateRootIndex, uint256[8] _proof, bytes _signUpPolicyData, bytes _initialVoiceCreditProxyData) external
Join the poll for voting
Parameters
Name | Type | Description |
---|---|---|
_nullifier | uint256 | Hashed user's private key to check whether user has already voted |
_pubKey | struct DomainObjs.PubKey | Poll user's public key |
_stateRootIndex | uint256 | Index of the MACI's stateRootOnSignUp for which the inclusion proof is generated |
_proof | uint256[8] | The zk-SNARK proof |
_signUpPolicyData | bytes | Data to pass to the signup policy |
_initialVoiceCreditProxyData | bytes | Data to pass to the InitialVoiceCreditProxy |
numSignUpsAndMessages
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 |
getBatchHashes
function getBatchHashes() external view returns (uint256[])
Get all message batch hashes
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256[] | betchHashes array containing all batch hashes |
padLastBatch
function padLastBatch() external
Pad last unclosed batch
publishMessage
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 ephemeral 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
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 |
relayMessagesBatch
function relayMessagesBatch(uint256[] _messageHashes, bytes32 _ipfsHash) external
Allows relayer to publish messages using IPFS.
Parameters
Name | Type | Description |
---|---|---|
_messageHashes | uint256[] | The message hashes |
_ipfsHash | bytes32 | The IPFS hash of the messages batch |
mergeState
function mergeState() external
The second step of merging the poll state. This allows the ProcessMessages circuit to access the latest state tree and ballots via currentSbCommitment.
getStartAndEndDate
function getStartAndEndDate() external view returns (uint256 _startDate, uint256 _endDate)
Returns the Poll's start and end dates
Return Values
Name | Type | Description |
---|---|---|
_startDate | uint256 | The start date of the poll |
_endDate | uint256 | The end date of the poll |
endDate
function endDate() external view returns (uint256)
Returns the Poll's end date
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | _endDate The end date of the poll |
startDate
function startDate() external view returns (uint256)
Returns the Poll's start date
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | _startDate The start date of the poll |
stateMerged
function stateMerged() 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
function treeDepths() external view returns (uint8 intStateTreeDepth, uint8 voteOptionTreeDepth)
Get the depths of the merkle trees
Return Values
Name | Type | Description |
---|---|---|
intStateTreeDepth | uint8 | The depth of the state tree |
voteOptionTreeDepth | uint8 | The subdepth of the vote option tree |
voteOptions
function voteOptions() external view returns (uint256)
Get the number of vote options for the poll
Return Values
Name | Type | Description |
---|---|---|
[0] | uint256 | voteOptions The number of vote options |
messageBatchSize
function messageBatchSize() external view returns (uint8)
Get message batch size for the poll
Return Values
Name | Type | Description |
---|---|---|
[0] | uint8 | The message batch size |
coordinatorPubKeyHash
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
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 |
actualStateTreeDepth
function actualStateTreeDepth() external view returns (uint8)
Get the dynamic depth of the state tree at the time of poll finalization (based on the number of leaves inserted)
getMaciContract
function getMaciContract() external view returns (contract IMACI maci)
Get the external contracts
Return Values
Name | Type | Description |
---|---|---|
maci | contract IMACI | The IMACI contract |
getStateIndex
function getStateIndex(uint256 element) external view returns (uint40)
Get the index of a state leaf in the state tree
Parameters
Name | Type | Description |
---|---|---|
element | uint256 | The hash of thestate leaf |
Return Values
Name | Type | Description |
---|---|---|
[0] | uint40 | index The index of the state leaf in the state tree |