Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(protocol): upgrade sp1 contract to v4.0.0-rc.3 #18740

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,668 changes: 859 additions & 809 deletions packages/protocol/contract_layout_layer1.md

Large diffs are not rendered by default.

773 changes: 396 additions & 377 deletions packages/protocol/contract_layout_layer2.md

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions packages/protocol/deployments/hekla-contract-logs.md
Original file line number Diff line number Diff line change
Expand Up @@ -223,10 +223,11 @@

### risc0_groth16_verifier

- addr : 0x5fd84014c62D5ea28D4533D5B1B48Ca44e571057
- addr : 0x714FD0666B0cee87bFC29A029E2AE66f40F12cE5
- logs:
- deployed on August 14, 2024 at commit `cba2a1e`
- upgraded on October 22, 2024 at commit `684a909`
- upgraded on Jan 10, 2025 at commit `2802b21`

### tier_zkvm_risc0

Expand All @@ -239,12 +240,13 @@

### sp1_plonk_verifier

- addr : 0xfb2d02219D065eBF3Aa8d2D1a1C52b1868EE7384
- addr : 0x7110bd8909CFC4C31204BA8597882CBFa1F77dC9
- logs:
- deployed on September 02, 2024 at commit `16ac02e`
- upgraded on September 15, 2024 at commit `6f26434`
- upgraded on October 22, 2024 at commit `684a909`
- upgraded on Nov 8, 2024 at commit `0b11101`
- upgraded on Jan 9, 2025 at commit `de12a26`

### tier_zkvm_sp1

Expand Down
4 changes: 2 additions & 2 deletions packages/protocol/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@
"merkletreejs": "^0.4.0",
"optimism": "github:ethereum-optimism/optimism#v1.8.0",
"p256-verifier": "github:taikoxyz/p256-verifier#v0.1.0",
"risc0-ethereum": "github:risc0/risc0-ethereum#v1.1.2",
"risc0-ethereum": "github:risc0/risc0-ethereum#v1.2.0",
"solady": "github:Vectorized/solady#v0.0.231",
"sp1-contracts": "github:succinctlabs/sp1-contracts#v3.0.0"
"sp1-contracts": "github:succinctlabs/sp1-contracts#v4.0.0-rc.3"
}
}
3 changes: 2 additions & 1 deletion packages/protocol/script/layer1/DeployProtocolOnL1.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ pragma solidity ^0.8.24;

import "@openzeppelin/contracts/utils/Strings.sol";
import "@risc0/contracts/groth16/RiscZeroGroth16Verifier.sol";
import { SP1Verifier as SuccinctVerifier } from "@sp1-contracts/src/v3.0.0/SP1VerifierPlonk.sol";
import { SP1Verifier as SuccinctVerifier } from
"@sp1-contracts/src/v4.0.0-rc.3/SP1VerifierPlonk.sol";

// Actually this one is deployed already on mainnet, but we are now deploying our own (non via-ir)
// version. For mainnet, it is easier to go with one of:
Expand Down
3 changes: 2 additions & 1 deletion packages/protocol/script/layer1/DeploySP1Verifier.s.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;

import { SP1Verifier as SuccinctVerifier } from "@sp1-contracts/src/v3.0.0/SP1VerifierPlonk.sol";
import { SP1Verifier as SuccinctVerifier } from
"@sp1-contracts/src/v4.0.0-rc.3/SP1VerifierPlonk.sol";
import "test/shared/DeployCapability.sol";
import "src/layer1/verifiers/SP1Verifier.sol";

Expand Down
2 changes: 1 addition & 1 deletion packages/protocol/script/layer1/UpdateSP1Verifier.s.sol
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;

import "@sp1-contracts/src/v3.0.0/SP1VerifierPlonk.sol";
import "@sp1-contracts/src/v4.0.0-rc.3/SP1VerifierPlonk.sol";
import "test/shared/DeployCapability.sol";

contract UpdateSP1Verifier is DeployCapability {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ contract RiscZeroGroth16VerifierTest is TaikoL1TestBase {
);

rv.setImageIdTrusted(
bytes32(0x7669d1059d0dfa9537c2b3581569b8bc244495e6c406d07dea628bc8cf480392), true
bytes32(0xb0e5cbad30f8da6180a9dd768b5de54062164916f0410b0b124a0039d503f997), true
);
}

