Repository navigation
Description
An SPV node resolves "latest" through its header head. If header sync has
stalled -- no peers, a wedged follow loop, a partition -- state reads keep
succeeding against the last header the node accepted, and nothing in the
answer says how old it is.
Every proof returned is valid. Each one checks against a real state root
in a real validated header. They are simply answers about a block from hours
ago, and they are indistinguishable from answers about the tip.
Why it is worth an issue
This is the omission rule applied to time, and it is the one case the current
design does not cover. The proof machinery is careful to separate "proved
absent" from "did not learn" for state; a stalled chain is the same failure
in the time dimension -- the node did not learn what has happened since -- and
it currently reports it as fact.
A wallet is the worst place for this. A balance screen rendered from a
three-day-old header looks exactly like a current one, which is the
"plausible number" failure rather than the "visible error" one.
The light client in NethermindEth/nethermind#14457 handles it with numbers
worth borrowing as a precedent: a latest read requires an authenticated head
no more than 120 seconds old, triggers recovery and waits up to two seconds
when it is stale, then fails with -32001. Its README states the rule
directly -- "stale data is never served as latest" -- and separately warns
that eth_blockNumber "reports the last known height and is not a freshness
check", so a client polling the height learns nothing about staleness.
What would settle it
Two parts:
- A staleness bound on the SPV state path. Past it,
"latest"reads fail
with a distinct error rather than succeeding against an old header.
Explicit block numbers and hashes are unaffected -- a caller asking about
a specific old block is not being misled. - A freshness report a client can poll: head number, head timestamp, and age.
eth_syncingis the natural home, and it pairs with A node does not advertise the oldest block it can prove state for #395.
RSK has no finality gadget, so there is no finalized selector to add
alongside. The analogue of their stronger read is a confirmation or
accumulated-work depth, which belongs in client policy over a published head
age rather than as a second server-side selector.
The part that needs measuring, not choosing
What the bound should be. Rootstock targets ~30-second blocks, so "ten slots"
would be about five minutes, but inter-block variance on this chain is real
and a bound set by analogy will either flap during ordinary gaps or be too
loose to catch a stall. It should be derived from measured inter-block times
rather than picked.
Clock dependence comes with it: a freshness check trusts the local clock, and
on a phone that is user-settable. It needs to fail safe when the clock is
wrong rather than become a denial of service -- Nethermind hit a
slow-host-clock bug in their own trials and had to add a bounded next-slot
retry.
Activity