Fixes `storage_hash` caching issue and enables better caching for Cumulus (#8518)
* Fixes `storage_hash` caching issue and enables better caching for Cumulus There was a caching issue with `storage_hash` that resulted in not reverting cached storage hashes when required. In Cumulus this resulted in nodes failing to import new blocks after a runtime upgrade, because they were using the old runtime version. Besides that, this pr optimizes for the Cumulus use case. In particular that we always import blocks first as non-best blocks and enact them later. In current version of the caching that would mean we would always throw away the complete cache of the latest imported block. Now, we always update the cache for the first block of a new block height. This enables us to use the cache if this block will enacted as best block later. If there is a fork and that is enacted as best, we revert all the changes to the cache. * Apply suggestions from code review Co-authored-by: Arkadiy Paronyan <[email protected]> * Indentation * Update client/db/src/storage_cache.rs Co-authored-by: André Silva <[email protected]> Co-authored-by: Arkadiy Paronyan <[email protected]> Co-authored-by: André Silva <[email protected]>
parent
161ca3aa
Please register or sign in to comment