ZkVerifier
Inherits: Ownable, IZkVerifier
Title: Zero-knowledge verifier wrapper
Author: Malda Protocol
Ownable wrapper around the Risc0 verifier with configurable imageId
State Variables
verifier
Current Risc0 verifier contract
IRiscZeroVerifier public verifier
imageId
Current Risc0 image identifier
bytes32 public imageId
Functions
constructor
Initializes the verifier wrapper
constructor(address owner_, bytes32 _imageId, address _verifier) Ownable(owner_);
Parameters
| Name | Type | Description |
|---|---|---|
owner_ | address | Contract owner |
_imageId | bytes32 | Risc0 image identifier |
_verifier | address | Risc0 verifier contract address |
setVerifier
Sets the _risc0Verifier address
Admin check is needed on the external method
function setVerifier(address _risc0Verifier) external onlyOwner;
Parameters
| Name | Type | Description |
|---|---|---|
_risc0Verifier | address | the new IRiscZeroVerifier address |
setImageId
Sets the image id
Admin check is needed on the external method
function setImageId(bytes32 _imageId) external onlyOwner;
Parameters
| Name | Type | Description |
|---|---|---|
_imageId | bytes32 | the new image id |
verifyInput
Verifies an input
function verifyInput(bytes calldata journalEntry, bytes calldata seal) external view;
Parameters
| Name | Type | Description |
|---|---|---|
journalEntry | bytes | the risc0 journal entry |
seal | bytes | the risc0 seal |
Events
ImageSet
Emitted when the imageId is updated
event ImageSet(bytes32 _imageId);
Parameters
| Name | Type | Description |
|---|---|---|
_imageId | bytes32 | New image identifier |
VerifierSet
Emitted when the verifier contract address is updated
event VerifierSet(address indexed oldVerifier, address indexed newVerifier);
Parameters
| Name | Type | Description |
|---|---|---|
oldVerifier | address | Previous verifier address |
newVerifier | address | New verifier address |
Errors
ZkVerifier_ImageNotValid
Error thrown when the image id is not valid
error ZkVerifier_ImageNotValid();
ZkVerifier_InputNotValid
Error thrown when the input is not valid
error ZkVerifier_InputNotValid();
ZkVerifier_VerifierNotSet
Error thrown when the verifier is not set
error ZkVerifier_VerifierNotSet();