Skip to content

Commit 9b334c3

Browse files
etan-statuszah
authored andcommitted
fix big-endian merkleization for UintN arrays
UintN arrays were incorrectly merkleized on big-endian. This was fixed by making sure to use the correct buffer to store the final chunk.
1 parent 4a3e947 commit 9b334c3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

beacon_chain/ssz/merkleization.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ func chunkedHashTreeRootForBasicTypes[T](merkleizer: var SszMerkleizerImpl,
464464
if remainingValues > 0:
465465
var lastChunk: array[bytesPerChunk, byte]
466466
for i in 0 ..< remainingValues:
467-
chunk.writeBytesLE(i * sizeof(T), arr[writtenValues + i])
467+
lastChunk.writeBytesLE(i * sizeof(T), arr[writtenValues + i])
468468
merkleizer.addChunk lastChunk
469469

470470
getFinalHash(merkleizer)

0 commit comments

Comments
 (0)