From 09d9e01e650d43edcd1fe5cd086ab56df5ce5731 Mon Sep 17 00:00:00 2001 From: Guillaume Ballet <3272758+gballet@users.noreply.github.com> Date: Wed, 8 Jun 2022 15:51:27 +0000 Subject: [PATCH] actually use the function --- cmd/geth/converkle.go | 7 ++++--- go.mod | 2 +- go.sum | 2 ++ trie/utils/verkle.go | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/cmd/geth/converkle.go b/cmd/geth/converkle.go index 3324b208d2e6..1f49b568cfff 100644 --- a/cmd/geth/converkle.go +++ b/cmd/geth/converkle.go @@ -321,8 +321,9 @@ func convertToVerkle(ctx *cli.Context) error { // Save every slot into the tree if slotCh != nil { var ( - laststem [31]byte - values = make([][]byte, 256) + laststem [31]byte + values = make([][]byte, 256) + addrpoint = trieUtils.EvaluateAddressPoint(accHash.Bytes()) ) copy(laststem[:], stem) for sh := range slotCh { @@ -330,7 +331,7 @@ func convertToVerkle(ctx *cli.Context) error { log.Info("Traversing state", "accounts", accounts, "in", accHash.String(), "elapsed", common.PrettyDuration(time.Since(start))) lastReport = time.Now() } - slotkey := trieUtils.GetTreeKeyStorageSlot(accHash.Bytes(), uint256.NewInt(0).SetBytes(sh.hash.Bytes())) + slotkey := trieUtils.GetTreeKeyStorageSlotWithEvaluatedAddress(addrpoint, uint256.NewInt(0).SetBytes(sh.hash.Bytes())) var value [32]byte copy(value[:len(sh.slot)-1], sh.slot) diff --git a/go.mod b/go.mod index c5cd1a84e902..74e828f46e63 100644 --- a/go.mod +++ b/go.mod @@ -26,7 +26,7 @@ require ( github.com/fjl/gencodec v0.0.0-20220412091415-8bb9e558978c github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff - github.com/gballet/go-verkle v0.0.0-20220526095713-e14979f99d7c // indirect + github.com/gballet/go-verkle v0.0.0-20220607144516-5ceb4395efff // indirect github.com/go-stack/stack v1.8.0 github.com/golang-jwt/jwt/v4 v4.3.0 github.com/golang/protobuf v1.4.3 diff --git a/go.sum b/go.sum index ea70c919a997..4706b377e341 100644 --- a/go.sum +++ b/go.sum @@ -169,6 +169,8 @@ github.com/gballet/go-verkle v0.0.0-20220526095713-e14979f99d7c h1:hPcRl8HZES5vM github.com/gballet/go-verkle v0.0.0-20220526095713-e14979f99d7c/go.mod h1:Q8VN4hcqHTwwrcU72/31sCU30IUQHuH0rcFe/b2SIFc= github.com/gballet/go-verkle v0.0.0-20220527070744-f7946ac010f2 h1:M2EhCRamsasDrba35nzsD9ifTZlw55Mk5h6jFhTV9q4= github.com/gballet/go-verkle v0.0.0-20220527070744-f7946ac010f2/go.mod h1:Q8VN4hcqHTwwrcU72/31sCU30IUQHuH0rcFe/b2SIFc= +github.com/gballet/go-verkle v0.0.0-20220607144516-5ceb4395efff h1:jryq5kEJgiYmUjf0RyzDyGOsTLtRM0J/mrg2lRTIrEM= +github.com/gballet/go-verkle v0.0.0-20220607144516-5ceb4395efff/go.mod h1:o/XfIXWi4/GqbQirfRm5uTbXMG5NpqxkxblnbZ+QM9I= 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/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= diff --git a/trie/utils/verkle.go b/trie/utils/verkle.go index 9eee06d1f259..ff11b908c2e1 100644 --- a/trie/utils/verkle.go +++ b/trie/utils/verkle.go @@ -185,7 +185,7 @@ func getTreeKeyWithEvaluatedAddess(evaluated *verkle.Point, treeIndex *uint256.I } -func evaluateAddressPoint(address []byte) *verkle.Point { +func EvaluateAddressPoint(address []byte) *verkle.Point { if len(address) < 32 { var aligned [32]byte address = append(aligned[:32-len(address)], address...)