Skip to content

Commit

Permalink
fix: left-pad leaves
Browse files Browse the repository at this point in the history
  • Loading branch information
gballet committed Sep 9, 2024
1 parent dffa756 commit 026aba8
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tree.go
Original file line number Diff line number Diff line change
Expand Up @@ -1853,10 +1853,11 @@ func (n *LeafNode) serializeLeafWithUncompressedCommitments(cBytes, c1Bytes, c2B
count++
lastIdx = i
setBit(bitlist[:], i)
children = append(children, v...)
// left-pad values if this isn't 32-byte aligned
if padding := emptyValue[:LeafValueSize-len(v)]; len(padding) != 0 {
children = append(children, padding...)
}
children = append(children, v...)
}

if isEoA {
Expand Down

0 comments on commit 026aba8

Please sign in to comment.