Skip to main content
Version: v3.x

VerifyingKeysRegistry

Stores verifying keys for the circuits. Each circuit has a signature which is its compile-time constants represented as a uint256.

processVerifyingKeys​

mapping(enum DomainObjs.Mode => mapping(uint256 => struct SnarkCommon.VerifyingKey)) processVerifyingKeys

processVerifyingKeysSet​

mapping(enum DomainObjs.Mode => mapping(uint256 => bool)) processVerifyingKeysSet

tallyVerifyingKeys​

mapping(enum DomainObjs.Mode => mapping(uint256 => struct SnarkCommon.VerifyingKey)) tallyVerifyingKeys

tallyVerifyingKeysSet​

mapping(enum DomainObjs.Mode => mapping(uint256 => bool)) tallyVerifyingKeysSet

pollJoiningVerifyingKeys​

mapping(uint256 => struct SnarkCommon.VerifyingKey) pollJoiningVerifyingKeys

pollJoiningVerifyingKeysSet​

mapping(uint256 => bool) pollJoiningVerifyingKeysSet

pollJoinedVerifyingKeys​

mapping(uint256 => struct SnarkCommon.VerifyingKey) pollJoinedVerifyingKeys

pollJoinedVerifyingKeysSet​

mapping(uint256 => bool) pollJoinedVerifyingKeysSet

PollJoiningVerifyingKeySet​

event PollJoiningVerifyingKeySet(uint256 _signature)

PollJoinedVerifyingKeySet​

event PollJoinedVerifyingKeySet(uint256 _signature)

ProcessVerifyingKeySet​

event ProcessVerifyingKeySet(uint256 _signature, enum DomainObjs.Mode _mode)

TallyVerifyingKeySet​

event TallyVerifyingKeySet(uint256 _signature, enum DomainObjs.Mode _mode)

VerifyingKeyAlreadySet​

error VerifyingKeyAlreadySet()

VerifyingKeyNotSet​

error VerifyingKeyNotSet()

InvalidKeysParams​

error InvalidKeysParams()

constructor​

constructor(address _initialOwner) public payable

Create a new instance of the VerifyingKeysRegistry contract

isPollJoiningVerifyingKeySet​

function isPollJoiningVerifyingKeySet(uint256 _signature) public view returns (bool isSet)

Check if the poll joining verifying key is set

Parameters​

NameTypeDescription
_signatureuint256The signature

Return Values​

NameTypeDescription
isSetboolwhether the verifying key is set

isPollJoinedVerifyingKeySet​

function isPollJoinedVerifyingKeySet(uint256 _signature) public view returns (bool isSet)

Check if the poll joined verifying key is set

Parameters​

NameTypeDescription
_signatureuint256The signature

Return Values​

NameTypeDescription
isSetboolwhether the verifying key is set

isProcessVerifyingKeySet​

function isProcessVerifyingKeySet(uint256 _signature, enum DomainObjs.Mode _mode) public view returns (bool isSet)

Check if the process verifying key is set

Parameters​

NameTypeDescription
_signatureuint256The signature
_modeenum DomainObjs.ModeQV, Non-QV, Full

Return Values​

NameTypeDescription
isSetboolwhether the verifying key is set

isTallyVerifyingKeySet​

function isTallyVerifyingKeySet(uint256 _signature, enum DomainObjs.Mode _mode) public view returns (bool isSet)

Check if the tally verifying key is set

Parameters​

NameTypeDescription
_signatureuint256The signature
_modeenum DomainObjs.ModeQV, Non-QV, Full

Return Values​

NameTypeDescription
isSetboolwhether the verifying key is set

generatePollJoiningVerifyingKeySignature​

function generatePollJoiningVerifyingKeySignature(uint256 _stateTreeDepth) public pure returns (uint256 signature)

generate the signature for the poll joining verifying key

Parameters​

NameTypeDescription
_stateTreeDepthuint256The state tree depth

generatePollJoinedVerifyingKeySignature​

function generatePollJoinedVerifyingKeySignature(uint256 _stateTreeDepth) public pure returns (uint256 signature)

generate the signature for the poll joined verifying key

Parameters​

NameTypeDescription
_stateTreeDepthuint256The state tree depth

generateProcessVerifyingKeySignature​

function generateProcessVerifyingKeySignature(uint256 _stateTreeDepth, uint256 _voteOptionTreeDepth, uint8 _messageBatchSize) public pure returns (uint256 signature)

generate the signature for the process verifying key

Parameters​

NameTypeDescription
_stateTreeDepthuint256The state tree depth
_voteOptionTreeDepthuint256The vote option tree depth
_messageBatchSizeuint8The message batch size

generateTallyVerifyingKeySignature​

function generateTallyVerifyingKeySignature(uint256 _stateTreeDepth, uint256 _intStateTreeDepth, uint256 _voteOptionTreeDepth) public pure returns (uint256 signature)

generate the signature for the tally verifying key

Parameters​

NameTypeDescription
_stateTreeDepthuint256The state tree depth
_intStateTreeDepthuint256The intermediate state tree depth
_voteOptionTreeDepthuint256The vote option tree depth

Return Values​

NameTypeDescription
signatureuint256The signature

setVerifyingKeysBatch​

function setVerifyingKeysBatch(struct IVerifyingKeysRegistry.SetVerifyingKeysBatchArgs _args) public

Set the process and tally verifying keys for a certain combination of parameters and modes

Parameters​

NameTypeDescription
_argsstruct IVerifyingKeysRegistry.SetVerifyingKeysBatchArgsThe verifying keys arguments

setVerifyingKeys​

function setVerifyingKeys(uint256 _stateTreeDepth, uint256 _intStateTreeDepth, uint256 _voteOptionTreeDepth, uint8 _messageBatchSize, enum DomainObjs.Mode _mode, struct SnarkCommon.VerifyingKey _processVerifyingKey, struct SnarkCommon.VerifyingKey _tallyVerifyingKey) public

Set the process and tally verifying keys for a certain combination

Parameters​

NameTypeDescription
_stateTreeDepthuint256The state tree depth
_intStateTreeDepthuint256The intermediate state tree depth
_voteOptionTreeDepthuint256The vote option tree depth
_messageBatchSizeuint8The message batch size
_modeenum DomainObjs.ModeQV, Non-QV, Full
_processVerifyingKeystruct SnarkCommon.VerifyingKeyThe process verifying key
_tallyVerifyingKeystruct SnarkCommon.VerifyingKeyThe tally verifying key

setProcessVerifyingKey​

function setProcessVerifyingKey(uint256 _stateTreeDepth, uint256 _voteOptionTreeDepth, uint8 _messageBatchSize, enum DomainObjs.Mode _mode, struct SnarkCommon.VerifyingKey _processVerifyingKey) public

Set the process verifying key for a certain combination of parameters

Parameters​

NameTypeDescription
_stateTreeDepthuint256The state tree depth
_voteOptionTreeDepthuint256The vote option tree depth
_messageBatchSizeuint8The message batch size
_modeenum DomainObjs.ModeQV, Non-QV, Full
_processVerifyingKeystruct SnarkCommon.VerifyingKeyThe process verifying key

setTallyVerifyingKey​

function setTallyVerifyingKey(uint256 _stateTreeDepth, uint256 _intStateTreeDepth, uint256 _voteOptionTreeDepth, enum DomainObjs.Mode _mode, struct SnarkCommon.VerifyingKey _tallyVerifyingKey) public

Set the tally verifying key for a certain combination of parameters

Parameters​

NameTypeDescription
_stateTreeDepthuint256The state tree depth
_intStateTreeDepthuint256The intermediate state tree depth
_voteOptionTreeDepthuint256The vote option tree depth
_modeenum DomainObjs.ModeQV, Non-QV, Full
_tallyVerifyingKeystruct SnarkCommon.VerifyingKeyThe tally verifying key

setPollJoiningVerifyingKey​

function setPollJoiningVerifyingKey(uint256 _stateTreeDepth, struct SnarkCommon.VerifyingKey _pollJoiningVerifyingKey) public

Set the poll joining verifying key for a certain combination of parameters

Parameters​

NameTypeDescription
_stateTreeDepthuint256The state tree depth
_pollJoiningVerifyingKeystruct SnarkCommon.VerifyingKeyThe poll joining verifying key

setPollJoinedVerifyingKey​

function setPollJoinedVerifyingKey(uint256 _stateTreeDepth, struct SnarkCommon.VerifyingKey _pollJoinedVerifyingSignature) public

Set the poll joined verifying key for a certain combination of parameters

Parameters​

NameTypeDescription
_stateTreeDepthuint256The state tree depth
_pollJoinedVerifyingSignaturestruct SnarkCommon.VerifyingKeyThe poll joined verifying key

hasProcessVerifyingKey​

function hasProcessVerifyingKey(uint256 _stateTreeDepth, uint256 _voteOptionTreeDepth, uint8 _messageBatchSize, enum DomainObjs.Mode _mode) public view returns (bool isSet)

Check if the process verifying key is set

Parameters​

NameTypeDescription
_stateTreeDepthuint256The state tree depth
_voteOptionTreeDepthuint256The vote option tree depth
_messageBatchSizeuint8The message batch size
_modeenum DomainObjs.ModeQV, Non-QV, Full

Return Values​

NameTypeDescription
isSetboolwhether the verifying key is set

