PinnedWithdrawVerifier
Inherits: IShieldedWithdrawVerifier
Title: PinnedWithdrawVerifier
Author: David Dada <daveproxy80@gmail.com> (https://github.com/dadadave80)
Example IShieldedWithdrawVerifier adapter: fits the generic IGroth16Verifier to a shielded
pool's 5-signal withdraw interface, with the circuit's verifying key compiled in. A consumer
subclasses it and returns their audited withdraw circuit's key from _verifyingKey as literals
(snarkjs vkey.json, G2 pairs swapped to (c1, c0)), then passes the subclass to createPool.
KEY PINNING, constant pattern. The generic verifier checks a proof against whatever key it is given, and whoever generates a key can know its trapdoor and forge a proof for any public signals. This adapter never takes a key from its caller or from storage: the key lives in bytecode, so every withdrawal from the pool is checked against one circuit. There is deliberately no setter; a new circuit means a new adapter and a new pool. Point groth16 at a verifier whose code cannot change under the pool (a standalone facet deployment, or a diamond whose cut authority you already trust). HashPinnedGroth16Verifier shows the stored-hash pattern for keys passed in calldata. EXAMPLE contract; not audited.
Note:
- security-contact: daveproxy80@gmail.com
Constants
groth16
The generic Groth16 verifier the pinned key is checked against.
IGroth16Verifier public immutable groth16;Functions
constructor
constructor(IGroth16Verifier groth16_);Parameters
| Name | Type | Description |
|---|---|---|
| groth16_ | IGroth16Verifier | A Groth16Verifier facet deployment, or a diamond that serves it. |
verifyProof
function verifyProof(
uint256[2] calldata a,
uint256[2][2] calldata b,
uint256[2] calldata c,
uint256[5] calldata input
) external view returns (bool);Parameters
| Name | Type | Description |
|---|---|---|
| a | uint256[2] | Groth16 proof point A. |
| b | uint256[2][2] | Groth16 proof point B. |
| c | uint256[2] | Groth16 proof point C. |
| input | uint256[5] | The public signals [root, nullifierHash, recipient, relayer, fee]. |
Returns
| Name | Type | Description |
|---|---|---|
| <none> | bool | True iff the proof is valid. |
_verifyingKey
The pinned key, with ic.length == 6. MUST return compile-time constants: no storage reads, no
constructor arguments, no calls.
function _verifyingKey() internal pure virtual returns (IGroth16Verifier.VerifyingKey memory vk);Returns
| Name | Type | Description |
|---|---|---|
| vk | IGroth16Verifier.VerifyingKey |
Errors
PinnedWithdrawVerifier__ZeroAddress
error PinnedWithdrawVerifier__ZeroAddress();