@@ -5,6 +5,7 @@ import {ISP1Verifier, ISP1VerifierWithHash} from "./ISP1Verifier.sol";
55import {PlonkVerifier} from "./PlonkVerifier.sol " ;
66
77/// @title SP1 Verifier
8+ /// @author Succinct Labs
89/// @notice This contracts implements a solidity verifier for SP1.
910contract SP1Verifier is PlonkVerifier , ISP1VerifierWithHash {
1011 /// @notice Thrown when the verifier selector from this proof does not match the one in this
@@ -16,22 +17,32 @@ contract SP1Verifier is PlonkVerifier, ISP1VerifierWithHash {
1617 /// @notice Thrown when the proof is invalid.
1718 error InvalidProof ();
1819
20+ function VERSION () external pure returns (string memory ) {
21+ return "v5.0.0 " ;
22+ }
23+
1924 /// @inheritdoc ISP1VerifierWithHash
2025 function VERIFIER_HASH () public pure returns (bytes32 ) {
21- return 0xffea2d2e12ed24da258af874d77eee7ee91a1e050ee197052908089e57681e67 ;
26+ return 0xd4e8ecd2357dd882209800acd6abb443d231cf287d77ba62b732ce937c8b56e7 ;
2227 }
2328
2429 /// @notice Hashes the public values to a field elements inside Bn254.
2530 /// @param publicValues The public values.
26- function hashPublicValues (bytes calldata publicValues ) public pure returns (bytes32 ) {
31+ function hashPublicValues (
32+ bytes calldata publicValues
33+ ) public pure returns (bytes32 ) {
2734 return sha256 (publicValues) & bytes32 (uint256 ((1 << 253 ) - 1 ));
2835 }
2936
3037 /// @notice Verifies a proof with given public values and vkey.
3138 /// @param programVKey The verification key for the RISC-V program.
3239 /// @param publicValues The public values encoded as bytes.
3340 /// @param proofBytes The proof of the program execution the SP1 zkVM encoded as bytes.
34- function verifyProof (bytes32 programVKey , bytes calldata publicValues , bytes calldata proofBytes ) external view {
41+ function verifyProof (
42+ bytes32 programVKey ,
43+ bytes calldata publicValues ,
44+ bytes calldata proofBytes
45+ ) external view {
3546 bytes4 receivedSelector = bytes4 (proofBytes[:4 ]);
3647 bytes4 expectedSelector = bytes4 (VERIFIER_HASH ());
3748 if (receivedSelector != expectedSelector) {
@@ -47,4 +58,4 @@ contract SP1Verifier is PlonkVerifier, ISP1VerifierWithHash {
4758 revert InvalidProof ();
4859 }
4960 }
50- }
61+ }
0 commit comments