getProcessVerifyingKeyBySignature​

function getProcessVerifyingKeyBySignature(uint256 _signature, enum DomainObjs.Mode _mode) public view returns (struct SnarkCommon.VerifyingKey verifyingKey)

Get the process verifying key by signature

Parameters​

NameTypeDescription
_signatureuint256The signature
_modeenum DomainObjs.ModeQV, Non-QV, Full

Return Values​

NameTypeDescription
verifyingKeystruct SnarkCommon.VerifyingKeyThe verifying key

getProcessVerifyingKey​

function getProcessVerifyingKey(uint256 _stateTreeDepth, uint256 _voteOptionTreeDepth, uint8 _messageBatchSize, enum DomainObjs.Mode _mode) public view returns (struct SnarkCommon.VerifyingKey verifyingKey)

Get the process verifying key

Parameters​

NameTypeDescription
_stateTreeDepthuint256The state tree depth
_voteOptionTreeDepthuint256The vote option tree depth
_messageBatchSizeuint8The message batch size
_modeenum DomainObjs.ModeQV, Non-QV, Full

Return Values​

NameTypeDescription
verifyingKeystruct SnarkCommon.VerifyingKeyThe verifying key

hasTallyVerifyingKey​

function hasTallyVerifyingKey(uint256 _stateTreeDepth, uint256 _intStateTreeDepth, uint256 _voteOptionTreeDepth, enum DomainObjs.Mode _mode) public view returns (bool isSet)

Check if the tally verifying key is set

Parameters​

NameTypeDescription
_stateTreeDepthuint256The state tree depth
_intStateTreeDepthuint256The intermediate state tree depth
_voteOptionTreeDepthuint256The vote option tree depth
_modeenum DomainObjs.ModeQV, Non-QV, Full

Return Values​

NameTypeDescription
isSetboolwhether the verifying key is set

getTallyVerifyingKeyBySignature​

function getTallyVerifyingKeyBySignature(uint256 _signature, enum DomainObjs.Mode _mode) public view returns (struct SnarkCommon.VerifyingKey verifyingKey)

Get the tally verifying key by signature

Parameters​

NameTypeDescription
_signatureuint256The signature
_modeenum DomainObjs.ModeQV, Non-QV, Full

Return Values​

NameTypeDescription
verifyingKeystruct SnarkCommon.VerifyingKeyThe verifying key

getTallyVerifyingKey​

function getTallyVerifyingKey(uint256 _stateTreeDepth, uint256 _intStateTreeDepth, uint256 _voteOptionTreeDepth, enum DomainObjs.Mode _mode) public view returns (struct SnarkCommon.VerifyingKey verifyingKey)

Get the tally verifying key

Parameters​

NameTypeDescription
_stateTreeDepthuint256The state tree depth
_intStateTreeDepthuint256The intermediate state tree depth
_voteOptionTreeDepthuint256The vote option tree depth
_modeenum DomainObjs.ModeQV, Non-QV, Full

Return Values​

NameTypeDescription
verifyingKeystruct SnarkCommon.VerifyingKeyThe verifying key

getPollJoiningVerifyingKeyBySignature​

function getPollJoiningVerifyingKeyBySignature(uint256 _signature) public view returns (struct SnarkCommon.VerifyingKey verifyingKey)

Get the poll joining verifying key by signature

Parameters​

NameTypeDescription
_signatureuint256The signature

Return Values​

NameTypeDescription
verifyingKeystruct SnarkCommon.VerifyingKeyThe verifying key

getPollJoinedVerifyingKeyBySignature​

function getPollJoinedVerifyingKeyBySignature(uint256 _signature) public view returns (struct SnarkCommon.VerifyingKey verifyingKey)

Get the poll joined verifying key by signature

Parameters​

NameTypeDescription
_signatureuint256The signature

Return Values​

NameTypeDescription
verifyingKeystruct SnarkCommon.VerifyingKeyThe verifying key

getPollJoiningVerifyingKey​

function getPollJoiningVerifyingKey(uint256 _stateTreeDepth) public view returns (struct SnarkCommon.VerifyingKey verifyingKey)

Get the poll joining verifying key

Parameters​

NameTypeDescription
_stateTreeDepthuint256The state tree depth

Return Values​

NameTypeDescription
verifyingKeystruct SnarkCommon.VerifyingKeyThe verifying key

getPollJoinedVerifyingKey​

function getPollJoinedVerifyingKey(uint256 _stateTreeDepth) public view returns (struct SnarkCommon.VerifyingKey verifyingKey)

Get the poll joined verifying key

Parameters​

NameTypeDescription
_stateTreeDepthuint256The state tree depth

Return Values​

NameTypeDescription
verifyingKeystruct SnarkCommon.VerifyingKeyThe verifying key