ethereum / yellowpaper

The "Yellow Paper": Ethereum's formal specification
Creative Commons Attribution Share Alike 4.0 International
1.65k stars 511 forks source link

Confusion about MPT branch node values #875

Open dlubarov opened 2 years ago

dlubarov commented 2 years ago

The yellowpaper describes MPT keys as being fixed-depth, i.e. "256-bit binary fragments". If that's accurate, then it seems a branch node can never contain a value, as its key would necessarily be shorter than those of values descending from a child.

If that's correct, then to be consistent and avoid confusion, I think the YP should either

See also: Do storage MPT branch nodes contain values?

Edit: after poking around some implementations, it seems keys are not fixed-length, so branch nodes may have values. My understanding now is that keys are 256 bits for the state and storage tries, but variable-length for the receipt and transactions tries. If that's correct, it seems the description of MPT keys as "256-bit binary fragments" is misleading and should be changed.