Skip to content

A node does not advertise the oldest block it can prove state for #395

Open

Description

@SDL-A1

crates/rpc/src/witness_search.rs (retention_floor), rsk_storageStatus.

A pruning or epoch node can only prove state above its collection floor.
retention_floor already derives that number from
trie_store.collected_below() and uses it as the default bottom of
rsk_lastAccountChange's search -- with a comment explaining exactly why a
probe below it is useless:

on a pruning or epoch node a probe below that floor fails outright --
searching from zero would fail on the first probe and look like a broken
method rather than a node that does not keep the state being asked about

But the number is not published anywhere a client can read it.
rsk_storageStatus reports trie-collection byte counts and head, not the
oldest provable block. So a client discovers the floor the same way the
comment says is confusing: by issuing a request that fails.

Why it is worth an issue

A light client has to draw the line between "history I can prove" and
"history I cannot reach", and show it. The alternative is history that stops
quietly, which a user reads as "nothing happened before this" -- and that
reading is wrong in precisely the case where it matters, a wallet restored
from a seed whose older activity is outside the window.

The client cannot draw a line it has not been told about, and probe-and-fail
is both slow and ambiguous: a failure at height N could be "below my floor" or
"I am broken".

NethermindEth/nethermind#14457 publishes the equivalent as part of its RPC
contract rather than leaving it to discovery -- historical state within 32
ancestors of either head, blocks and receipts within 256, with an explicit
unavailable error outside those windows.

What would settle it

Publish oldestProvableBlock, either in eth_syncing's payload alongside the
freshness fields in #394 or in a small capabilities method.

The SPV case needs care: there the relevant floor is the peer's, which this
node does not know. retention_floor already returns None for a node with
no local trie, with the right reasoning ("an SPV node cannot know its peer's
floor, and guessing one would only move the error"). The published field
should carry that through as null meaning "unknown", not as zero, since zero
would claim the whole chain is provable.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions