From 95c6b05806c2ffa0e987f430c10899a6398fa587 Mon Sep 17 00:00:00 2001 From: Guillaume Ballet <3272758+gballet@users.noreply.github.com> Date: Fri, 27 Feb 2026 11:35:13 +0100 Subject: [PATCH] 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. --- trie/bintrie/trie.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/trie/bintrie/trie.go b/trie/bintrie/trie.go index ecdd002331..a509c471b8 100644 --- a/trie/bintrie/trie.go +++ b/trie/bintrie/trie.go @@ -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]