VkRegistry
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
ProcessVkSet
event ProcessVkSet(uint256 _sig, enum DomainObjs.Mode _mode)
TallyVkSet
event TallyVkSet(uint256 _sig, enum DomainObjs.Mode _mode)
ProcessVkAlreadySet
error ProcessVkAlreadySet()
TallyVkAlreadySet
error TallyVkAlreadySet()
ProcessVkNotSet
error ProcessVkNotSet()
TallyVkNotSet
error TallyVkNotSet()
SubsidyVkNotSet
error SubsidyVkNotSet()
InvalidKeysParams
error InvalidKeysParams()
constructor
constructor() public payable
Create a new instance of the VkRegistry contract
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 |
genProcessVkSig
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
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(uint256 _stateTreeDepth, uint256 _intStateTreeDepth, uint256 _messageTreeDepth, uint256 _voteOptionTreeDepth, uint256 _messageBatchSize, enum DomainObjs.Mode[] _modes, struct SnarkCommon.VerifyingKey[] _processVks, struct SnarkCommon.VerifyingKey[] _tallyVks) public
Set the process and tally verifying keys for a certain combination of parameters and modes
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 |
_modes | enum DomainObjs.Mode[] | Array of QV or Non-QV modes (must have the same length as process and tally keys) |
_processVks | struct SnarkCommon.VerifyingKey[] | The process verifying keys (must have the same length as modes) |
_tallyVks | struct SnarkCommon.VerifyingKey[] | The tally verifying keys (must have the same length as modes) |
setVerifyingKeys
function setVerifyingKeys(uint256 _stateTreeDepth, uint256 _intStateTreeDepth, uint256 _messageTreeDepth, uint256 _voteOptionTreeDepth, uint256 _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 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 |
_mode | enum DomainObjs.Mode | QV or Non-QV |
_processVk | struct SnarkCommon.VerifyingKey | The process verifying key |
_tallyVk | struct SnarkCommon.VerifyingKey | The tally verifying key |
hasProcessVk
function hasProcessVk(uint256 _stateTreeDepth, uint256 _messageTreeDepth, uint256 _voteOptionTreeDepth, uint256 _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 |
_messageTreeDepth | uint256 | The message tree depth |
_voteOptionTreeDepth | uint256 | The vote option tree depth |
_messageBatchSize | uint256 | 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 _messageTreeDepth, uint256 _voteOptionTreeDepth, uint256 _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 |
_messageTreeDepth | uint256 | The message tree depth |
_voteOptionTreeDepth | uint256 | The vote option tree depth |
_messageBatchSize | uint256 | 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 |