Fraud Proof in OP Stack

Why Fraud Proof is Needed

In OP Rollup, anyone is allowed to submit blocks without providing proof of validity, making the system more flexible and efficient. However, how can the validity of blocks be ensured? The OP Stack-based chain specifies a time window and sets a challenge period. During this period, if a verifier detects a discrepancy between the updated state on L1 and the state after processing the data provided by DA, a fraud proof is initiated to receive substantial rewards. The simplest way for L1 in such a case is to re-execute the transactions on L1 smart contracts and check if the state is correct. This method is known as "simple replay proof."

Classification of Fraud Proof

Fraud Proof is an adversarial protocol, and based on the number and nature of interactions during the proof process, it can be categorized into several types.

Non-Interactive Fraud Proof

The core idea of non-interactive fraud proof is to re-execute transactions to confirm the consistency of the results. An EVM environment in L1 is used to implement an EVM environment by Solidity, accepting any type of smart contract in EVM opcode format (EVM in EVM). However, this design has some limitations, such as:

Interactive Fraud Proof

Considering the challenges posed by non-interactive fraud proof, the interactive fraud proof approach appears to be more favorable. Unlike the transaction re-execution in non-interactive fraud proof, interactive fraud proof can focus more on the disputed portions between the parties, reducing the data processed on the chain. An example of this is a multi-round interactive proof, a protocol involving back-and-forth interactions between a challenger and a sequencer. For a disputed block, binary search / bisection can be used to identify the problematic instruction, minimizing the work that L1 must complete during a dispute process. L1 no longer needs to replay the entire transaction, only re-executing a specific instruction is necessary.

Comparison of Interactive and Non-Interactive Fraud Proof

AspectInteractive Fraud ProofNon-Interactive Fraud Proof
Time EfficiencyTime is extended, high requirements for short-term on-chain interactions, limited by interaction efficiencyVerification time is relatively stable compared to interactive fraud proof
Client ModificationRequires minimal modifications to the clientRequires significant modifications to the client to support L1's simulation of L2 operations
L1 Contract AdaptationNot affected, can directly use L1 contracts on L2Cannot directly use L1 contracts on L2, requires adaptation
Space EfficiencyDoes not need to publish status declarations for all L2 tx, only submits problematic opcodesNeeds to publish status declarations for all L2 tx, occupying significant L1 space
Gas LimitationInteractive FP only submits problematic opcodes, smaller Gas limitationNon-interactive FP submits all tx, larger Gas limitation, affecting L2 tx execution
Instruction LimitationNo instruction limitation, can submit any opcodeSubject to EVM limitations, cannot use instructions not present in EVM

Design of Optimism Fraud Proof

Optimism has designed its Fraud Proof system with high decoupling and abstraction of components, making components replaceable.

Core Components

Optimism's Fraud Proof system has three core components:

Fraud Proof Program

Fraud Proof Program (FPP) is designed as a Client-Server architecture system. It initiates the fraud proof process by accepting commitments for all Rollup inputs (L1 data) and handling disputes.

As a stateless (deterministic, the same input yields the same output) middleware, it verifies claims about L2 state transitions. It applies L1 data to the finalized L2 state, reconstructs the latest L2 state, fetches data through the Preimage Oracle, and completes state changes in memory. This process involves two steps:

  1. In op-node, processes L1 blocks into L2 block bodies.
  2. In op-geth, reconstructs L2 state from L2 block bodies.

FPP consists of two components:

Fraud Proof Virtual Machine (FPVM)

Implements the functionality of a state transition function, providing external data for the state transition stage through a pre-image oracle and initiating fraud proofs through op-program.

Supports various implementations, such as Cannon (based on the MIPS instruction set) and Asterisc (based on the RISC V instruction set).

Dispute Game

Determines whether the L2 state is correct by binary searching through the instruction trace given by an FPP running in a simulator. Ultimately, disputed blocks are reduced to a single instruction, resolved through the VM. It is essentially a simple state machine, initializing a RootClaim (True or False) for any information.

Preimage

In addition to these three components, there is also a Pre-Image component. The Pre-Image Oracle serves as the communication method between FPP and FPVM. A pre-image corresponds to the raw data for a specific hash. By deploying relevant preimage oracle contracts on L1, L1 can use preimage to access L2 state based on a hash.

The request type for pre-image is determined by its first byte, for detailed information, see here (opens in a new tab).

Workflow of Fraud Proof

Fraud Proof Workflow

  1. The op-challenger monitors the L2OutputOracle contract, periodically checks the legality of blocks, and initiates a challenge as soon as an illegal block is detected.
  2. In the off-chain environment, op-program is compiled into the MIPS instruction set (mipsevm). Then, based on block information, a corresponding instruction trace is generated (L1 block -> L2 blocks -> L2 state). Some status information is also callback to op-challenger.
  3. The op-challenger creates a FaultDisputeGame contract through a factory contract. Based on the input from the instruction trace, it uses binary search to determine the ultimately disputed single instruction.
  4. Using the pre-state of this instruction (from the Preimage Oracle contract), the instruction is executed in the MIPS contract, completing the state transition and obtaining the post-state.
  5. The state is returned to the FaultDisputeGame contract, determining the correctness of the instruction and completing the fault proof.

Sign up for our newsletter

Stay up to date with the roadmap progress, announcements and exclusive discounts feel free to sign up with your email.

© By Whisker —@whisker17