Skip to content
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
12 changes: 12 additions & 0 deletions crates/l2/contracts/src/l1/OnChainProposer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,18 @@ contract OnChainProposer is
BRIDGE = bridge;
}

/// @inheritdoc IOnChainProposer
function upgradeSP1VerificationKey(bytes32 new_vk) public onlyOwner {
SP1_VERIFICATION_KEY = new_vk;
emit VerificationKeyUpgraded("SP1", new_vk);
}

/// @inheritdoc IOnChainProposer
function upgradeRISC0VerificationKey(bytes32 new_vk) public onlyOwner {
RISC0_VERIFICATION_KEY = new_vk;
emit VerificationKeyUpgraded("RISC0", new_vk);
}

/// @inheritdoc IOnChainProposer
function commitBatch(
uint256 batchNumber,
Expand Down
12 changes: 12 additions & 0 deletions crates/l2/contracts/src/l1/based/OnChainProposer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,18 @@ contract OnChainProposer is
BRIDGE = bridge;
}

/// @inheritdoc IOnChainProposer
function upgradeSP1VerificationKey(bytes32 new_vk) public onlyOwner {
SP1_VERIFICATION_KEY = new_vk;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's emit an event here after setting it (same for RISC0 and the non-based cases)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done 95d6580

emit VerificationKeyUpgraded("SP1", new_vk);
}

/// @inheritdoc IOnChainProposer
function upgradeRISC0VerificationKey(bytes32 new_vk) public onlyOwner {
RISC0_VERIFICATION_KEY = new_vk;
emit VerificationKeyUpgraded("RISC0", new_vk);
}

/// @inheritdoc IOnChainProposer
function commitBatch(
uint256 batchNumber,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,27 @@ interface IOnChainProposer {
/// @dev Event emitted when a batch is verified.
event BatchVerified(uint256 indexed lastVerifiedBatch);

/// @notice A verification key has been upgraded.
/// @dev Event emitted when a verification key is upgraded.
/// @param verifier The name of the verifier whose key was upgraded.
/// @param newVerificationKey The new verification key.
event VerificationKeyUpgraded(string verifier, bytes32 newVerificationKey);

/// @notice Set the bridge address for the first time.
/// @dev This method is separated from initialize because both the CommonBridge
/// and the OnChainProposer need to know the address of the other. This solves
/// the circular dependency while allowing to initialize the proxy with the deploy.
/// @param bridge the address of the bridge contract.
function initializeBridgeAddress(address bridge) external;

/// @notice Upgrades the SP1 verification key that represents the sequencer's code.
/// @param new_vk new verification key for SP1 verifier
function upgradeSP1VerificationKey(bytes32 new_vk) external;

/// @notice Upgrades the RISC0 verification key that represents the sequencer's code.
/// @param new_vk new verification key for RISC0 verifier
function upgradeRISC0VerificationKey(bytes32 new_vk) external;

/// @notice Commits to a batch of L2 blocks.
/// @dev Committing to an L2 batch means to store the batch's commitment
/// and to publish withdrawals if any.
Expand Down Expand Up @@ -75,6 +89,7 @@ interface IOnChainProposer {
bytes calldata tdxPublicValues,
bytes memory tdxSignature
) external;

// TODO: imageid, programvkey and riscvvkey should be constants
// TODO: organize each zkvm proof arguments in their own structs

Expand Down
15 changes: 15 additions & 0 deletions crates/l2/contracts/src/l1/interfaces/IOnChainProposer.sol
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,27 @@ interface IOnChainProposer {
/// @dev Event emitted when a batch is reverted.
event BatchReverted(bytes32 indexed newStateRoot);

/// @notice A verification key has been upgraded.
/// @dev Event emitted when a verification key is upgraded.
/// @param verifier The name of the verifier whose key was upgraded.
/// @param newVerificationKey The new verification key.
event VerificationKeyUpgraded(string verifier, bytes32 newVerificationKey);

/// @notice Set the bridge address for the first time.
/// @dev This method is separated from initialize because both the CommonBridge
/// and the OnChainProposer need to know the address of the other. This solves
/// the circular dependency while allowing to initialize the proxy with the deploy.
/// @param bridge the address of the bridge contract.
function initializeBridgeAddress(address bridge) external;

/// @notice Upgrades the SP1 verification key that represents the sequencer's code.
/// @param new_vk new verification key for SP1 verifier
function upgradeSP1VerificationKey(bytes32 new_vk) external;

/// @notice Upgrades the RISC0 verification key that represents the sequencer's code.
/// @param new_vk new verification key for RISC0 verifier
function upgradeRISC0VerificationKey(bytes32 new_vk) external;

/// @notice Commits to a batch of L2 blocks.
/// @dev Committing to an L2 batch means to store the batch's commitment
/// and to publish withdrawals if any.
Expand Down Expand Up @@ -77,6 +91,7 @@ interface IOnChainProposer {
bytes calldata tdxPublicValues,
bytes memory tdxSignature
) external;

// TODO: imageid, programvkey and riscvvkey should be constants
// TODO: organize each zkvm proof arguments in their own structs

Expand Down