diff --git a/book/getting-started/l2-output-oracle.md b/book/getting-started/l2-output-oracle.md index 7635f5f9..3d9f1aa3 100644 --- a/book/getting-started/l2-output-oracle.md +++ b/book/getting-started/l2-output-oracle.md @@ -2,6 +2,22 @@ The first step in deploying OP Succinct is to deploy the `OPSuccinctL2OutputOracle` smart contract that will verify SP1 proofs of the Optimism state transition function which verify the latest state root for the OP Stack rollup. +## Overview + +The `OPSuccinctL2OutputOracle` contract is a modification of the `L2OutputOracle` contract that is used to verify the state roots of the OP Stack rollup. + +### Modifications to `L2OutputOracle` + +The original `L2OutputOracle` contract can be found [here](https://github.com/ethereum-optimism/optimism/blob/3e68cf018d8b9b474e918def32a56d1dbf028d83/packages/contracts-bedrock/src/L1/L2OutputOracle.sol#L199-L202). + +The changes introduced in the `OPSuccinctL2OutputOracle` contract are: + +1. The `submissionInterval` parameter is now the minimum interval in L2 blocks at which checkpoints must be submitted. An aggregation proof can be posted after this interval has passed. +2. The addition of the `aggregationVkey`, `rangeVkeyCommitment`, `verifierGateway`, `startingOutputRoot`, and `rollupConfigHash` parameters. `startingOutputRoot` is used for initalizing the contract from an empty state, because `op-succinct` requires a starting output root from which to prove the next state root. The other parameters are used for verifying the proofs posted to the contract. +3. The addition of `historicBlockHashes` to store the L1 block hashes which the `op-succinct` proofs are anchored to. Whenever a proof is posted, the merkle proof verification will use these L1 block hashes to verify the state of the L2 which is posted as blobs or calldata to the L1. +4. The new `checkpointBlockHash` function which checkpoints the L1 block hash at a given L1 block number using the `blockhash` function. +5. The `proposeL2Output` function now takes an additional `_proof` parameter, which is the proof that is posted to the contract, and removes the unnecessary `_l1BlockHash` parameter (which is redundant given the `historicBlockHashes` mapping). This function also verifies the proof using the `ISP1VerifierGateway` contract. + ## Deployment ### 1) Clone `op-succinct` repo: diff --git a/contracts/src/OPSuccinctL2OutputOracle.sol b/contracts/src/OPSuccinctL2OutputOracle.sol index ab1824db..33dae000 100644 --- a/contracts/src/OPSuccinctL2OutputOracle.sol +++ b/contracts/src/OPSuccinctL2OutputOracle.sol @@ -42,7 +42,7 @@ contract OPSuccinctL2OutputOracle is Initializable, ISemver { /// @notice An array of L2 output proposals. Types.OutputProposal[] internal l2Outputs; - /// @notice The interval in L2 blocks at which checkpoints must be submitted. + /// @notice The minimum interval in L2 blocks at which checkpoints must be submitted. /// @custom:network-specific uint256 public submissionInterval; diff --git a/utils/client/src/boot.rs b/utils/client/src/boot.rs index 2915b781..26f5928b 100644 --- a/utils/client/src/boot.rs +++ b/utils/client/src/boot.rs @@ -7,8 +7,8 @@ use op_alloy_genesis::RollupConfig; use serde::{Deserialize, Serialize}; use sha2::{Digest, Sha256}; -// ABI encoding of AggregationOutputs is 7 * 32 bytes. -pub const AGGREGATION_OUTPUTS_SIZE: usize = 7 * 32; +// ABI encoding of AggregationOutputs is 6 * 32 bytes. +pub const AGGREGATION_OUTPUTS_SIZE: usize = 6 * 32; /// Hash the serialized rollup config using SHA256. Note: The rollup config is never unrolled /// on-chain, so switching to a different hash function is not a concern, as long as the config hash