In this track: Advanced security reasoning
advanced · 4 MIN READ

Merkle proof leaf ambiguity

Leaf and branch encodings need an unambiguous separation.

LET’S PICTURE IT

A filing system should not confuse an original record with a pair of record fingerprints.

SEE IT FOR YOURSELF
Build a root and follow one membership proofStep 1 / 4
Build a root and follow one membership proofA0x03783f…b760B0x1f675b…9111C0x017e66…8f72D0x6c3fd3…79f2A0x03783f…b760B0x1f675b…9111C0x017e66…8f72D0x6c3fd3…79f2hash(A,B)0x69de75…24a0hash(C,D)0xe62e1d…b5a4A0x03783f…b760B0x1f675b…9111C0x017e66…8f72D0x6c3fd3…79f2hash(A,B)0x69de75…24a0hash(C,D)0xe62e1d…b5a4ROOT0x4e2b32…5956A0x03783f…b760B0x1f675b…9111C0x017e66…8f72D0x6c3fd3…79f2hash(A,B)0x69de75…24a0hash(C,D)0xe62e1d…b5a4ROOT0x4e2b32…5956

This example hashes UTF-8 A, B, C and D. The displayed hashes are abbreviated, and the tree uses the playground’s sorted-pair convention.

Animated local teaching model. No wallet, RPC or live blockchain data. Some labels and hashes are abbreviated for readability.

Review the entire tree scheme

The hash function, original field encoding, leaf hashing and parent combination form one construction. A strong digest alone does not establish a safe scheme.

Inspect shared input shapes

A raw sixty-four-byte leaf can resemble the concatenation of two thirty-two-byte nodes under unsuitable conventions. Verify how the chosen library prevents that confusion.

Use compatible builder and verifier

Double-hashed leaves or explicit domain tags can be part of reviewed designs. They must be applied consistently when building the root and checking claims.

Keep claim limits separate

Even an unambiguous valid proof does not consume a claim or authenticate an arbitrary supplied root. Check root authority and repeated redemption rules too.

Work through the boundary

review leaf encoding
review leaf/branch separation
review pair rules
review authorized root and claim consumption

A simplified local review scenario. The example establishes a question to test, not a guarantee of production safety.

QUICK CHECK · NO PRESSURE

Does changing only the verifier’s leaf hash preserve compatibility with an old root?

Your progress stays in this browser.
Keep exploring the original referencedocs.openzeppelin.com ↗

Original explanations by EtherTools. Examples are educational and source-linked; this site is independent of the Ethereum Foundation. Our approach.