Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.

Pruning changes tries#856

Merged
gavofyork merged 4 commits intomasterfrom
prune_changes_trie
Oct 17, 2018
Merged

Pruning changes tries#856
gavofyork merged 4 commits intomasterfrom
prune_changes_trie

Conversation

@svyatonik
Copy link
Copy Markdown
Contributor

Overview:

  1. if digests are built, then we need to have at least max_digest_interval changes tries for last max_digest_interval blocks => they're never pruned
  2. virtually, pruning is determined by number of blocks we want have a changes tries for (internally it is still measured in number of max_digest_interval ranges)
  3. we only prune changes tries when we're building digest of highest level AND we only could prune changes tries for the whole max_digest_interval range blocks (so probably we need to limit the max_digest_interval to avoid large db transactions - left a TODO on this)
  4. we only prune changes tries when final block is inserted/block is finalized
  5. we never prune changes tries for 'abandoned' forks (there's no way to do this + it would require some refcounting for trie nodes because of their encoding)

@svyatonik svyatonik added the A0-please_review Pull request needs code review. label Oct 1, 2018
@gavofyork gavofyork merged commit 289c2c0 into master Oct 17, 2018
@gavofyork gavofyork deleted the prune_changes_trie branch October 17, 2018 08:08
// => use iter to enumerate all keys AND lookup each
// key using get_with
trie.get_with(&key, &mut *self.proof_recorder)
.map(|x| x.map(|val| val.to_vec()))?;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why do we need this map? It looks like the resulting vec is immediately dropped?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yep, thanks. Could you please remove it in your PR? :)

sorpaas added a commit that referenced this pull request Oct 18, 2018
gavofyork pushed a commit that referenced this pull request Oct 18, 2018
* Implement a non generic version of child delta trie

* Use delta_trie_root in state_machine

* Expand InMemory backend to support multi-storage

* Create Consolidate trait

* Fix all crate compile and remove unused OverlayedChanges::drain

* Implement child storage root support and overlay changes

* Add child storage reader

* Add child storage writer

* Implement child storage cleaning

* Fix light backend compile

* Add all required ext functions for wasm executor

* Add ext def to io

* Add all io functions

* Fix nostd compile

* Add simple test

* Remove unnecessary vec copy in child_storage_root_transaction

* Use values_mut/for_each to make it shorter

* Use extend to shorter a for loop

* Move record_all_keys to trie so it's easier to generic them later

* space -> tab

* Remove to_owned in debug format

* Clean out all to_owned

* Break debug_trace to multiple lines

* Remove 0..

* UserError copy/paste typo

* Replace Vec::from_raw_parts by slice::from_raw_parts

* Use iter::empty()

* Wrap some long lines

* Wrap a missing line

* Remove unnecessary map

#856 (comment)

* Call ext_free after from_raw_parts

* Fix tests in other crates
liuchengxu pushed a commit to chainx-org/substrate that referenced this pull request Aug 23, 2021
helin6 pushed a commit to boolnetwork/substrate that referenced this pull request Jul 25, 2023
Bumps [futures](https://github.com/rust-lang/futures-rs) from 0.3.26 to 0.3.27.
- [Release notes](https://github.com/rust-lang/futures-rs/releases)
- [Changelog](https://github.com/rust-lang/futures-rs/blob/master/CHANGELOG.md)
- [Commits](rust-lang/futures-rs@0.3.26...0.3.27)

---
updated-dependencies:
- dependency-name: futures
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: James Wilson <james@jsdw.me>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

A0-please_review Pull request needs code review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants