trie/bintrie: fix endianness in code chunk key computation (#33900)

The endianness was wrong, which means that the code chunks were stored
in the wrong location in the tree.
This commit is contained in:
Guillaume Ballet 2026-02-27 11:35:13 +01:00 committed by GitHub
parent 7793e00f0d
commit 95c6b05806
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -384,7 +384,7 @@ func (t *BinaryTrie) UpdateContractCode(addr common.Address, codeHash common.Has
if groupOffset == 0 /* start of new group */ || chunknr == 0 /* first chunk in header group */ {
values = make([][]byte, StemNodeWidth)
var offset [HashSize]byte
binary.LittleEndian.PutUint64(offset[24:], chunknr+128)
binary.BigEndian.PutUint64(offset[24:], chunknr+128)
key = GetBinaryTreeKey(addr, offset[:])
}
values[groupOffset] = chunks[i : i+HashSize]