feat(lib/trie): add descendants count to branches#2310
feat(lib/trie): add descendants count to branches#2310qdm12 merged 12 commits intoqdm12-trie-copy-lessfrom
Conversation
73b4713 to
5274093
Compare
d2235bb to
a81447c
Compare
a81447c to
6c54e44
Compare
Codecov Report
@@ Coverage Diff @@
## qdm12-trie-copy-less #2310 +/- ##
========================================================
+ Coverage 57.97% 58.13% +0.16%
========================================================
Files 213 214 +1
Lines 27984 28014 +30
========================================================
+ Hits 16223 16286 +63
+ Misses 10120 10088 -32
+ Partials 1641 1640 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
5274093 to
6746d15
Compare
970f8e0 to
98ae872
Compare
381e419 to
dbcff38
Compare
98ae872 to
df1f006
Compare
9e81d43 to
689751f
Compare
noot
left a comment
There was a problem hiding this comment.
seems ok but I think I'm missing the reason why nodesCreated/nodesDeleted needs to be returned from a lot of the funcs? seems to be 0/1 only in some cases?
Agreed, I'm doing a refactoring to deduce those numbers from the branch statistics (especially since there might be more fields in the future). However, although it's working it really does run some weird/sketchy code which should be removed by #2352 can you please review this 😺 Thanks!! |
f33420d to
c3dc9ab
Compare
|
Do not merge, this is not valid (found with a fuzz test), I'm working on fixing it. |
39ab29e to
24bb458
Compare
|
@noot I reverted back to return recursively nodesRemoved/nodesCreated. The trie code modifies the passed branches in-place, so to deduce descendants without returning values, it is required to either have:
|
* Note: descendants are stored in every node since we have a delete operation that cuts of an entire branch, so it's more performant to have it get the count of descendants to remove from the branch being removed, rather than iterating over this branch and all its children. * Adapt existing tests * Add test cases to reach back full test coverage
I am Quentin Mc Gaw, a software engineer working the Go Polkadot host **Gossamer**. I have been working full time on Gossamer since October 2021, mostly on the state trie and storage. I have also made a [few minor pull requests](https://github.com/w3f/polkadot-spec/pulls?q=is%3Apr+is%3Aclosed+author%3Aqdm12) to the Polkadot specification repository. I am requesting to join the Fellowship at rank 1. ## Main contributions ### Gossamer - Fix memory leaks - Trie encoding buffer pools usage fixed [#2009](ChainSafe/gossamer#2009) - Fix state map of tries memory leak [#2286](ChainSafe/gossamer#2286) - Fix sync benchmark [#2234](ChainSafe/gossamer#2234) - Trie proof fixes ([#2604](ChainSafe/gossamer#2604), [#2661](ChainSafe/gossamer#2661)) - Fix end to end tests orchestration ([#2470](ChainSafe/gossamer#2470), [#2452](ChainSafe/gossamer#2452), [#2385](ChainSafe/gossamer#2385), [#2370](ChainSafe/gossamer#2370)) - State trie statistics ([#2378](ChainSafe/gossamer#2378), [#2310](ChainSafe/gossamer#2310), [#2272](ChainSafe/gossamer#2272)) - State trie fixes and improvements - Only deep copy nodes when mutation is certain [#2352](ChainSafe/gossamer#2352) and [#2223](ChainSafe/gossamer#2223) - Only deep copy necessary fields of a node [#2384](ChainSafe/gossamer#2384) - Use Merkle values for database keys instead of always hash [#2725](ChainSafe/gossamer#2725) - Opportunistic parallel Merkle value commputing [#2081](ChainSafe/gossamer#2081) - Grandpa capped number of tracked messages ([#2490](ChainSafe/gossamer#2490), [#2485](ChainSafe/gossamer#2485)) - Add pprof HTTP service for profiling [#1991](ChainSafe/gossamer#1991) Ongoing work: - State trie lazy loading and caching - State trie v1 support ([#2736](ChainSafe/gossamer#2736), [#2747](ChainSafe/gossamer#2747), [#2687](ChainSafe/gossamer#2687), [#2686](ChainSafe/gossamer#2686), [#2685](ChainSafe/gossamer#2685), [#2673](ChainSafe/gossamer#2673), [#2611](ChainSafe/gossamer#2611), [#2530](ChainSafe/gossamer#2530)) ### Polkadot specification ➡️ [Pull requests from qdm12](https://github.com/w3f/polkadot-spec/pulls?q=is%3Apr+is%3Aclosed+author%3Aqdm12)
Changes
💁 descendants are stored in every node since we have a delete operation that cuts of an entire branch, so it's more performant to have it get the count of descendants to remove from the branch being removed, rather than iterating over this branch and all its children.
Next PR will be to publish the count of descendants of the root node to the Prometheus server
Tests
Issues
Primary Reviewer