OP Stack codebase V1 - Bedrock
Bedrock = the first release of the OP stack codebase.
Β
Components
Rollup Protocol
Bedrock (Q1 2023)
1. Block storage
- L2 blocks are saved to Ethereum using a non-contract address (
0xDeaDDEaDDeAdDeAdDEAdDEaddeAddEAdDEAd0001
) to minimise L1 gas expense. - L2 blocks submitted as L1 transaction calldata.
- L2 blocks are written to L1 in a compressed format to reduce costs (batch submission wire format).
2. Block production
- Sequencer has a mempool (but it is private to mitigate MEV opportunities).
- Blocks produced every 2 seconds (regardless of whether no transactions, filled to gas limits, or anything in between).
Β
Transaction can get to sequencer in 2 ways:
- Transactions submitted on L1
- these are called deposits whether they have assets attached or not β they are included in the chain in the appropriate L2 block.
- L2 blocks are identified by an epoch (the L1 block which it corresponds to).
- 1st block of an epoch includes all the deposits that happened in the L1 block to which it corresponds.
- If the sequencer attempts to ignore a legitimate L1 transaction, it ends up with a state that is inconsistent with the verifiers.
- Transactions submitted directly to the sequencer
- Cheaper to submit.
3. Block execution
Execution Engine (
op-geth
component) receives blocks using 2 mechanisms:- Execution Engine updates itself using P2P networking with other execution engines.
- Rollup node (
op-node
component) derives L2 blocks from L1 (slow mechanism, but censorship resistant).
4. Bridging assets between layers
Deposits (L1 β L2):
- You use
L1CrossDomainMessenger
orL1StandardBridge
.
- Deposit transactions become part of the canonical blockchain in the first L2 block of the βepochβ corresponding to the L1 block where the deposits were made.
Withdrawals (L2 β L1):
- Initiate withdrawal with an L2 transaction.
- Wait for next output root to be submitted to L1 (use SDK).
- Submit the withdrawal proof using
proveWithdrawalTransaction
. - This enables off-chain monitoring of the withdrawals, making it easier to identify incorrect withdrawals or output roots.
- After the fault challenge period ends (week on mainnet), finalise the withdrawal.
5. Fault proofs
If a proposed state commitment goes unchallenged for the duration of the challenge window (7 days), then it is considered final.
- Once a commitment is considered final, smart contracts on Ethereum can safely accept withdrawal proofs about the state of Optimism based on that commitment.
- When a state commitment is challenged, it can be invalidated through a fault proof.
- If the commitment is successfully challenged then it is removed from the
StateCommitmentChain
to eventually be replaced by another proposed commitment.
- NB! A successful challenge does not roll back Optimism itself, only the published commitments about the state of the chain.
The ordering of transactions and state of Optimism is unchanged by a fault proof challenge.tw