Skip to content

Commit

Permalink
docs: make initalization more clear in terms of initial state
Browse files Browse the repository at this point in the history
  • Loading branch information
fakedev9999 committed Jan 28, 2025
1 parent ba34da9 commit 8f7c4b2
Showing 1 changed file with 33 additions and 20 deletions.
53 changes: 33 additions & 20 deletions book/fault_proofs/fault_proof_architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,26 +95,39 @@ function initialize() external payable virtual

Initializes the dispute game with:

- Parent game reference (if any)
- First game uses `uint32.max` as parent index
- Subsequent games must reference a valid parent game with:
- Same game type
- Parent game must not have been won by challenger
- Parent game's root claim becomes the starting output root
- Parent game's l2 block number becomes the starting block number

- Claimed output root
- Must correspond to a block number after the starting block
- For first game: starts from `GENESIS_L2_OUTPUT_ROOT`
- For subsequent games: starts from parent game's l2 output root

- Proposer's bond deposit
- Enforced by the `DisputeGameFactory` contract
- Held in the dispute game contract until resolution

- Status
- Set to `ProposalStatus.Unchallenged`
- Starts `MAX_CHALLENGE_DURATION` timer
- Initial state of the game
- `startingOutputRoot`: Starting point for verification
- For first game: `GENESIS_L2_OUTPUT_ROOT` at `GENESIS_L2_BLOCK_NUMBER`
- For subsequent games: Parent game's root claim and block number

- `claimData`: Core game state
- `parentIndex`: Reference to parent game (`uint32.max` for first game)
- `counteredBy`: Initially `address(0)`
- `prover`: Initially `address(0)`
- `claim`: Proposer's claimed output root
- `status`: Set to `ProposalStatus.Unchallenged`
- `deadline`: Set to `block.timestamp + MAX_CHALLENGE_DURATION`

- Validation Rules
- Parent Game (if not first game)
- Must be same game type
- Must not have been won by challenger
- Root claim becomes starting output root

- Output Root
- Must be after starting block number
- First game starts from genesis
- Later games start from parent's output

- Bond Management
- Proposer's bond enforced by factory
- Held in contract until resolution

Initialization will revert if:
- Already initialized
- Invalid parent game
- Root claim at/before starting block
- Incorrect calldata size for `extraData`

### Challenge

Expand Down

0 comments on commit 8f7c4b2

Please sign in to comment.