Skip to content

Static file range calculations panic with non-zero genesis blocks (L2 rollups) #22879

@Vui-Chee

Description

@Vui-Chee

Description

When running a reth node on snapshot data that begins with a custom (non-zero) genesis block number — common in L2 rollups — the node panics during static file initialization. The static file system expects files named with ranges starting from block 0 (e.g., multiples computed by find_fixed_range), but the actual files on disk start at the genesis block number.

Root Cause

The canonical file range computed by find_fixed_range always starts at 0, but when the genesis block is non-zero, the actual first static file starts at the genesis block number. This mismatch causes three distinct issues:

  1. set_expected_block_start recomputes an incorrect end boundary — It uses find_fixed_range to derive the end block, which produces a wrong value when the range start has been adjusted for a non-zero genesis.
  2. update_index attempts to load a non-existent file — It computes a fixed range starting below the genesis block, then tries to load a file with that range which doesn't exist on disk.
  3. Static file writer looks up the wrong segment — The open() method uses an incorrect block number for segment lookup and creates new files with ranges that don't account for the genesis offset.

Impact

  • Node panic on startup when using snapshot data with non-zero genesis blocks
  • Affects L2 rollup deployments that use reth with custom genesis configurations
  • Prevents proper static file initialization and indexing

Expected Behavior

Static file range calculations should account for non-zero genesis block numbers by:

  • Preserving existing end boundaries in set_expected_block_start instead of recomputing them via find_fixed_range
  • Clamping the fixed range start to the genesis block number in update_index
  • Using the actual block number for segment lookup in the static file writer and creating new files with genesis-aware ranges

Affected Components

  • crates/static-file/types/src/segment.rsset_expected_block_start
  • crates/storage/provider/src/providers/static_file/manager.rsupdate_index
  • crates/storage/provider/src/providers/static_file/writer.rsopen()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions