Skip to content

Conversation

@holiman
Copy link
Contributor

@holiman holiman commented Apr 28, 2021

Since we changed how generation works, and how the snap sync works, we stopped using some of the functionality provided by the prover.
Notably, we no longer make use of the returned Trie, nor the Notary. This PR removes them as return arguments. It also makes use of the Stacktrie for the cases where we don't have any proofs, and the provided key/value pairs are expected to produce a correct state root.
The first commit adds a new benchmark for this case, which exhibit quite a boost by the use of Stacktrie instead of the regular one:

name                      old time/op    new time/op    delta
Prove-6                      733µs ±21%     698µs ±27%     ~     (p=0.690 n=5+5)
VerifyProof-6               14.5µs ±16%    15.7µs ±15%     ~     (p=0.421 n=5+5)
VerifyRangeProof10-6         253µs ±16%     266µs ±15%     ~     (p=0.548 n=5+5)
VerifyRangeProof100-6       1.00ms ±18%    0.90ms ±22%     ~     (p=0.310 n=5+5)
VerifyRangeProof1000-6      13.4ms ±12%    13.1ms ±11%     ~     (p=0.690 n=5+5)
VerifyRangeProof5000-6      64.4ms ±10%    59.5ms ±21%     ~     (p=0.222 n=5+5)
VerifyRangeNoProof10-6      1.80ms ±25%    0.54ms ± 9%  -69.73%  (p=0.008 n=5+5)
VerifyRangeNoProof500-6     6.93ms ±48%    2.32ms ±21%  -66.47%  (p=0.008 n=5+5)
VerifyRangeNoProof1000-6    13.9ms ± 9%     4.3ms ± 3%  -69.33%  (p=0.016 n=5+4)

name                      old alloc/op   new alloc/op   delta
Prove-6                      144kB ±13%     140kB ±10%     ~     (p=0.548 n=5+5)
VerifyProof-6               5.51kB ± 6%    5.25kB ± 6%     ~     (p=0.151 n=5+5)
VerifyRangeProof10-6        61.2kB ±14%    66.3kB ± 6%     ~     (p=0.222 n=5+5)
VerifyRangeProof100-6        315kB ± 0%     315kB ± 0%     ~     (p=0.548 n=5+5)
VerifyRangeProof1000-6      3.76MB ± 1%    3.79MB ± 1%     ~     (p=0.421 n=5+5)
VerifyRangeProof5000-6      19.1MB ± 0%    19.1MB ± 0%     ~     (p=0.841 n=5+5)
VerifyRangeNoProof10-6       468kB ± 6%     103kB ± 3%  -77.93%  (p=0.008 n=5+5)
VerifyRangeNoProof500-6     1.88MB ± 1%    0.40MB ± 1%  -78.87%  (p=0.008 n=5+5)
VerifyRangeNoProof1000-6    3.56MB ± 1%    0.75MB ± 1%  -78.81%  (p=0.008 n=5+5)

name                      old allocs/op  new allocs/op  delta
Prove-6                      1.98k ±15%     1.90k ±10%     ~     (p=0.548 n=5+5)
VerifyProof-6                  106 ± 7%       102 ± 4%     ~     (p=0.111 n=5+5)
VerifyRangeProof10-6           639 ± 9%       667 ± 3%     ~     (p=0.310 n=5+5)
VerifyRangeProof100-6        2.50k ± 0%     2.49k ± 0%     ~     (p=0.516 n=5+5)
VerifyRangeProof1000-6       30.9k ± 1%     31.0k ± 1%     ~     (p=0.421 n=5+5)
VerifyRangeProof5000-6        158k ± 0%      158k ± 1%     ~     (p=0.421 n=5+5)
VerifyRangeNoProof10-6       4.45k ± 2%     1.51k ± 2%  -66.16%  (p=0.008 n=5+5)
VerifyRangeNoProof500-6      16.6k ± 1%      5.1k ± 1%  -69.08%  (p=0.008 n=5+5)
VerifyRangeNoProof1000-6     31.4k ± 1%      9.5k ± 1%  -69.63%  (p=0.008 n=5+5)

@holiman
Copy link
Contributor Author

holiman commented Apr 28, 2021

which exhibit quite a boost by the use of Stacktrie instead of the regular one.

Just to clarify: this improvement will be noticeable mainly when we're doing snap sync, and receive a small-to-medium size storage trie.

@karalabe karalabe added this to the 1.10.3 milestone Apr 28, 2021
Copy link
Member

@karalabe karalabe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@karalabe karalabe merged commit a81cf0d into ethereum:master Apr 28, 2021
atif-konasl pushed a commit to frozeman/pandora-execution-engine that referenced this pull request Oct 15, 2021
…reum#22760)

* trie: add benchmark for proofless range

* trie: remove unused returns + use stacktrie
gzliudan pushed a commit to gzliudan/XDPoSChain that referenced this pull request Jun 9, 2025
…eum#22760

* trie: add benchmark for proofless range

* trie: remove unused returns + use stacktrie
gzliudan pushed a commit to gzliudan/XDPoSChain that referenced this pull request Jul 26, 2025
…eum#22760

* trie: add benchmark for proofless range

* trie: remove unused returns + use stacktrie
gzliudan added a commit to XinFinOrg/XDPoSChain that referenced this pull request Jul 28, 2025
…eum#22760 (#1066)

* trie: add benchmark for proofless range

* trie: remove unused returns + use stacktrie

Co-authored-by: Martin Holst Swende <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants