Skip to content

Commit 6764a0c

Browse files
committed
add a new test + get all tests running
1 parent 649a591 commit 6764a0c

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

proof_ipa.go

+3-1
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,9 @@ func PostStateTreeFromProof(preroot VerkleNode, statediff StateDiff) (VerkleNode
469469
}
470470

471471
if overwrites {
472-
if err := postroot.(*InternalNode).InsertStem(stemstatediff.Stem[:], values, nil); err != nil {
472+
var stem [31]byte
473+
copy(stem[:31], stemstatediff.Stem[:])
474+
if err := postroot.(*InternalNode).InsertStem(stem[:], values, nil); err != nil {
473475
return nil, fmt.Errorf("error overwriting value in post state: %w", err)
474476
}
475477
}

proof_test.go

+9-1
Original file line numberDiff line numberDiff line change
@@ -734,6 +734,15 @@ func TestProofVerificationWithPostState(t *testing.T) {
734734
name string
735735
keys, values, keystoprove, updatekeys, updatevalues [][]byte
736736
}{
737+
{
738+
// overwrite a key
739+
name: "update_in_leaf_node",
740+
keys: [][]byte{zeroKeyTest, oneKeyTest, ffx32KeyTest},
741+
values: [][]byte{zeroKeyTest, zeroKeyTest, zeroKeyTest},
742+
keystoprove: [][]byte{zeroKeyTest},
743+
updatekeys: [][]byte{zeroKeyTest},
744+
updatevalues: [][]byte{fourtyKeyTest},
745+
},
737746
{
738747
// check for a key present at the root level
739748
name: "new_key_in_internal_node",
@@ -796,7 +805,6 @@ func TestProofVerificationWithPostState(t *testing.T) {
796805
t.Fatalf("error deserializing proof: %v", err)
797806
}
798807

799-
t.Log(dproof.Keys)
800808
if err = VerifyVerkleProofWithPreAndPostTrie(dproof, root, postroot, nil); err != nil {
801809
t.Fatalf("could not verify verkle proof: %v, original: %s reconstructed: %s", err, ToDot(root), ToDot(postroot))
802810
}

0 commit comments

Comments
 (0)