Skip to main content
Version: v2.0_alpha

IPoll

Poll interface

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

NameTypeDescription
numSignupsuint256The number of signups
numMsgsuint256The number of messages sent by voters

getBatchHashes

function getBatchHashes() external view returns (uint256[])

Get all message batch hashes

Return Values

NameTypeDescription
[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

NameTypeDescription
_messagestruct DomainObjs.MessageThe message to publish
_encPubKeystruct DomainObjs.PubKeyAn 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.

mergeMaciState

function mergeMaciState() external

The second step of merging the MACI state. This allows the ProcessMessages circuit to access the latest state tree and ballots via currentSbCommitment.

getDeployTimeAndDuration

function getDeployTimeAndDuration() external view returns (uint256 _deployTime, uint256 _duration)

Returns the Poll's deploy time and duration

Return Values

NameTypeDescription
_deployTimeuint256The deployment timestamp
_durationuint256The duration 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

NameTypeDescription
[0]boolWhether 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

NameTypeDescription
intStateTreeDepthuint8The depth of the state tree
voteOptionTreeDepthuint8The subdepth of the vote option tree

maxVoteOptions

function maxVoteOptions() external view returns (uint256)

Get the max vote options for the poll

Return Values

NameTypeDescription
[0]uint256maxVoteOptions The maximum number of vote options

messageBatchSize

function messageBatchSize() external view returns (uint8)

Get message batch size for the poll

Return Values

NameTypeDescription
[0]uint8The message batch size

coordinatorPubKeyHash

function coordinatorPubKeyHash() external view returns (uint256 _coordinatorPubKeyHash)

Get the hash of coordinator's public key

Return Values

NameTypeDescription
_coordinatorPubKeyHashuint256the 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

NameTypeDescription
[0]uint256The 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)

extContracts

function extContracts() external view returns (contract IMACI maci)

Get the external contracts

Return Values

NameTypeDescription
macicontract IMACIThe IMACI contract