Skip to content

Commit

Permalink
mod: update go-verkle (#312)
Browse files Browse the repository at this point in the history
* update go-verkle

Signed-off-by: Ignacio Hagopian <[email protected]>

* fix breaking apis

Signed-off-by: Ignacio Hagopian <[email protected]>

* fix apis

Signed-off-by: Ignacio Hagopian <[email protected]>

* avoid test failing due to timeouts

Signed-off-by: Ignacio Hagopian <[email protected]>

---------

Signed-off-by: Ignacio Hagopian <[email protected]>
  • Loading branch information
jsign authored Nov 27, 2023
1 parent fc8f4b9 commit 7f310da
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 15 deletions.
4 changes: 1 addition & 3 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,5 @@ jobs:
uses: actions/setup-go@v2
with:
go-version: 1.21.1
- name: Download precomputed points
run: wget -nv https://github.com/gballet/go-verkle/releases/download/banderwagonv3/precomp -Otrie/utils/precomp
- name: Test
run: go test ./...
run: go test ./... -timeout=10h
8 changes: 4 additions & 4 deletions cmd/geth/verkle.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ func convertToVerkle(ctx *cli.Context) error {

// Otherwise, store the previous group in the tree with a
// stem insertion.
vRoot.InsertStem(chunkkey[:31], values, chaindb.Get)
vRoot.InsertValuesAtStem(chunkkey[:31], values, chaindb.Get)
}

// Write the code size in the account header group
Expand Down Expand Up @@ -267,7 +267,7 @@ func convertToVerkle(ctx *cli.Context) error {
copy(k[:], []byte(s))
// reminder that InsertStem will merge leaves
// if they exist.
vRoot.InsertStem(k[:31], vs, chaindb.Get)
vRoot.InsertValuesAtStem(k[:31], vs, chaindb.Get)
}
translatedStorage = make(map[string][][]byte)
vRoot.FlushAtDepth(2, saveverkle)
Expand All @@ -276,7 +276,7 @@ func convertToVerkle(ctx *cli.Context) error {
for s, vs := range translatedStorage {
var k [31]byte
copy(k[:], []byte(s))
vRoot.InsertStem(k[:31], vs, chaindb.Get)
vRoot.InsertValuesAtStem(k[:31], vs, chaindb.Get)
}
storageIt.Release()
if storageIt.Error() != nil {
Expand All @@ -285,7 +285,7 @@ func convertToVerkle(ctx *cli.Context) error {
}
}
// Finish with storing the complete account header group inside the tree.
vRoot.InsertStem(stem[:31], newValues, chaindb.Get)
vRoot.InsertValuesAtStem(stem[:31], newValues, chaindb.Get)

if time.Since(lastReport) > time.Second*8 {
log.Info("Traversing state", "accounts", accounts, "elapsed", common.PrettyDuration(time.Since(start)))
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ require (
github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5
github.com/fsnotify/fsnotify v1.6.0
github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff
github.com/gballet/go-verkle v0.1.1-0.20231025151349-87337dd2894a
github.com/gballet/go-verkle v0.1.1-0.20231125115329-d193f0b46e01
github.com/go-stack/stack v1.8.1
github.com/gofrs/flock v0.8.1
github.com/golang-jwt/jwt/v4 v4.3.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ github.com/garslo/gogen v0.0.0-20170306192744-1d203ffc1f61/go.mod h1:Q0X6pkwTILD
github.com/gavv/httpexpect v2.0.0+incompatible/go.mod h1:x+9tiU1YnrOvnB725RkpoLv1M62hOWzwo5OXotisrKc=
github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff h1:tY80oXqGNY4FhTFhk+o9oFHGINQ/+vhlm8HFzi6znCI=
github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww=
github.com/gballet/go-verkle v0.1.1-0.20231025151349-87337dd2894a h1:UV5Et3Ab62e6hQ6vDZC0h0i9hmKm8KKtV78zDOzud08=
github.com/gballet/go-verkle v0.1.1-0.20231025151349-87337dd2894a/go.mod h1:QNpY22eby74jVhqH4WhDLDwxc/vqsern6pW+u2kbkpc=
github.com/gballet/go-verkle v0.1.1-0.20231125115329-d193f0b46e01 h1:Jm7DG6/BptrrNgOh9Jb6LPBbz75VJA5FkFKB4O/zbQw=
github.com/gballet/go-verkle v0.1.1-0.20231125115329-d193f0b46e01/go.mod h1:OzHSBt37xRRHc27lb9PaCldBnJYQZP8KcMdYyOB2dtU=
github.com/getkin/kin-openapi v0.53.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4=
github.com/getkin/kin-openapi v0.61.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4=
github.com/getsentry/sentry-go v0.12.0/go.mod h1:NSap0JBYWzHND8oMbyi0+XZhUalc1TBdRL1M71JZW2c=
Expand Down
2 changes: 1 addition & 1 deletion trie/transition.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ func (t *TransitionTrie) UpdateStem(key []byte, values [][]byte) error {
trie := t.overlay
switch root := trie.root.(type) {
case *verkle.InternalNode:
return root.InsertStem(key, values, t.overlay.FlatdbNodeResolver)
return root.InsertValuesAtStem(key, values, t.overlay.FlatdbNodeResolver)
default:
panic("invalid root type")
}
Expand Down
8 changes: 4 additions & 4 deletions trie/verkle.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func (t *VerkleTrie) GetAccount(addr common.Address) (*types.StateAccount, error
)
switch t.root.(type) {
case *verkle.InternalNode:
values, err = t.root.(*verkle.InternalNode).GetStem(versionkey[:31], t.FlatdbNodeResolver)
values, err = t.root.(*verkle.InternalNode).GetValuesAtStem(versionkey[:31], t.FlatdbNodeResolver)
default:
return nil, errInvalidRootType
}
Expand Down Expand Up @@ -176,7 +176,7 @@ func (t *VerkleTrie) UpdateAccount(addr common.Address, acc *types.StateAccount)

switch root := t.root.(type) {
case *verkle.InternalNode:
err = root.InsertStem(stem, values, t.FlatdbNodeResolver)
err = root.InsertValuesAtStem(stem, values, t.FlatdbNodeResolver)
default:
return errInvalidRootType
}
Expand All @@ -191,7 +191,7 @@ func (t *VerkleTrie) UpdateAccount(addr common.Address, acc *types.StateAccount)
func (trie *VerkleTrie) UpdateStem(key []byte, values [][]byte) error {
switch root := trie.root.(type) {
case *verkle.InternalNode:
return root.InsertStem(key, values, trie.FlatdbNodeResolver)
return root.InsertValuesAtStem(key, values, trie.FlatdbNodeResolver)
default:
panic("invalid root type")
}
Expand Down Expand Up @@ -225,7 +225,7 @@ func (t *VerkleTrie) DeleteAccount(addr common.Address) error {

switch root := t.root.(type) {
case *verkle.InternalNode:
err = root.InsertStem(stem, values, t.FlatdbNodeResolver)
err = root.InsertValuesAtStem(stem, values, t.FlatdbNodeResolver)
default:
return errInvalidRootType
}
Expand Down

0 comments on commit 7f310da

Please sign in to comment.