Rollup Node Design - ethereum-optimism/optimistic-specs GitHub Wiki

Overview

The rollup node is responsible for maintaining the L2 chain from transactions included in the L1 chain and directly sequenced.

The rollup node operates in several modes:

  • Verifier: Constructs L2 directly from L1. Will be behind the L2 head.
  • Sequencer: Constructs L2 blocks from incoming transactions & deposits. Runs ahead of what is submitted on chain.
  • Batch Submitter: Posts L2 blocks to L1 before the Sequence Window is up.
  • Output Submitter: Posts the result of L2 execution to L1 on a regular schedule.

Components

  • eth: Definitions of common structures
  • l1: Wraps the Ethereum Client API to provide a simple download API as well as expose certain client methods
  • l2: Wraps the Ethereum Client Engine API to provide payload execution and fork choise options.
  • node: Runs the rollup node
  • test: End to end test of the rollup node
  • rollup: Implements the logic of maintaining L2 from L1

Rollup Package Overview

The rollup driver maintains a view of the L1 and L2 chains. When an updates happens to either chain, it responds and updates the L2 chain appropriately.

Inside the driver, the state object maintains a view of the chains. In the case of a linear extension to L1, it update's its state and then if is able to, creates a list of what L1 blocks should be looked when creating the next l2 blocks and passes it to the step function. In the case of a re-org, it relies on the sync package to determine what the new L2 head should be, and then continues the process of syncing from the L2 Head & it's associated L1 Parent.

The step function takes the sequence window and the L2 head (what will become the L2 parent of the first L2 block) and then does the following:

  • Fetch the L1 blocks in the specified range.
  • Parse the L1 blocks to get the deposits and batches.
  • Create the L2 block templates (multiple payload attributes) from the deposits and batches.
  • Execute the L2 payload attributes to derive the finalized blocks
  • Update the L2 Head (via the ForkChoice API)