Skip to content

node: boot spins its whole chain-read budget when the RPC has no state at the lagged snapshot block #2820

Open

Description

@thiras

Component

node

Version

v0.3.1

Network

Arbitrum Sepolia testnet (our fleet, 8 nodes)

Problem

Every boot enumeration pins its reads to head - SNAPSHOT_LAG_MARGIN_BLOCKS (256 blocks, about 64 s on Arbitrum) through chain_events::shared_head::snapshot_block. The pin keeps the reads clear of load-balancer upstream lag (#2164). Three bootstraps use it: the CapacityBond registry (dht/capacity_bond_registry.rs), the slash watcher (slash_watcher.rs) and the blacklist watcher (blacklist_watcher.rs). The periodic re-enumerations use it too.

snapshot_block first calls eth_getCode(contract) at the lagged block. If the RPC endpoint does not keep state that far back, that call fails, and every later attempt fails the same way. BootRetry classes the error as transient. The boot spends the whole 600 s BOOT_CHAIN_RETRY_BUDGET, the process exits, and systemd restarts it into the same loop. Fail-closed holds, so nothing unsafe is served, but the node never comes up while the endpoint stays like this.

The SNAPSHOT_LAG_MARGIN_BLOCKS docs already name the case: "A full node that prunes state within 256 blocks (geth keeps 128) answers every pinned read with a transient error, so a boot against one spends its retry budget." No fallback handles it.

Observed on the fleet (2026-11-01)

At 12:08:35 UTC all 8 nodes restarted. The RPC preflight and the deployment preflight passed: both read at latest, including eth_getCode(PaymentPool). The CapacityBond registry snapshot then failed on every attempt:

read the CapacityBond registry snapshot block: server returned an error response:
error code 27: Unknown state. First available state is 1

Each node gave up after 15 attempts in about 543 s, exited, and did the same again on the next start. The third start, at 12:31:51, was ready in about 9 s. The endpoint served latest state but not state 256 blocks back. All 8 nodes were down for about 23 minutes. Their metrics were dark for the same window (#2819).

Options

  1. Pin at head when the lagged state is unavailable. This mirrors the existing no-code fallback in snapshot_block, which already pins at head when the contract has no code at the lagged block. The hard part is detection: "state unavailable" has no standard JSON-RPC code. We see 27 / "Unknown state" here, geth says "missing trie node", and Nitro and other providers word it differently. One provider-independent approach: if the lagged eth_getCode fails but the same call at latest succeeds, treat the lagged block as unservable and pin at head. A head pin is exposed to upstream lag again (node: boot enumeration snapshots pinned to exact head fail behind load-balanced RPCs with lagging upstreams #2164), but BootRetry already retries that, and the head is the only block such an endpoint can serve.
  2. Walk the margin down. Retry the lagged read at smaller margins (256 → 64 → 16 → 0) until one resolves. This keeps as much lag protection as the endpoint allows, at the cost of more reads and more code.
  3. Make it an operator requirement. Document that blockchain.rpc_url must serve state at least SNAPSHOT_LAG_MARGIN_BLOCKS back. Fail fast at boot with a clear message, as a deterministic BootFault instead of a 10-minute transient spin, when the lagged read fails and latest succeeds. The node still does not come up, but the operator sees the cause in seconds.

Options 1 and 3 share the same probe (lagged fails, latest succeeds). They differ only in whether the node then continues or exits.

Scope notes

  • Whatever is chosen must keep fail-closed boot: no ALPN opens before a clean blacklist enumeration and enforcement pass.
  • The periodic re-enumerations call the same snapshot_block, so a running node pointed at such an endpoint would fail those too. Not observed yet; the fix should cover both paths.
  • Update the SNAPSHOT_LAG_MARGIN_BLOCKS and snapshot_block docs, plus any operator doc that lists RPC requirements.

Activity

  1. added
    kind:bug
    design:missing-decision
    prio:medium
    area:node
    on Nov 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:nodedesign:missing-decisionkind:bugprio:medium

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    • Status
      Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions