From 026aba8b460563251b43803a8a0fab0f08afefc4 Mon Sep 17 00:00:00 2001 From: Guillaume Ballet <3272758+gballet@users.noreply.github.com> Date: Mon, 9 Sep 2024 15:08:17 +0200 Subject: [PATCH] fix: left-pad leaves --- tree.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tree.go b/tree.go index e3a20f22..0a2fedee 100644 --- a/tree.go +++ b/tree.go @@ -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 {