Skip to content

Commit

Permalink
feat(protocol): update sp1 contracts (#18097)
Browse files Browse the repository at this point in the history
  • Loading branch information
smtmfft authored Sep 15, 2024
1 parent 1d18c17 commit 6f26434
Show file tree
Hide file tree
Showing 5 changed files with 2,211 additions and 970 deletions.
2 changes: 1 addition & 1 deletion packages/protocol/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,6 @@
"p256-verifier": "github:taikoxyz/p256-verifier#v0.1.0",
"risc0-ethereum": "github:risc0/risc0-ethereum#v1.0.0",
"solady": "github:Vectorized/solady#v0.0.231",
"sp1-contracts": "github:succinctlabs/sp1-contracts#v1.2.0-rc1"
"sp1-contracts": "github:succinctlabs/sp1-contracts#v2.0.0"
}
}
6 changes: 3 additions & 3 deletions packages/protocol/script/layer1/DeployProtocolOnL1.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ pragma solidity ^0.8.24;

import "@openzeppelin/contracts/utils/Strings.sol";
import "@risc0/contracts/groth16/RiscZeroGroth16Verifier.sol";
import { SP1Verifier as SP1Verifier120rc } from "@sp1-contracts/src/v1.2.0-rc/SP1VerifierPlonk.sol";
import { SP1Verifier as SP1Verifier200rc } from "@sp1-contracts/src/v2.0.0/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 Expand Up @@ -416,8 +416,8 @@ contract DeployProtocolOnL1 is DeployCapability {
});

// Deploy sp1 plonk verifier
SP1Verifier120rc sp1Verifier120rc = new SP1Verifier120rc();
register(rollupAddressManager, "sp1_remote_verifier", address(sp1Verifier120rc));
SP1Verifier200rc sp1Verifier200rc = new SP1Verifier200rc();
register(rollupAddressManager, "sp1_remote_verifier", address(sp1Verifier200rc));

deployProxy({
name: "tier_zkvm_sp1",
Expand Down
6 changes: 3 additions & 3 deletions packages/protocol/script/layer1/DeploySP1Verifier.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 { SP1Verifier as SP1Verifier120rc } from "@sp1-contracts/src/v1.2.0-rc/SP1VerifierPlonk.sol";
import { SP1Verifier as SP1Verifier200rc } from "@sp1-contracts/src/v2.0.0/SP1VerifierPlonk.sol";
import "../../test/shared/DeployCapability.sol";
import "../../contracts/layer1/verifiers/SP1Verifier.sol";

Expand All @@ -16,8 +16,8 @@ contract DeploySP1Verifier is DeployCapability {
vm.startBroadcast(deployerPrivKey);

// Deploy sp1 plonk verifier
SP1Verifier120rc sp1Verifier120rc = new SP1Verifier120rc();
register(rollupAddressManager, "sp1_remote_verifier", address(sp1Verifier120rc));
SP1Verifier200rc sp1Verifier200rc = new SP1Verifier200rc();
register(rollupAddressManager, "sp1_remote_verifier", address(sp1Verifier200rc));

deployProxy({
name: "tier_zkvm_sp1",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;

import { SP1Verifier as SP1PlonkVerifier } from "@sp1-contracts/src/v1.2.0-rc/SP1VerifierPlonk.sol";
import { SP1Verifier as SP1PlonkVerifier } from "@sp1-contracts/src/v2.0.0/SP1VerifierPlonk.sol";
import "../based/TaikoL1TestBase.sol";

contract SP1PlonkVerifierTest is TaikoL1TestBase {
Expand Down Expand Up @@ -29,7 +29,7 @@ contract SP1PlonkVerifierTest is TaikoL1TestBase {
);

sp1.setProgramTrusted(
bytes32(0x008985ad6b5f2bcf7045ae495ae7e36ec0744befcd0881ecf0c3618541f21c9a), true
bytes32(0x00851c6ce0153ea4f7a6b8f9923ae1ad15d47476925777f4375d1a4b13137231), true
);
}

Expand All @@ -42,8 +42,8 @@ contract SP1PlonkVerifierTest is TaikoL1TestBase {
vm.startPrank(Emma);

bytes memory sp1Proof =
hex"616a42051d0b264598d3ce80b077e8e5d3d6209834817c3d5cc6ae9ef9282129999978a3262175276ff5cb3072fe862a210a50f81e7d8684944202c3a19672ad87bfb4a81699105748fa8516cce7c817e72717cf91cba986e01c82f72cbd3e0a5b18f9540ccde87997b79148c1c19689afa2d67b701b9d3705d93f39912a9e956016d7d027112ae07e51b658a565fde7c21b03d1ebd799f9fb92680cba9ed7903a690fc10b03b6b8bc3f29d487533ca9aecc762ddc297e0f54d2290038bb7673a3867e1217c52471a108298e34cb25ae15082832cf4ddc6ca13e3fe418c391e9ea053738116833c96667052033452ee4e97baf77acabf21673a7d650a84866124122e493256a9f1679db2f46c0722267a16efe6ba1ef6a0bf105f973ef6b5d98e0236a6c1e74c4c7c984fe7a61f89b9dd739c3a43947b44835202afe54bdef012e0945a22569c82f420ebd0e08b3552d1b07e15e7cd81a33c55fb12f3c83ebc114d25a5527b2f9a20ed48a5e8dbaeb000b21a7106f0d2538278d985a619fc2074999e79512adce8bbe362113c965400a8127f85543f909d6f65a909ea0e5bb7a6e867ed3261111ea8b12c041df1d70e02aa42b9fe30be06265d02ff4f0d29545c22339430c5164fd0496b03fb5ce39f4518402251450a2ebca06d1209a570e859702ff552bc7bae5b3118017bea5569dfc6188fe5442236fd0330879076ed37313cc04be11386895c911c06b72b63785656050e9858975a9b5280a89cf3edc109130619718159eeeb77a1b48773a0a0df65170aefdd3a82858ac729ead3aa0918b52a7f101ec6ee3baccbc890bed38622a157541153167dd5f497bf8778c886508bc172a179618294af48fcc69354c93f013e06666fe26b5006729a03728a7ddc319f66600b0bcdece21a82072b2a2036a97246f101138ee19cf39a90d24fb5f12f0c40b1aa9ccd2a70c96da3af9bc9b76cdbd37054291c9ee6974c9d40089bf68d525a612e992cf3de3acf7feb072b928852bfaf50d6c69c7672a08ed15d1bbcfaff22a0277ea85becd001bf9df5589050e71d8ee11e6d13b63365f445377aebcec33140d4b5ff2150633f2d1edddfe100a42f81b25f22fd667180056607c34fb808a7125b16ae2fb907f5629b987eb596377ff1e3e42042b9e14741e258c17d14e1ae91f178226c8b10798b84a7c5a93b282a7b6115f568cebf95c15b47e7e084d031c";
bytes32 vKey = bytes32(0x008985ad6b5f2bcf7045ae495ae7e36ec0744befcd0881ecf0c3618541f21c9a);
hex"4aca240a1f6e9f5f6927e5468a58a7ca24addf975aacc9293e89729bbb84f814725c911c2488230b0922c072f3261a6480dca80af7d3f1ac54aaef2d1929f06a89f92cb71fd0f2015f1bf32ae904e221d342e1efcbd2b1f2275acda3e2dc1e779297937903643bcbbe5a4f7261d091c264d47810e1a5ca2e1ba20b7b1b069567d3ba895d0e088f70848009522bb67c39c108eb1b29272902fbb5d18bb74b5c4085569879188b5c8f0730da420f6da4e656b66eb9a7ce01da7aff3efe9033e02df0549dc214195b64ca178b9e50b2b35c8449eeeef60a6a0056d9c6a525d5684a544088322a14f46d15740fe42ba83c8c6c57548c415610a545d6b2c7b4146a76a2c957ea2a1975915e864e420c006176e00e6ed26810e80d5c6cec4143daa50b61ec0cb207661ad396db21744b713c0454d78752e5e6eee2e9f5273f30322461fa32b2932d7c8a467de8fac07d8363238245369f3bd196e443ff90aec1754537019eaa4928ab7b0a34d973a5c15123d2820923153f47c0b742ebf1e8d952626a77aa957804446347f03aee26e4bddadba1a3b0f275b7271ff1cbcca1ca0756e22113165f2d0472fc2ac3fa2b4593b472c3333cef81bde5fddb31fed8a52fb450de3b74cd0ab415777a733c22d1aab02d794dac192ca2d3088a7b379dba8896c842bf599d15ab8792e980773a131bfdaa0ab4ff7dfae9c98fb5d6774a8007c3927ffd99ce1acd527de2273f9c1163019cfca98e9bea7a56ff0ca0e8cac93c2096860f6aff14ec69181f6554bca186646d1002a8c2ac0fbdde5d4440242360bb9344399a6429bebc7f97f56090217c091b0e655579d598e3979a1acc8a516cfee2dd43c3341c81a4163221e6a4980fdfb2af09d30c9fa18ad3fb9d10bf4d35fe48663dc597277c25927396fb8d8501b3829f8eccc672515d2a249dec90057d3fe53ca105851257092388f2823fecbf09a8ae35e4e0dcf0ec615366a4db47b7d7e1af480a431957268d2e5283a690f9168c215d481e07188c7bfd5bd227d034d74a035119410eb23b74bd2fb0711eefb7502fc61119161d207c42e88cf73640719305a753052f8665d2222b4ae696fa541c99ffcc9c38153a46675fbdf596d00104b4b0b41708da9b30c70462422bba87bdc2b011a8a302649b7249250ce71793cedfb3f5db1622a7ec48ba7ed576f9ced6b2c9c661e9bed64e6f484f1862b0cd71be2aa628";
bytes32 vKey = bytes32(0x00851c6ce0153ea4f7a6b8f9923ae1ad15d47476925777f4375d1a4b13137231);

console2.logBytes(abi.encodePacked(vKey, sp1Proof));
// TierProof
Expand Down
Loading

0 comments on commit 6f26434

Please sign in to comment.