From 448b93fbbb54a9ef591b6a87d4147e8eed33c5e0 Mon Sep 17 00:00:00 2001 From: Guillaume Ballet <3272758+gballet@users.noreply.github.com> Date: Tue, 20 Apr 2021 13:49:35 +0200 Subject: [PATCH] Fix the slowdown that occured after go-verkle #15 --- cmd/geth/snapshot.go | 12 +++--------- go.mod | 6 +++--- go.sum | 12 ++++++++++++ 3 files changed, 18 insertions(+), 12 deletions(-) diff --git a/cmd/geth/snapshot.go b/cmd/geth/snapshot.go index 167210df9739..093aeacb432b 100644 --- a/cmd/geth/snapshot.go +++ b/cmd/geth/snapshot.go @@ -477,12 +477,6 @@ func GenerateTestingSetupWithLagrange(secret string, n uint64, fftCfg *kzg.FFTSe } func computeCommitment(ctx *cli.Context) error { - fftCfg := kzg.NewFFTSettings(10) - s1, s2, lg1, err := GenerateTestingSetupWithLagrange("1927409816240961209460912649124", 1024, fftCfg) - if err != nil { - panic(err) - } - ks := kzg.NewKZGSettings(fftCfg, s1, s2) stack, _ := makeConfigNode(ctx) defer stack.Close() @@ -499,16 +493,16 @@ func computeCommitment(ctx *cli.Context) error { nodesCh := make(chan verkle.FlushableNode) verkleGenerate := func(db ethdb.KeyValueWriter, in chan snapshot.TrieKV, out chan common.Hash) { - t := verkle.New(10, lg1) + t := verkle.New(10) for leaf := range in { - t.InsertOrdered(common.CopyBytes(leaf.Key[:]), leaf.Value, ks, nodesCh) + t.InsertOrdered(common.CopyBytes(leaf.Key[:]), leaf.Value, nodesCh) } // Flush remaining nodes to nodes channel rootNode, ok := t.(*verkle.InternalNode) if !ok { panic("verkle tree has invalid root node") } - comm := t.ComputeCommitment(ks) + comm := t.ComputeCommitment() rootNode.Flush(nodesCh) root := common.BytesToHash(bls.ToCompressedG1(comm)) out <- root diff --git a/go.mod b/go.mod index 9393309d1dc1..a5c4fa432ce1 100644 --- a/go.mod +++ b/go.mod @@ -18,7 +18,7 @@ require ( github.com/fatih/color v1.7.0 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-20210414141224-8c72cb0024c3 + github.com/gballet/go-verkle v0.0.0-20210420105604-589b0c59e8db github.com/go-stack/stack v1.8.0 github.com/golang/protobuf v1.4.3 github.com/golang/snappy v0.0.3-0.20201103224600-674baa8c7fc3 @@ -50,8 +50,8 @@ require ( github.com/stretchr/testify v1.7.0 github.com/syndtr/goleveldb v1.0.1-0.20200815110645-5c35d600f0ca github.com/tyler-smith/go-bip39 v1.0.1-0.20181017060643-dbb3b84ba2ef - golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2 - golang.org/x/sys v0.0.0-20210414055047-fe65e336abe0 + golang.org/x/crypto v0.0.0-20210415154028-4f45737414dc + golang.org/x/sys v0.0.0-20210420072515-93ed5bcd2bfe golang.org/x/text v0.3.3 golang.org/x/time v0.0.0-20190308202827-9d24e82272b4 gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce diff --git a/go.sum b/go.sum index 03e3568ba577..0f8354d8a282 100644 --- a/go.sum +++ b/go.sum @@ -159,12 +159,18 @@ github.com/gballet/go-verkle v0.0.0-20210331172732-b0e741f9a8ec h1:SFb34albxbnAc github.com/gballet/go-verkle v0.0.0-20210331172732-b0e741f9a8ec/go.mod h1:s2tVAxI5FnThDvOCzrUpNU8HxoGvFBelNLZpDEEsFuk= github.com/gballet/go-verkle v0.0.0-20210401094554-ecbf17f30efb h1:rFYqmC5s6fMf2d1c5QoHRfylj6RiJcQPhUz9fq2DHAs= github.com/gballet/go-verkle v0.0.0-20210401094554-ecbf17f30efb/go.mod h1:s2tVAxI5FnThDvOCzrUpNU8HxoGvFBelNLZpDEEsFuk= +github.com/gballet/go-verkle v0.0.0-20210406144921-a836bace1e34 h1:gnQcDoHSBGG6wlyUtGAqy7B9qYg+1Im5qLp2M8bofv4= +github.com/gballet/go-verkle v0.0.0-20210406144921-a836bace1e34/go.mod h1:s2tVAxI5FnThDvOCzrUpNU8HxoGvFBelNLZpDEEsFuk= github.com/gballet/go-verkle v0.0.0-20210408135335-4da43934fa91 h1:HRH078PDVLdcEbuMWGQJPSk05X7vvvq5cfByCLyNfTc= github.com/gballet/go-verkle v0.0.0-20210408135335-4da43934fa91/go.mod h1:s2tVAxI5FnThDvOCzrUpNU8HxoGvFBelNLZpDEEsFuk= github.com/gballet/go-verkle v0.0.0-20210411065716-3988b5d2319d h1:WuX2hsvZA2TX4gsvuH6X6g0F7tdZT3KvF/UVy8ve+K8= github.com/gballet/go-verkle v0.0.0-20210411065716-3988b5d2319d/go.mod h1:s2tVAxI5FnThDvOCzrUpNU8HxoGvFBelNLZpDEEsFuk= github.com/gballet/go-verkle v0.0.0-20210414141224-8c72cb0024c3 h1:wHIig2YTvsF+0PHpCv3UJgwSxhYXNZ7tzM/XE3rY3Ak= github.com/gballet/go-verkle v0.0.0-20210414141224-8c72cb0024c3/go.mod h1:s2tVAxI5FnThDvOCzrUpNU8HxoGvFBelNLZpDEEsFuk= +github.com/gballet/go-verkle v0.0.0-20210416165008-8ad6897abf21 h1:am7NzaYBZpS1l+h6dS22F2A/c686S/2aBtIV+c+i+Ic= +github.com/gballet/go-verkle v0.0.0-20210416165008-8ad6897abf21/go.mod h1:s2tVAxI5FnThDvOCzrUpNU8HxoGvFBelNLZpDEEsFuk= +github.com/gballet/go-verkle v0.0.0-20210420105604-589b0c59e8db h1:TcYV0BlX2DP8IpQ6D7q+7nJIpNrtCAreH+xVy66Y1Eg= +github.com/gballet/go-verkle v0.0.0-20210420105604-589b0c59e8db/go.mod h1:s2tVAxI5FnThDvOCzrUpNU8HxoGvFBelNLZpDEEsFuk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/glycerine/go-unsnap-stream v0.0.0-20180323001048-9f0cb55181dd/go.mod h1:/20jfyN9Y5QPEAprSgKAUr+glWDY39ZiUEAYOEv5dsE= github.com/glycerine/goconvey v0.0.0-20190410193231-58a59202ab31/go.mod h1:Ogl1Tioa0aV7gstGFO7KhffUsb9M4ydbEbbxpcEDc24= @@ -512,6 +518,8 @@ golang.org/x/crypto v0.0.0-20210317152858-513c2a44f670 h1:gzMM0EjIYiRmJI3+jBdFuo golang.org/x/crypto v0.0.0-20210317152858-513c2a44f670/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2 h1:It14KIkyBFYkHkwZ7k45minvA9aorojkyjGk9KJ5B/w= golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= +golang.org/x/crypto v0.0.0-20210415154028-4f45737414dc h1:+q90ECDSAQirdykUN6sPEiBXBsp8Csjcca8Oy7bgLTA= +golang.org/x/crypto v0.0.0-20210415154028-4f45737414dc/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= @@ -622,6 +630,10 @@ golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57 h1:F5Gozwx4I1xtr/sr/8CFbb57i golang.org/x/sys v0.0.0-20210403161142-5e06dd20ab57/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210414055047-fe65e336abe0 h1:g9s1Ppvvun/fI+BptTMj909BBIcGrzQ32k9FNlcevOE= golang.org/x/sys v0.0.0-20210414055047-fe65e336abe0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210419170143-37df388d1f33 h1:zah5VTTvBlVRELjcDwGLLaWRHZJQsBtplweVYCii0KM= +golang.org/x/sys v0.0.0-20210419170143-37df388d1f33/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210420072515-93ed5bcd2bfe h1:WdX7u8s3yOigWAhHEaDl8r9G+4XwFQEQFtBMYyN+kXQ= +golang.org/x/sys v0.0.0-20210420072515-93ed5bcd2bfe/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=