go-ethereum/trie/nomttrie
weiihann 4a2a10ca7d nomt: Phase F — cross-validation tests proving NOMT root == bintrie root
Two root causes of hash mismatch fixed:

1. Canonical root computation: Hash() now uses BuildInternalTree(skip=0)
   over all known stems instead of the page tree's depth-7 internal root.
   The page tree is still updated for persistent storage, but the canonical
   root bypasses its depth-7 worker split that added extra wrapping levels.

2. Code chunk grouping: UpdateContractCode now matches bintrie's group-based
   key derivation exactly — computing the stem key only at group boundaries
   and using groupOffset as the suffix, instead of computing a separate
   GetBinaryTreeKey per chunk (which produced different stems).

Cross-validation tests (compat_test.go) assert strict equality:
- TestSingleAccountRootMatch
- TestMultiAccountRootMatch
- TestStorageRootMatch
- TestCodeChunkRootMatch
- TestMixedOpsRootMatch
- 4 BuildInternalTree vs bintrie diagnostic tests

48 tests passing, race-detector clean.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 23:42:04 +08:00
..
compat_test.go nomt: Phase F — cross-validation tests proving NOMT root == bintrie root 2026-02-12 23:42:04 +08:00
key_encoding.go trie/nomttrie: add EIP-7864 key derivation and value encoding (Phase B) 2026-02-12 22:30:14 +08:00
key_encoding_test.go trie/nomttrie: add EIP-7864 key derivation and value encoding (Phase B) 2026-02-12 22:30:14 +08:00
stem.go nomt: Phase C — stem hash computation and flat state helpers 2026-02-12 22:35:23 +08:00
stem_test.go nomt: Phase C — stem hash computation and flat state helpers 2026-02-12 22:35:23 +08:00
trie.go nomt: Phase F — cross-validation tests proving NOMT root == bintrie root 2026-02-12 23:42:04 +08:00
trie_test.go nomt: Phase F — cross-validation tests proving NOMT root == bintrie root 2026-02-12 23:42:04 +08:00
value_encoding.go trie/nomttrie: add EIP-7864 key derivation and value encoding (Phase B) 2026-02-12 22:30:14 +08:00
value_encoding_test.go trie/nomttrie: add EIP-7864 key derivation and value encoding (Phase B) 2026-02-12 22:30:14 +08:00