Skip to content

Commit

Permalink
sanity check: sort keys given to AddPostValuesToProof
Browse files Browse the repository at this point in the history
  • Loading branch information
gballet committed Jan 8, 2025
1 parent 4333786 commit 9dbe4d4
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion trie/verkle.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import (
"errors"
"fmt"
"math/big"
"sort"

"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
Expand Down Expand Up @@ -291,8 +292,13 @@ func (trie *VerkleTrie) IsVerkle() bool {
}

func AddPostValuesToProof(postroot *VerkleTrie, proof *verkle.Proof) error {
proof.PostValues = make([][]byte, len(proof.Keys))
if postroot != nil {
proof.PostValues = make([][]byte, len(proof.Keys))

// Sanity check: sort the keys. This shouldn't be necessary but better
// safe than sorry.
sort.Sort(verkle.Keylist(proof.Keys))

Check failure on line 300 in trie/verkle.go

View workflow job for this annotation

GitHub Actions / conversion

undefined: verkle.Keylist

Check failure on line 300 in trie/verkle.go

View workflow job for this annotation

GitHub Actions / build

undefined: verkle.Keylist

Check failure on line 300 in trie/verkle.go

View workflow job for this annotation

GitHub Actions / setup

undefined: verkle.Keylist

Check failure on line 300 in trie/verkle.go

View workflow job for this annotation

GitHub Actions / setup

undefined: verkle.Keylist

Check failure on line 300 in trie/verkle.go

View workflow job for this annotation

GitHub Actions / test-process-verkle

undefined: verkle.Keylist

Check failure on line 300 in trie/verkle.go

View workflow job for this annotation

GitHub Actions / lint

undefined: verkle.Keylist) (typecheck)

Check failure on line 300 in trie/verkle.go

View workflow job for this annotation

GitHub Actions / lint

undefined: verkle.Keylist) (typecheck)

Check failure on line 300 in trie/verkle.go

View workflow job for this annotation

GitHub Actions / lint

undefined: verkle.Keylist) (typecheck)

// Set the post values, if they are untouched, leave them `nil`
for i := range proof.Keys {
val, err := postroot.root.Get(proof.Keys[i], postroot.FlatdbNodeResolver)
Expand Down

0 comments on commit 9dbe4d4

Please sign in to comment.