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): scripts of upgrading zk verifier #18270

Merged
merged 2 commits into from
Oct 21, 2024
Merged
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
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();
}
}