mx-chain-go
mx-chain-go copied to clipboard
Recreate trie from epoch
Description of the reasoning behind the pull request (what feature was missing / how the problem was manifesting itself / what was the motive behind the refactoring)
- Currently,
RecreateTrie()for a given epoch is not supported. Therefore, historical balances lookup is limited to the configured active persisters. - Related to: https://github.com/ElrondNetwork/elrond-go/pull/4386
Proposed Changes
- Implement
RecreateTrieFromEpoch, via a new, customtrieStorageManager:trieStorageManagerInEpoch. - Optimize the
triePruningStorer.GetFromEpoch()to not automatically close an opened persister (similar to howfullHistoryPruningStoreris implemented). - Additionally, the scheduled SCRs unit is configured to use a
fullHistoryPruningStorer- in case of full history observers etc. This unit is used in the current implementation of historical lookup.
Testing procedure
- Similar to https://github.com/ElrondNetwork/elrond-go/pull/4386. Though, all historical queries should work (no
key not founderrors etc.)
Codecov Report
Merging #4388 (c87bb30) into rc/2022-july (ec5c6e2) will increase coverage by
0.02%. The diff coverage is83.80%.
:exclamation: Current head c87bb30 differs from pull request most recent head 071afe2. Consider uploading reports for the commit 071afe2 to get more accurate results
@@ Coverage Diff @@
## rc/2022-july #4388 +/- ##
================================================
+ Coverage 73.88% 73.91% +0.02%
================================================
Files 675 676 +1
Lines 86783 86829 +46
================================================
+ Hits 64117 64177 +60
+ Misses 17872 17858 -14
Partials 4794 4794
| Impacted Files | Coverage Δ | |
|---|---|---|
| node/nodeLoadAccounts.go | 88.29% <ø> (ø) |
|
| process/txsimulator/wrappedAccountsDB.go | 70.83% <0.00%> (-3.08%) |
:arrow_down: |
| state/accountsDBApi.go | 94.69% <0.00%> (-1.71%) |
:arrow_down: |
| storage/factory/pruningStorerFactory.go | 0.00% <0.00%> (ø) |
|
| state/accountsDBApiWithHistory.go | 92.85% <71.42%> (-1.94%) |
:arrow_down: |
| trie/trieStorageManagerInEpoch.go | 80.55% <80.55%> (ø) |
|
| trie/trieStorageManagerWithoutPruning.go | 86.66% <85.71%> (ø) |
|
| trie/patriciaMerkleTrie.go | 70.95% <87.50%> (+0.33%) |
:arrow_up: |
| common/holders/rootHashHolder.go | 87.50% <100.00%> (+1.78%) |
:arrow_up: |
| state/accountsDB.go | 78.46% <100.00%> (+0.06%) |
:arrow_up: |
| ... and 9 more |
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.