Skip to content

Commit 8c00f42

Browse files
authored
Feat: Upgrade Prover to SP1 v5, Integrate Morph-Reth as STF, and Replace zkTrie with MPT (#886)
1 parent 3a6022f commit 8c00f42

File tree

185 files changed

+42959
-3771345
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

185 files changed

+42959
-3771345
lines changed

contracts/contracts/libraries/verifier/ISP1Verifier.sol

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
pragma solidity =0.8.24;
33

44
/// @title SP1 Verifier Interface
5+
/// @author Succinct Labs
56
/// @notice This contract is the interface for the SP1 Verifier.
67
interface ISP1Verifier {
78
/// @notice Verifies a proof with given public values and vkey.
@@ -10,7 +11,11 @@ interface ISP1Verifier {
1011
/// @param programVKey The verification key for the RISC-V program.
1112
/// @param publicValues The public values encoded as bytes.
1213
/// @param proofBytes The proof of the program execution the SP1 zkVM encoded as bytes.
13-
function verifyProof(bytes32 programVKey, bytes calldata publicValues, bytes calldata proofBytes) external view;
14+
function verifyProof(
15+
bytes32 programVKey,
16+
bytes calldata publicValues,
17+
bytes calldata proofBytes
18+
) external view;
1419
}
1520

1621
interface ISP1VerifierWithHash is ISP1Verifier {

contracts/contracts/libraries/verifier/PlonkVerifier.sol

Lines changed: 104 additions & 95 deletions
Large diffs are not rendered by default.

contracts/contracts/libraries/verifier/SP1VerifierPlonk.sol

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {ISP1Verifier, ISP1VerifierWithHash} from "./ISP1Verifier.sol";
55
import {PlonkVerifier} from "./PlonkVerifier.sol";
66

77
/// @title SP1 Verifier
8+
/// @author Succinct Labs
89
/// @notice This contracts implements a solidity verifier for SP1.
910
contract 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+
}

contracts/contracts/test/ZkEvmVerifierV1.t.sol

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {ZkEvmVerifierV1} from "../libraries/verifier/ZkEvmVerifierV1.sol";
77

88
struct ProofFixture {
99
bytes proof;
10-
bytes publicValues;
10+
bytes32 publicValues;
1111
bytes32 vkey;
1212
}
1313

@@ -35,7 +35,7 @@ contract EvmTest is Test {
3535
// Prove state success.
3636
function test_ValidProof() public {
3737
ProofFixture memory fixture = loadFixture();
38-
evm.verifyPlonk(fixture.proof, fixture.publicValues);
38+
evm.verifyPlonk(fixture.proof, abi.encodePacked(fixture.publicValues));
3939
}
4040

4141
// Prove state fail.
@@ -44,6 +44,6 @@ contract EvmTest is Test {
4444
ProofFixture memory fixture = loadFixture();
4545
// Create a fake proof.
4646
fixture.proof[31] = 0x00;
47-
evm.verifyPlonk(fixture.proof, fixture.publicValues);
47+
evm.verifyPlonk(fixture.proof, abi.encodePacked(fixture.publicValues));
4848
}
4949
}
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"vkey": "0x004b0ceafd17dbfb907153bbbcb4be8ead947510c3ee2eda2c6b533b56aec583",
3-
"publicValues": "0x7c000000",
4-
"proof": "0xffea2d2e0a7365a11b712e1d33802f6f87b4c0597daa8cc82d7126ffd8f4d0fd0b3016e326e91ad47a7a5c3c29e6003df1114027995333ebb85318c4c36832a43564b97610d410a59d57015041f9d3fb1d5fbc8bea58b4a882fb06595810b30c954aa0bc1eb40dac20642f70956a38959a762a1e52dcccbf9fc70a736279c672f17a05f52008d6939ce4a76b403959b09b3c913b140d5ac055c7780d1e36d1b969871079206f8d45202a8b0547e799894e8c27a8a8b841e0175c4264984e187bfb818f5217306e6fd24040be4e1a3ee33f01a43f692ed0c3f2f7c6973a7d76b06ae03edc095b6c1c3f89d4b58f73897f4e3775da38370ae4756a0a287533b035be7832881c749a206361a76d0a39f5c9355e0427da1054c9292781a41bdf512a1a747a710098ab25a8cdb7b4911e5f9a2f1cdde493cdd23d2a3cc8fac6870e5726afa54c2dc7e0e413e596ce5d375e2a64f9793c0168a70c42be7256892b2fbabb0ebcdf044545417d47eba20511496e49d0add81a798b7eebf05c26107bd293fa92ceb112ceb87c69bccb0e09a6ea053de4681aa3440e3e4455f1a55b8449386cbd0fdf0ed00f92d49e5eb1c72c765c6a67c575c2236efc7e9d42eef9d4cb51b89232d3062d2894543198597e8d6f54cf2245f4d0f82f9a12f1ecea6df6cf27f8458686048fa1d884c572b0607d4ff5d4a6895392a84588f27f255b327ad2cf6d64b99c286e78efbfbfb04e7fc5b93c27a9bb136c17b8dff2fcfe06fa80c723fd12322006e70ae4cc759159627e5bf2f598626e657ba782a1c79a5ff13d2df77c4505e712cb48ef904ec787a881d82e67915bb4862c0d8c3411788e6787262e87c8451d15cc164df9212a46a716b7f75b15a63d3ae6a2db7eb35f55ca2a70cd258d29d3187c91cf79c71fd20a01028d73d8ca0bc276747b2f36c77635ab8ae55a9ecdbb2c41dddcc4c0f12af15c23ce19587377bf948ce697c76966b09c788f31104a8b0c17c232337e58ac18daaa9979f7d85ef566138f8fe296e27d3bca53042b503f2e35e205cd151e0003e17329819fb7a9ad1750ba3af0f0d008bd4bb824999f0e037c6c0b639b6bec9769519e23cc7b621da9ed233550e32cc2ab027730a8c55a0d25e427418c04bb5ff68a5fdd2e81a06a20c4bb972ac7c985fa093f690812e92cb1965cadc58837a710ae9c65814b5de274d4fb02b403645ecd2c855907ab71"
2+
"vkey": "0x00568065400c4b7b991d28b3124e7451968181eda330ec50270385491c87142e",
3+
"publicValues": "0x897d2f833f2f049fb2bc826454b6eae2d0d69121c0d327cc7240c6bf374ac980",
4+
"proof": "0xd4e8ecd20ef452fbba697f570a9b1389f983a1209ba9da6d5c9682c2f5dfeb7dfc6f3e430d3bdf7eb05af0f304a958124dda049e71c0124ca9a6d8166e3f928240376a672d79fd4de9c8a0a40a13175340524cf313d2216af56f3b772f2eb8035a42ee780345bfead9d1265832fa130f732df0d549d80c36d5ef58364a2bd02e73e797bd23b4c88649150ec14ee2c1ad1df82ccc1adbb1c095b76db89e2dba21be48b0a907f1e7cea30a8b785bac8d54e433e2c8b17b6b28f18cf11ea6103d79324a30532665a01e67f1c917d6ffa59be7a044a48ae97f7111bda51ca73158028dd1fcb30b5703907ed32cd0aeecf0bfdfbe4caa9c9bb755acfb6a66e65f53c555dbc60b234a04f755de8b1086d2d17db2d71f4e8c9af2fc2edf97eafa16503a55fe482e140ffdfe4e0e04dcd6085d515b8e79e6b6196b8a02d9ebc9f022d879276d9fc01862b249b949ccdd4cfc740e94439be7037810e187599d9dc5e2789c861c47961b350dd3c07cef5a858346d1c8071615aa70347994ee43fc1a7d5744a68bdef3274ee13e509eb949a225df5eb5985d5ea1e203ecce72b9555c7c695919f20ab90e7603e90b78c46634df70f8f9bfa54158a6f941f7c8c997ffd69e4067c1786106ed63d7c52531baf1f5b747b979623b1966716a07be9babee4bd00043f602d4184f6d4bcf6e052f56f0fc81bbd7fa73e10ecd57a9902af84ef27ea1c3f38f141fddcb9f14d213b345ea13d380be8aee1d6912a99b5bf3e8a3d4323ea208e040191b27c1bb853c46142cb39f7b90bcd759344e07d5fa1a8dc777a3a2f334558a095178aa2cd7a0d85d1291087e6edbd7801223919e17ab6be564949375686a402cb64dbf5fc9bf0bc5dac2091f7b24cd48b0a21beb06dca9c01e66d2edd0890c2398b3a1170bb1ee573b1ec9f4901789ed787fadd39682a8289e1e8df56b2f4322b63434abe93e555bca37f61ff0d043fcef2f2c284e798c457223be9f6bee65077998c030e9af6e41f9f4164df970797ea9d6e726742d72f65fbad7b0d78b5c12dcbecc468dc5c3920b4a757fe3deec8cc2b964843de8e2cee7598904ca66b70d9dccd714f3969747847756d6f2cce80762d9f200731daf7e375734a69a9cfc0a48394a0aa9c64001ae6edc9726a241c9fb121e3ea69b1869b99ef791e761231b9ad4611b940d4289f7ee47bba74f52e101bd2fcc26a25916810242176b5314"
55
}

contracts/src/deploy-config/holesky.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const config = {
1414
l2BaseFee: 0.1, // Gwei
1515

1616
// verify contract config
17-
programVkey: '0x00ad538a51c761c06f5075d11f3ee64d5d00c272a741ccf098e1d9f062fee13d',
17+
programVkey: '0x001bbd0e32f56275cefa4a7313c51b94b763a4c295ac02af037b494895bc58c2',
1818
// rollup contract config
1919
// initialize config
2020
finalizationPeriodSeconds: 600,

contracts/src/deploy-config/hoodi.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const config = {
1717
l2BaseFee: 0.1, // Gwei
1818

1919
// verify contract config
20-
programVkey: '0x00ad538a51c761c06f5075d11f3ee64d5d00c272a741ccf098e1d9f062fee13d',
20+
programVkey: '0x001bbd0e32f56275cefa4a7313c51b94b763a4c295ac02af037b494895bc58c2',
2121
// rollup contract config
2222
// initialize config
2323
finalizationPeriodSeconds: 600,

contracts/src/deploy-config/l1.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const config = {
1717
l2BaseFee: 0.1, // Gwei
1818

1919
// verify contract config
20-
programVkey: '0x00ad538a51c761c06f5075d11f3ee64d5d00c272a741ccf098e1d9f062fee13d',
20+
programVkey: '0x001bbd0e32f56275cefa4a7313c51b94b763a4c295ac02af037b494895bc58c2',
2121
// rollup contract config
2222
// initialize config
2323
finalizationPeriodSeconds: 10,

contracts/src/deploy-config/qanetl1.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const config = {
1414
l2BaseFee: 0.1, // Gwei
1515

1616
// verify contract config
17-
programVkey: '0x00ad538a51c761c06f5075d11f3ee64d5d00c272a741ccf098e1d9f062fee13d',
17+
programVkey: '0x001bbd0e32f56275cefa4a7313c51b94b763a4c295ac02af037b494895bc58c2',
1818
// rollup contract config
1919
// initialize config
2020
finalizationPeriodSeconds: 600,

contracts/src/deploy-config/sepolia.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const config = {
1818
/**
1919
* ---to---legacy property
2020
*/
21-
programVkey: '0x00ad538a51c761c06f5075d11f3ee64d5d00c272a741ccf098e1d9f062fee13d',
21+
programVkey: '0x001bbd0e32f56275cefa4a7313c51b94b763a4c295ac02af037b494895bc58c2',
2222
rollupMinDeposit: 0.0001,
2323
rollupProofWindow: 86400,
2424
rollupGenesisBlockNumber: 0,

0 commit comments

Comments
 (0)