Skip to content

Commit

Permalink
docs: L2OutputOracle modifications (#202)
Browse files Browse the repository at this point in the history
* docs: l200

* fix

* add
  • Loading branch information
ratankaliani authored Nov 5, 2024
1 parent 1d63c96 commit ba3359c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
16 changes: 16 additions & 0 deletions book/getting-started/l2-output-oracle.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion contracts/src/OPSuccinctL2OutputOracle.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions utils/client/src/boot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit ba3359c

Please sign in to comment.