Migration of block state values#1628
Migration of block state values#1628allanbrondum wants to merge 12 commits intofeature/rust_block_state_p11_migrationfrom
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## feature/rust_block_state_p11_migration #1628 +/- ##
==========================================================================
+ Coverage 63.90% 63.99% +0.09%
==========================================================================
Files 356 357 +1
Lines 71251 71470 +219
Branches 3032 3035 +3
==========================================================================
+ Hits 45534 45739 +205
- Misses 22685 22696 +11
- Partials 3032 3035 +3
|
d1787bd to
0aff697
Compare
…nto ar/psr-91-implement-migration-of-rust-block-state-and-block-state
| /// | ||
| /// Since each protocol version has its own blob store, migration is always needed at | ||
| /// protocol update, even if the block state value has no data model changes. | ||
| pub trait Migrate { |
There was a problem hiding this comment.
I am not sure that it's a good idea to have a universal Migrate trait like this. At the moment, for the Rust code it's mostly just copying things for P10->P11 migration, so it works. But in general, migrations can alter data, possibly using context provided as part of the protocol update, or even doing more complex things, including changing types. I would rather that types have their own migration functions that are not abstracted by a trait, and can, for instance, be specific to the version migration taking place. For instance migrate_trivial for where the data and representation is unchanged, or migrate_p10_to_p11 that involves changes that are specific to that protocol update.
There was a problem hiding this comment.
Right now I think having the trait is easier, because it is used as trait bound in migration code for HashedCacheableRef and LfmbTree (which would otherwise take a closure). We can remove the trait again if it because a problem (or modify the trait). Until we have the block state model in place, I would rather leave the path open and see what works.
Purpose
Protocol migration of the Rust block state.
Changes
block_state::migration::Migratethat defines and describes how to migrate a block state valueWe may need to add protocol version or migration target type (
type Migrate::ToType) at some point, but keeping it as simple as possible for now.Checklist
hard-to-understand areas.