-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(protocol): update risc0 verifier contract to release-1.0 (#17776)
- Loading branch information
Showing
3 changed files
with
13 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ import "./libs/LibPublicInput.sol"; | |
/// @custom:security-contact [email protected] | ||
contract RiscZeroVerifier is EssentialContract, IVerifier { | ||
/// @notice RISC Zero remote verifier contract address, e.g.: | ||
/// https://sepolia.etherscan.io/address/0x83c2e9cd64b2a16d3908e94c7654f3864212e2f8 | ||
/// https://sepolia.etherscan.io/address/0x3d24C84FC1A2B26f9229e58ddDf11A8dfba802d0 | ||
IRiscZeroReceiptVerifier public receiptVerifier; | ||
/// @notice Trusted imageId mapping | ||
mapping(bytes32 imageId => bool trusted) public isImageTrusted; | ||
|
@@ -65,8 +65,7 @@ contract RiscZeroVerifier is EssentialContract, IVerifier { | |
if (_ctx.isContesting) return; | ||
|
||
// Decode will throw if not proper length/encoding | ||
(bytes memory seal, bytes32 imageId, bytes32 postStateDigest) = | ||
abi.decode(_proof.data, (bytes, bytes32, bytes32)); | ||
(bytes memory seal, bytes32 imageId) = abi.decode(_proof.data, (bytes, bytes32)); | ||
|
||
if (!isImageTrusted[imageId]) { | ||
revert RISC_ZERO_INVALID_IMAGE_ID(); | ||
|
@@ -80,7 +79,12 @@ contract RiscZeroVerifier is EssentialContract, IVerifier { | |
// journalDigest is the sha256 hash of the hashed public input | ||
bytes32 journalDigest = sha256(bytes.concat(hash)); | ||
|
||
if (!receiptVerifier.verify(seal, imageId, postStateDigest, journalDigest)) { | ||
// call risc0 verifier contract | ||
(bool success,) = address(receiptVerifier).staticcall( | ||
abi.encodeCall(IRiscZeroReceiptVerifier.verify, (seal, imageId, journalDigest)) | ||
); | ||
|
||
if (!success) { | ||
revert RISC_ZERO_INVALID_PROOF(); | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters