-
Notifications
You must be signed in to change notification settings - Fork 924
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(eds/store): cache proofs after first eds recompute on sampling #2429
feat(eds/store): cache proofs after first eds recompute on sampling #2429
Conversation
Tests are broken because of rsmt2d bug. There is an open PR to fix the bug: celestiaorg/rsmt2d#236 |
Does this solution works with bridge? |
Needs support for bridges by passing nmt options through app's block extension code |
Added support for bridges and also made it to not pass proofs inside context when it is possible to. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
beautiful
Codecov Report
@@ Coverage Diff @@
## release-11-rc9 #2429 +/- ##
==================================================
+ Coverage 51.75% 51.94% +0.18%
==================================================
Files 156 156
Lines 10010 10039 +29
==================================================
+ Hits 5181 5215 +34
+ Misses 4367 4366 -1
+ Partials 462 458 -4
|
e16f534
to
df1a729
Compare
df1a729
to
0dc1c2a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only worry I have is how the surface area of "square construction" has increased once again inside of core package which we tried to decrease with previous changes like using app.ExtendBlock
.
Hopefully we can consolidate it again in the future.
…elestiaorg#2429) ## Overview Before this change eds was recomputed twice on sampling: 1. inside sampling client to verify data integrity 2. On storing EDS to storage to calculate merkle tree proof nodes. This PR adds `proofsAdder` cache, that will store proof nodes for later use with key features: - cache could be optionally added to context and will be respected by ipld/shrex getter to populate on eds recompute. - cache is safe from second recompute, since it will only allow single recompute write and all consequent recomputes over same cache will be noop. Also this PR reworks writeEDS to use use `proofsAdder` instead of creating new blockstore and iterating over all keys in it. This approach speeds up writeEDS even without pre collected cache. Since there are no more need for blockstore being created, I have simplified writeEDS and removed a lot of redundant code including whole struct of `writeSession`. The PR also adds benchmark that uses disk for badger store (existing benchmark uses in-memory datastore instead of badger). This PR brings significant performance increase. On disk store badger results are: - before PR store.Put operation: **~1.5s** - after PR store.Put with cached proofs: **800ms** - after PR store.Put without cached proofs: **900ms**
Overview
Before this change eds was recomputed twice on sampling:
This PR adds
proofsAdder
cache, that will store proof nodes for later use with key features:Also this PR reworks writeEDS to use use
proofsAdder
instead of creating new blockstore and iterating over all keys in it. This approach speeds up writeEDS even without pre collected cache.Since there are no more need for blockstore being created, I have simplified writeEDS and removed a lot of redundant code including whole struct of
writeSession
.The PR also adds benchmark that uses disk for badger store (existing benchmark uses in-memory datastore instead of badger).
This PR brings significant performance increase. On disk store badger results are: