Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Confusion about MPT branch node values #875

Open
dlubarov opened this issue Sep 27, 2022 · 0 comments
Open

Confusion about MPT branch node values #875

dlubarov opened this issue Sep 27, 2022 · 0 comments

Comments

@dlubarov
Copy link

dlubarov commented Sep 27, 2022

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

  • Describe MPTs as they're actually used: each key is 256 bits, and branches do not contain values, but for historical reasons there's an unused value field in a branch node's RLP.
  • Describe the more general MPT construction with variable-length keys. In this case I think 256-bit keys should not be mentioned, or it could be framed like "in practice, currently all MPTs have 256-bit keys".

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant