-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Make triecache generic and work for no-std environments #14403
Make triecache generic and work for no-std environments #14403
Conversation
Co-authored-by: Bastian Köcher <git@kchr.de>
bot fmt |
@skunert https://gitlab.parity.io/parity/mirrors/substrate/-/jobs/3028934 was started for your command Comment |
@skunert Command |
} | ||
|
||
/// Create new trie-based backend. | ||
pub fn new_with_cache(storage: S, root: H::Out, cache: Option<C>) -> Self { |
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.
You could simplify TrieBackendEssence::new
by calling this method in there. (Self::new_with_cache(storage, root, None)
instead of having the whole struct initialized in two places)
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.
Also third copy below could be initialized with new.
Co-authored-by: Koute <koute@users.noreply.github.com>
Co-authored-by: Michal Kucharczyk <1728078+michalkucharczyk@users.noreply.github.com>
bot merge |
…4403) * Remove `AsLocalTrieCache` trait * Introduce new trait AsTrieDbCache * Use AsTrieDbCache trait * Make it compile * Docs * Improve naming of associated type, implement cache usage for no-std * Improve naming * Improve docs * Allow construction with optional cache * FMT * Remove unused variable * Revert unwanted change * Apply suggestions from code review Co-authored-by: Bastian Köcher <git@kchr.de> * More comment adjustments * Docs * Trigger CI * ".git/.scripts/commands/fmt/fmt.sh" * Apply suggestions from code review Co-authored-by: Koute <koute@users.noreply.github.com> * Review comments * Review comments * Apply suggestions from code review Co-authored-by: Michal Kucharczyk <1728078+michalkucharczyk@users.noreply.github.com> * fmt * Bump trie-db again --------- Co-authored-by: Bastian Köcher <git@kchr.de> Co-authored-by: command-bot <> Co-authored-by: Koute <koute@users.noreply.github.com> Co-authored-by: Michal Kucharczyk <1728078+michalkucharczyk@users.noreply.github.com>
This pull request refactors the trie-cache related traits and makes the system generic. Until now the caching system was bound to the
LocalTrieCache
implementation. This is one step towards enabling theTrieCache
invalidate_block
paritytech/cumulus#2432.This refactoring contains no behavioural changes for existing code.
Change summary:
MergeableTrieCacheProvider
: This trait can be implemented to provide cache implementations to theTrieBackend
AsLocalTrieCache
trait: No longer required since functionality is covered byMergeableTrieCacheProvider
Polkadot companion: paritytech/polkadot#7435