Skip to content

Commit

Permalink
feat(protocol): update script of deploying sp1 (#18019)
Browse files Browse the repository at this point in the history
Co-authored-by: YoGhurt111 <[email protected]>
Co-authored-by: David <[email protected]>
  • Loading branch information
3 people authored Sep 2, 2024
1 parent 64fdf5c commit 9464967
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 23 deletions.
3 changes: 1 addition & 2 deletions packages/protocol/contracts/L2/TaikoL2.sol
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@ contract TaikoL2 is EssentialContract {

if (block.number == 0) {
// This is the case in real L2 genesis
}
else if (block.number == 1) {
} else if (block.number == 1) {
// This is the case in tests
uint256 parentHeight = block.number - 1;
l2Hashes[parentHeight] = blockhash(parentHeight);
Expand Down
38 changes: 17 additions & 21 deletions packages/protocol/script/DeploySP1Verifier.s.sol
Original file line number Diff line number Diff line change
@@ -1,35 +1,31 @@
// SPDX-License-Identifier: MIT
pragma solidity 0.8.24;

import "../contracts/verifiers/SP1Verifier.sol";
import { SP1Verifier as SP1Verifier120rc } from "@sp1-contracts/src/v1.2.0-rc/SP1VerifierPlonk.sol";
import "../test/DeployCapability.sol";
import "../contracts/verifiers/SP1Verifier.sol";

contract DeploySP1Verifier is DeployCapability {
// On mainnet, rollup specific address manager is as follows.
address public addressManager = 0x579f40D0BE111b823962043702cabe6Aaa290780;
uint256 public deployerPrivKey = vm.envUint("PRIVATE_KEY");
address public rollupAddressManager = vm.envAddress("ROLLUP_ADDRESS_MANAGER");

modifier broadcast() {
vm.startBroadcast();
_;
vm.stopBroadcast();
}
function run() external {
require(deployerPrivKey != 0, "invalid deployer priv key");
require(rollupAddressManager != address(0), "invalid rollup address manager address");

function run() external broadcast {
// address sp1RemoteVerifierOrGateway = vm.envOr("SP1_REMOTE_VERIFIER_GATEWAY", address(0));
// // address(0)
// is fine, we can set it later
address owner = vm.envOr("SP1_VERIFIER_OWNER", msg.sender);
vm.startBroadcast(deployerPrivKey);

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

address proxy = deployProxy({
name: "sp1_verifier",
impl: sp1Verifier,
data: abi.encodeCall(SP1Verifier.init, (owner, addressManager))
deployProxy({
name: "tier_zkvm_sp1",
impl: address(new SP1Verifier()),
data: abi.encodeCall(SP1Verifier.init, (address(0), rollupAddressManager)),
registerTo: rollupAddressManager
});

console2.log();
console2.log("Deployed SP1Verifier impl at address: %s", sp1Verifier);
console2.log("Deployed SP1Verifier proxy at address: %s", proxy);
vm.stopBroadcast();
}
}

0 comments on commit 9464967

Please sign in to comment.