SP1VerifierGateway
SP1VerifierGateway
This contract verifies proofs by routing to the correct verifier based on the verifier selector contained in the first 4 bytes of the proof. It additionally checks that to see that the verifier route is not frozen.
routes
mapping(bytes4 => struct VerifierRoute) routes
Mapping of 4-byte verifier selectors to verifier routes.
Only one verifier route can be added for each selector.
Parameters
| Name | Type | Description |
|---|
Return Values
| Name | Type | Description |
|---|
constructor
constructor(address initialOwner) public
verifyProof
function verifyProof(bytes32 programVKey, bytes publicValues, bytes proofBytes) external view
Verifies a proof with given public values and vkey.
It is expected that the first 4 bytes of proofBytes must match the first 4 bytes of target verifier's VERIFIER_HASH.
Parameters
| Name | Type | Description |
|---|---|---|
| programVKey | bytes32 | The verification key for the RISC-V program. |
| publicValues | bytes | The public values encoded as bytes. |
| proofBytes | bytes | The proof of the program execution the SP1 zkVM encoded as bytes. |
addRoute
function addRoute(address verifier) external
Adds a verifier route. This enable proofs to be routed to this verifier.
Only callable by the owner. The owner is responsible for ensuring that the specified verifier is correct with a valid VERIFIER_HASH. Once a route to a verifier is added, it cannot be removed.
Parameters
| Name | Type | Description |
|---|---|---|
| verifier | address | The address of the verifier contract. This verifier MUST implement the ISP1VerifierWithHash interface. |
freezeRoute
function freezeRoute(bytes4 selector) external
Freezes a verifier route. This prevents proofs from being routed to this verifier.
Only callable by the owner. Once a route to a verifier is frozen, it cannot be unfrozen.
Parameters
| Name | Type | Description |
|---|---|---|
| selector | bytes4 | The verifier selector to freeze. |