Stores verifying keys for the circuits.
Each circuit has a signature which is its compile-time constants represented
as a uint256.
processVks
mapping(enum DomainObjs.Mode => mapping(uint256 => struct SnarkCommon.VerifyingKey)) processVks
processVkSet
mapping(enum DomainObjs.Mode => mapping(uint256 => bool)) processVkSet
tallyVks
mapping(enum DomainObjs.Mode => mapping(uint256 => struct SnarkCommon.VerifyingKey)) tallyVks
tallyVkSet
mapping(enum DomainObjs.Mode => mapping(uint256 => bool)) tallyVkSet
pollJoiningVks
mapping(uint256 => struct SnarkCommon.VerifyingKey) pollJoiningVks
pollJoiningVkSet
mapping(uint256 => bool) pollJoiningVkSet
pollJoinedVks
mapping(uint256 => struct SnarkCommon.VerifyingKey) pollJoinedVks
pollJoinedVkSet
mapping(uint256 => bool) pollJoinedVkSet
PollJoiningVkSet
event PollJoiningVkSet(uint256 _sig)
PollJoinedVkSet
event PollJoinedVkSet(uint256 _sig)
ProcessVkSet
event ProcessVkSet(uint256 _sig, enum DomainObjs.Mode _mode)
TallyVkSet
event TallyVkSet(uint256 _sig, enum DomainObjs.Mode _mode)
VkAlreadySet
VkNotSet
InvalidKeysParams
error InvalidKeysParams()
constructor
constructor() public payable
Create a new instance of the VkRegistry contract
isPollJoiningVkSet
function isPollJoiningVkSet(uint256 _sig) public view returns (bool isSet)
Check if the poll joining 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 |
isPollJoinedVkSet
function isPollJoinedVkSet(uint256 _sig) public view returns (bool isSet)
Check if the poll joined 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 |
isProcessVkSet
function isProcessVkSet(uint256 _sig, enum DomainObjs.Mode _mode) public view returns (bool isSet)
Check if the process verifying key is set
Parameters
Name | Type | Description |
---|
_sig | uint256 | The signature |
_mode | enum DomainObjs.Mode | QV or Non-QV |
Return Values
Name | Type | Description |
---|
isSet | bool | whether the verifying key is set |
isTallyVkSet
function isTallyVkSet(uint256 _sig, enum DomainObjs.Mode _mode) public view returns (bool isSet)
Check if the tally verifying key is set
Parameters
Name | Type | Description |
---|
_sig | uint256 | The signature |
_mode | enum DomainObjs.Mode | QV or Non-QV |
Return Values
Name | Type | Description |
---|
isSet | bool | whether the verifying key is set |
genPollJoiningVkSig
function genPollJoiningVkSig(uint256 _stateTreeDepth) public pure returns (uint256 sig)
generate the signature for the poll joining verifying key
Parameters
Name | Type | Description |
---|
_stateTreeDepth | uint256 | The state tree depth |
genPollJoinedVkSig
function genPollJoinedVkSig(uint256 _stateTreeDepth) public pure returns (uint256 sig)
generate the signature for the poll joined verifying key
Parameters
Name | Type | Description |
---|
_stateTreeDepth | uint256 | The state tree depth |
genProcessVkSig
function genProcessVkSig(uint256 _stateTreeDepth, uint256 _voteOptionTreeDepth, uint8 _messageBatchSize) public pure returns (uint256 sig)
generate the signature for the process verifying key
Parameters
Name | Type | Description |
---|
_stateTreeDepth | uint256 | The state tree depth |
_voteOptionTreeDepth | uint256 | The vote option tree depth |
_messageBatchSize | uint8 | The message batch size |
genTallyVkSig
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 |
setVerifyingKeysBatch
function setVerifyingKeysBatch(struct IVkRegistry.SetVerifyingKeysBatchArgs _args) public
Set the process and tally verifying keys for a certain combination
of parameters and modes
Parameters
Name | Type | Description |
---|
_args | struct IVkRegistry.SetVerifyingKeysBatchArgs | The verifying keys arguments |
setVerifyingKeys
function setVerifyingKeys(uint256 _stateTreeDepth, uint256 _intStateTreeDepth, uint256 _voteOptionTreeDepth, uint8 _messageBatchSize, enum DomainObjs.Mode _mode, struct SnarkCommon.VerifyingKey _processVk, struct SnarkCommon.VerifyingKey _tallyVk) public
Set the process and tally verifying keys for a certain combination
Parameters
Name | Type | Description |
---|
_stateTreeDepth | uint256 | The state tree depth |
_intStateTreeDepth | uint256 | The intermediate state tree depth |
_voteOptionTreeDepth | uint256 | The vote option tree depth |
_messageBatchSize | uint8 | The message batch size |
_mode | enum DomainObjs.Mode | QV or Non-QV |
_processVk | struct SnarkCommon.VerifyingKey | The process verifying key |
_tallyVk | struct SnarkCommon.VerifyingKey | The tally verifying key |
setProcessVkKey
function setProcessVkKey(uint256 _stateTreeDepth, uint256 _voteOptionTreeDepth, uint8 _messageBatchSize, enum DomainObjs.Mode _mode, struct SnarkCommon.VerifyingKey _processVk) public
Set the process verifying key for a certain combination of parameters
Parameters
Name | Type | Description |
---|
_stateTreeDepth | uint256 | The state tree depth |
_voteOptionTreeDepth | uint256 | The vote option tree depth |
_messageBatchSize | uint8 | The message batch size |
_mode | enum DomainObjs.Mode | QV or Non-QV |
_processVk | struct SnarkCommon.VerifyingKey | The process verifying key |
setTallyVkKey
function setTallyVkKey(uint256 _stateTreeDepth, uint256 _intStateTreeDepth, uint256 _voteOptionTreeDepth, enum DomainObjs.Mode _mode, struct SnarkCommon.VerifyingKey _tallyVk) public
Set the tally 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 |
_mode | enum DomainObjs.Mode | QV or Non-QV |
_tallyVk | struct SnarkCommon.VerifyingKey | The tally verifying key |
setPollJoiningVkKey
function setPollJoiningVkKey(uint256 _stateTreeDepth, struct SnarkCommon.VerifyingKey _pollJoiningVk) public
Set the poll joining verifying key for a certain combination of parameters
Parameters
Name | Type | Description |
---|
_stateTreeDepth | uint256 | The state tree depth |
_pollJoiningVk | struct SnarkCommon.VerifyingKey | The poll joining verifying key |
setPollJoinedVkKey
function setPollJoinedVkKey(uint256 _stateTreeDepth, struct SnarkCommon.VerifyingKey _pollJoinedVk) public
Set the poll joined verifying key for a certain combination of parameters
Parameters
Name | Type | Description |
---|
_stateTreeDepth | uint256 | The state tree depth |
_pollJoinedVk | struct SnarkCommon.VerifyingKey | The poll joined verifying key |
hasProcessVk
function hasProcessVk(uint256 _stateTreeDepth, uint256 _voteOptionTreeDepth, uint8 _messageBatchSize, enum DomainObjs.Mode _mode) public view returns (bool isSet)
Check if the process verifying key is set
Parameters
Name | Type | Description |
---|
_stateTreeDepth | uint256 | The state tree depth |
_voteOptionTreeDepth | uint256 | The vote option tree depth |
_messageBatchSize | uint8 | The message batch size |
_mode | enum DomainObjs.Mode | QV or Non-QV |
Return Values
Name | Type | Description |
---|
isSet | bool | whether the verifying key is set |
getProcessVkBySig
function getProcessVkBySig(uint256 _sig, enum DomainObjs.Mode _mode) public view returns (struct SnarkCommon.VerifyingKey vk)
Get the process verifying key by signature
Parameters
Name | Type | Description |
---|
_sig | uint256 | The signature |
_mode | enum DomainObjs.Mode | QV or Non-QV |
Return Values
Name | Type | Description |
---|
vk | struct SnarkCommon.VerifyingKey | The verifying key |
getProcessVk
function getProcessVk(uint256 _stateTreeDepth, uint256 _voteOptionTreeDepth, uint8 _messageBatchSize, enum DomainObjs.Mode _mode) public view returns (struct SnarkCommon.VerifyingKey vk)
Get the process verifying key
Parameters
Name | Type | Description |
---|
_stateTreeDepth | uint256 | The state tree depth |
_voteOptionTreeDepth | uint256 | The vote option tree depth |
_messageBatchSize | uint8 | The message batch size |
_mode | enum DomainObjs.Mode | QV or Non-QV |
Return Values
Name | Type | Description |
---|
vk | struct SnarkCommon.VerifyingKey | The verifying key |
hasTallyVk
function hasTallyVk(uint256 _stateTreeDepth, uint256 _intStateTreeDepth, uint256 _voteOptionTreeDepth, enum DomainObjs.Mode _mode) 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 |
_mode | enum DomainObjs.Mode | QV or Non-QV |
Return Values
Name | Type | Description |
---|
isSet | bool | whether the verifying key is set |
getTallyVkBySig
function getTallyVkBySig(uint256 _sig, enum DomainObjs.Mode _mode) public view returns (struct SnarkCommon.VerifyingKey vk)
Get the tally verifying key by signature
Parameters
Name | Type | Description |
---|
_sig | uint256 | The signature |
_mode | enum DomainObjs.Mode | QV or Non-QV |
Return Values
Name | Type | Description |
---|
vk | struct SnarkCommon.VerifyingKey | The verifying key |
getTallyVk
function getTallyVk(uint256 _stateTreeDepth, uint256 _intStateTreeDepth, uint256 _voteOptionTreeDepth, enum DomainObjs.Mode _mode) 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 |
_mode | enum DomainObjs.Mode | QV or Non-QV |
Return Values
Name | Type | Description |
---|
vk | struct SnarkCommon.VerifyingKey | The verifying key |
getPollJoiningVkBySig
function getPollJoiningVkBySig(uint256 _sig) public view returns (struct SnarkCommon.VerifyingKey vk)
Get the poll joining verifying key by signature
Parameters
Name | Type | Description |
---|
_sig | uint256 | The signature |
Return Values
Name | Type | Description |
---|
vk | struct SnarkCommon.VerifyingKey | The verifying key |
getPollJoinedVkBySig
function getPollJoinedVkBySig(uint256 _sig) public view returns (struct SnarkCommon.VerifyingKey vk)
Get the poll joined verifying key by signature
Parameters
Name | Type | Description |
---|
_sig | uint256 | The signature |
Return Values
Name | Type | Description |
---|
vk | struct SnarkCommon.VerifyingKey | The verifying key |
getPollJoiningVk
function getPollJoiningVk(uint256 _stateTreeDepth) public view returns (struct SnarkCommon.VerifyingKey vk)
Get the poll joining verifying key
Parameters
Name | Type | Description |
---|
_stateTreeDepth | uint256 | The state tree depth |
Return Values
Name | Type | Description |
---|
vk | struct SnarkCommon.VerifyingKey | The verifying key |
getPollJoinedVk
function getPollJoinedVk(uint256 _stateTreeDepth) public view returns (struct SnarkCommon.VerifyingKey vk)
Get the poll joined verifying key
Parameters
Name | Type | Description |
---|
_stateTreeDepth | uint256 | The state tree depth |
Return Values
Name | Type | Description |
---|
vk | struct SnarkCommon.VerifyingKey | The verifying key |