Expand All @@ -44,11 +44,11 @@ contract RiscZeroGroth16VerifierTest is TaikoL1TestBase {
vm.startPrank(Emma);

bytes memory seal =
hex"50bd1769220929ac1ac3f9d3a8a4e7f4bcec136f8ea44be5a7248785d83b13879b409b762480f0ca5f38b164091e2def50b35829e453d1418492c01cc1b924e851580fe208d3808a925ce28724f0a862b944074f5277c4bd4b3153c1a1ff87056740628008fcc8d7edef53215db823e4773334e6f5fe08fed84c7ebd005fe4f42b80891724044cadde535253739049d99abc1a91a4a987ad93b0fcedbdb2440c9c2d662101509acb5f869bdb2e15d2609aa1a6c6c1a5a83e04fb2f77d25163b5675351be2204a497f20d43277d211adcc66b730b5d8d7635bb4a456cbf9029904ef2493a0346cd8e1aa2c270a160bc28bca77336bf18fe91b9dc8790a15f1618188dafa9";
hex"c101b42b17dda9eca78d0abdda89996306aecfda823f4fc36866a6aef87a34bc16b64762001401e2c9b09ad1cff495bf746ea4a90c804a144586567ace502884d515153d04ca12eea43e7229f34ed46b75671be7cf38e1bcfc5c571fb53eea3ea7ca0a8c12eec0fb244c4950f4fcd34dc2351d5e0d4eeb9c95b795b0415faa472ae07b1b0552b134c1685ca7049bbfc150661f51d5a87b2eca5adfee1de5fcb0ec06f6ca07c16b54b351302086344c99e84093baf17112d8da40db21ad2d43d8670858982717a58b1522ff88a357d2dc6aa5dc1a3361d756587690d3fbdec6f68dade6a3191ce759e321f17aeb839396afa261eb8aa4935a0d476a6e9a6c4d20c817b1a0";
bytes32 imageId =
bytes32(0x7669d1059d0dfa9537c2b3581569b8bc244495e6c406d07dea628bc8cf480392);
bytes32(0xb0e5cbad30f8da6180a9dd768b5de54062164916f0410b0b124a0039d503f997);
bytes32 journalDigest =
bytes32(0xa82287ae36a69b51f8013851b3814ff1243da5dfa071f6fd9b46b85445895553);
bytes32(0x0eac04720f08f4c696e4860fcad2ba8074ffda3d90fa85954d4d83dfdecddc3b);

// TierProof
TaikoData.TierProof memory proof =
Expand Down Expand Up @@ -80,29 +80,29 @@ contract RiscZeroGroth16VerifierTest is TaikoL1TestBase {
{
// Context
ctx = IVerifier.Context({
metaHash: bytes32(0xd7efb262f6f25cc817452a622009a22e5868e53e1f934d899d3ec68d8c4f2c5b),
blobHash: bytes32(0x015cc9688f24b8d2195e46829b3f726ce006884d5fd2760b7cf414bab9a1b231),
metaHash: bytes32(0xa0c8136633dff06ad1f03ed6fbb277096e6cae13f39e02ac1cff397b22aafeac),
blobHash: bytes32(0x0143051e11b9886c061ccb939bf7317cee20378f0d3ac8d1930140f1ba42d99f),
prover: address(0x70997970C51812dc3A010C7d01b50e0d17dc79C8),
msgSender: address(0),
blockId: 223_248, //from mainnet
blockId: 749_050, //from mainnet
isContesting: false,
blobUsed: true
});

// Transition
transition = TaikoData.Transition({
parentHash: 0x317de24b32f09629524133334ad552a14e3de603d71a9cf9e88d722809f101b3,
blockHash: 0x9966d3cf051d3d1e44e2a740169627506a619257c95374e812ca572de91ed885,
stateRoot: 0x3ae3de1afa16b93a5c7ea20a0b36b43357061f5b8ef857053d68b2735c3df860,
parentHash: 0xaa47a56db9be323d923a56002612b168ba73621a98269835e768ec48799fcc95,
blockHash: 0x405a8978474fbe72d40fa4e2fc6b2edfcc0d439002c6d941ac1385a5a349535d,
stateRoot: 0xadbeff96af5a990b979135850926fdd7c0d9c5af967e12e60d7b2a473fcf04c9,
graffiti: 0x8008500000000000000000000000000000000000000000000000000000000000
});
}

function test_risc0_verifyBatchProof() public {
vm.startPrank(Emma);

bytes32 aggProofImageId = 0x8e192ebe6872b47645367692838b2d697c467f5e4543d605b0ef7d10365fb11a;
bytes32 blkProofImageId = 0x7669d1059d0dfa9537c2b3581569b8bc244495e6c406d07dea628bc8cf480392;
bytes32 aggProofImageId = 0x20187e43c11a55330ac17a93299245e34fe0d641e35bc46f77768b60e7779a3a;
bytes32 blkProofImageId = 0xb0e5cbad30f8da6180a9dd768b5de54062164916f0410b0b124a0039d503f997;

// proof generation elf
rv.setImageIdTrusted(aggProofImageId, true);
Expand All @@ -114,38 +114,38 @@ contract RiscZeroGroth16VerifierTest is TaikoL1TestBase {
// Context
IVerifier.ContextV2[] memory ctxs = new IVerifier.ContextV2[](2);
ctxs[0] = IVerifier.ContextV2({
metaHash: 0x207b2833fb6d804612da24d8785b870a19c7a3f25fa4aaeb9799cd442d65b031,
blobHash: 0x01354e8725e60ad91b32ec4ab19158572a0a5b06b2d4d83f6269c9a7d068f49b,
prover: 0x70997970C51812dc3A010C7d01b50e0d17dc79C8,
metaHash: bytes32(0xa0c8136633dff06ad1f03ed6fbb277096e6cae13f39e02ac1cff397b22aafeac),
blobHash: bytes32(0x0143051e11b9886c061ccb939bf7317cee20378f0d3ac8d1930140f1ba42d99f),
prover: address(0x70997970C51812dc3A010C7d01b50e0d17dc79C8),
msgSender: 0x70997970C51812dc3A010C7d01b50e0d17dc79C8,
blockId: 393_333,
blockId: 749_050,
isContesting: false,
blobUsed: true,
tran: TaikoData.Transition({
parentHash: 0xce519622a374dc014c005d7857de26d952751a9067d3e23ffe14da247aa8a399,
blockHash: 0x941d557653da2214cbf3d30af8d9cadbc7b5f77b6c3e48bca548eba04eb9cd79,
stateRoot: 0x4203a2fd98d268d272acb24d91e25055a779b443ff3e732f2cee7abcf639b5e9,
parentHash: 0xaa47a56db9be323d923a56002612b168ba73621a98269835e768ec48799fcc95,
blockHash: 0x405a8978474fbe72d40fa4e2fc6b2edfcc0d439002c6d941ac1385a5a349535d,
stateRoot: 0xadbeff96af5a990b979135850926fdd7c0d9c5af967e12e60d7b2a473fcf04c9,
graffiti: 0x8008500000000000000000000000000000000000000000000000000000000000
})
});
ctxs[1] = IVerifier.ContextV2({
metaHash: 0x946ba1a9c02fc2f01da49e31cb5be83c118193d0389987c6be616ce76426b44d,
blobHash: 0x01abac8c1fb54f87ff7b0cbf14259b9d5ee7a8de458c587dd6eda43ef8354b4f,
metaHash: 0xd385182abb3db17267b32b4e475c5ed9306f52107a8f8cc5309f13af0af3b2a8,
blobHash: 0x0181040be344c40efb3f4cfd9df5ba02c8474e6c18e15d959ab345de1ee264b7,
prover: 0x70997970C51812dc3A010C7d01b50e0d17dc79C8,
msgSender: 0x70997970C51812dc3A010C7d01b50e0d17dc79C8,
blockId: 393_334,
blockId: 749_051,
isContesting: false,
blobUsed: true,
tran: TaikoData.Transition({
parentHash: 0x941d557653da2214cbf3d30af8d9cadbc7b5f77b6c3e48bca548eba04eb9cd79,
blockHash: 0xc0dad38646ab264be30995b7b7fd02db65e7115126fb52bfad94c0fc9572287c,
stateRoot: 0x222061caab95b6bd0f8dd398088030979efbe56e282cd566f7abd77838558eb9,
parentHash: 0x405a8978474fbe72d40fa4e2fc6b2edfcc0d439002c6d941ac1385a5a349535d,
blockHash: 0x8547cf9c2eb9ead5ab55c02d92b9f712ebbc6bbf92915869609016779bf302ef,
stateRoot: 0x5c37ab91105743f67e5508ae8f4f6f01c44a4ad21da52637bbaf792eba57cf66,
graffiti: 0x8008500000000000000000000000000000000000000000000000000000000000
})
});

bytes memory seal =
hex"50bd176901a68e3f05b0e651b6e5ff18e5463be794699597908b42b9ac3195a464c2b67320fb89c8199909a5ef1ff32366d1047009f4758294090f4ce613129f64a9ff58109cf0f6cb0f22e194dab522a2938631b138f4afeb075117a05d1ad75093515e15de11d9b231b79be5d42b0c7921ba22d62a6594258745f3e5c2e10508741fd813581ea8fab28ee1d07cb1f2e84500e2993cff3ca2e37284cfb5cfec5fe301d92f4246b2dbffc17d2ef5d889f50b8f28c51d1bacd6b0c55399e574969bb0a77207ceda541460cfec3e0c315889d62c0c91c5cf0cecd515ada96712735e5cf0ea1664af11012004ba7cb6adea3751911c8afe5eb5979b1adf43da6f9c18837f3d";
hex"c101b42b090030000272654103ff692da743560878ebc23d2fca58bf4800e3a033d6bb54100b09e9014094a7753c1d6cf3240275586892e426bd9ba4adfa80eb8e6c9d1211537ace36bd515c7844e1dff10b6a9d5afd34782bf877933422d434ba0de96004c54c33937c3b2c5f5cfbe894db673f9608441ff4c35fb440b4b74f8a7cbb1e17ba492db492506c7296bd68711a47a64e10cb63eb7416638f86570a918fccd027a15077e094b275e7f635fea0dd0b86f4606fc3ee32614ff9bb13553abb3f9415965e2967c8fd2786e8dee68871705fe2ecdda24e26756a915b9cd0e9dff0032e04ed383c451e89aa59583219b96fce51f3832ec2faee8a02f43cabda100e1b";
// TierProof
TaikoData.TierProof memory proof = TaikoData.TierProof({
tier: 100,
Expand Down
Loading