Skip to content
Commit 4186274d authored by Bastian Köcher's avatar Bastian Köcher Committed by GitHub
Browse files

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: default avatarArkadiy Paronyan <[email protected]>

* Indentation

* Update client/db/src/storage_cache.rs

Co-authored-by: default avatarAndré Silva <[email protected]>

Co-authored-by: default avatarArkadiy Paronyan <[email protected]>
Co-authored-by: default avatarAndré Silva <[email protected]>
parent 161ca3aa
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment