Skip to content

eth_getProof answers an absent account with an empty array, so absence cannot be verified #392

Open

Description

@SDL-A1

crates/rpc/src/proof.rs:87.

eth_getProof serving from a node's own trie calls nodes_on_path, which
answers None for a key the trie does not hold, and the RPC returns an empty
accountProof. The p2p server answering the same question
(crates/sync/src/snap/server.rs:688) calls nodes_to_divergence and returns
the nodes down to the divergence point, which a client can verify.

So the three ways to ask this node about an absent account disagree:

asked via an account the trie does not hold
TrieProofRequest over rsk/64 divergence nodes -- provable
eth_getProof on an --spv node, which forwards the peer's proof verbatim divergence nodes -- provable
eth_getProof on a node with its own trie empty array -- not provable

All three versions of proof.rs that exist across branches in this repository
do this; it is not a regression on one of them.

Why it is worth an issue

A wallet cannot tell which kind of node answered it, so on the full-node path
it gets balance: 0x0 with nothing to check, which is indistinguishable from
a server that withheld. By the rule the light path already states a few
hundred lines below -- "reporting that as a zero balance would let any peer
deny any account by staying quiet" -- the client must treat that as an error.

Which means a never-used address is the one query this RPC cannot serve,
and a never-used address is a new wallet's first screen. The most common first
interaction with a light client is the case that fails.

verify_path already returns Outcome::Absent as a real result and
ProofError::Empty for an empty proof under a non-empty root, so the
verifying side needs no change at all.

What would settle it

Use nodes_to_divergence in the RPC path as the p2p server does, so empty
means "could not walk" everywhere.

The spec moves with it

RSKIP-eth-getProof-over-the-unitrie (Draft, not activated) currently
specifies the empty array in its Absence section and defers absence proofs
to "a future RSKIP". The p2p side has since defined one, so the RSKIP is
behind its own implementation and should be amended in the same change:
absence is the divergence path, and an empty array is incompleteness rather
than an answer. A caller written to the current text receives nodes where it
expected emptiness, which is the safe direction -- it still reports the same
balance -- but the text should not be left licensing the weaker behaviour.

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