Skip to content

Commit

Permalink
feat(protocol): scripts of upgrading zk verifier (#18270)
Browse files Browse the repository at this point in the history
  • Loading branch information
YoGhurt111 authored Oct 21, 2024
1 parent e6a3e03 commit 8f72bd2
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
21 changes: 21 additions & 0 deletions packages/protocol/script/layer1/UpdateRisc0Verifier.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.24;

import "@risc0/contracts/groth16/RiscZeroGroth16Verifier.sol";
import "test/shared/DeployCapability.sol";

contract UpdateRisc0Verifier is DeployCapability {
uint256 public deployerPrivKey = vm.envUint("PRIVATE_KEY");
address public rollupAddressManager = vm.envAddress("ROLLUP_ADDRESS_MANAGER");

function run() external {
require(deployerPrivKey != 0, "invalid deployer priv key");
require(rollupAddressManager != address(0), "invalid rollup address manager address");

vm.startBroadcast(deployerPrivKey);
RiscZeroGroth16Verifier verifier =
new RiscZeroGroth16Verifier(ControlID.CONTROL_ROOT, ControlID.BN254_CONTROL_ID);
register(rollupAddressManager, "risc0_groth16_verifier", address(verifier));
vm.stopBroadcast();
}
}
23 changes: 23 additions & 0 deletions packages/protocol/script/layer1/UpdateSP1Verifier.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;

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

contract UpdateSP1Verifier is DeployCapability {
uint256 public deployerPrivKey = vm.envUint("PRIVATE_KEY");
address public rollupAddressManager = vm.envAddress("ROLLUP_ADDRESS_MANAGER");

function run() external {
require(deployerPrivKey != 0, "invalid deployer priv key");
require(rollupAddressManager != address(0), "invalid rollup address manager address");

vm.startBroadcast(deployerPrivKey);

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

vm.stopBroadcast();
}
}

0 comments on commit 8f72bd2

Please sign in to comment.