This repository was archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
TryDecodeEntireState check for storage types and pallets
#13013
Open
kianenigma
wants to merge
15
commits into
master
Choose a base branch
from
kiz-decode-all
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
80cc9da
demonstration
kianenigma 2456895
remove empty
kianenigma d5d84be
merged
kianenigma db4b234
make it all work again
kianenigma 4cd6761
all tests work
kianenigma cdd3f77
Master.into()
kianenigma d4d880b
doc
kianenigma b5033e1
Master.into()
kianenigma 15c5dc5
update
kianenigma 734453a
fix
kianenigma 375b71b
fux
kianenigma 07aac4a
fix
kianenigma 01a465f
Merge remote-tracking branch 'origin/master' into kiz-decode-all
ed7b618
try and fix ui build
kianenigma d2342c0
Merge branch 'kiz-decode-all' of github.com:paritytech/substrate into…
kianenigma File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -385,6 +385,39 @@ pub fn move_prefix(from_prefix: &[u8], to_prefix: &[u8]) { | |
| } | ||
| } | ||
|
|
||
| /// A phony migration that does nothing, except executing `TryDecodeEntireStorage` on | ||
| /// `post_upgrade`, which implies it is only available if `try-state` feature is used. | ||
| /// | ||
| /// This can be used typically in the top level runtime, where `AllPallets` typically comes from | ||
| /// `construct_runtime!`. | ||
| pub struct EnsureStateDecodes<AllPallets>(sp_std::marker::PhantomData<AllPallets>); | ||
|
|
||
| #[cfg(not(feature = "try-runtime"))] | ||
| impl<AllPallets> crate::traits::OnRuntimeUpgrade for EnsureStateDecodes<AllPallets> { | ||
| fn on_runtime_upgrade() -> crate::weights::Weight { | ||
| Default::default() | ||
ggwpez marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
| } | ||
|
|
||
| #[cfg(feature = "try-runtime")] | ||
| impl<AllPallets: crate::traits::TryDecodeEntireStorage> crate::traits::OnRuntimeUpgrade | ||
| for EnsureStateDecodes<AllPallets> | ||
| { | ||
| fn on_runtime_upgrade() -> sp_weights::Weight { | ||
| Default::default() | ||
| } | ||
|
|
||
| fn post_upgrade(_: Vec<u8>) -> Result<(), sp_runtime::TryRuntimeError> { | ||
| let decoded = AllPallets::try_decode_entire_state()?; | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. interestingly, this breaks every time we want to do a lazy migration, since a lazy migration is by definition an undecode-able state. example of this is f8a1dd4 In the future, we should add a |
||
| crate::log::info!( | ||
| target: crate::LOG_TARGET, | ||
| "decoded the entire state, total size = {} bytes", | ||
| decoded | ||
| ); | ||
| Ok(()) | ||
| } | ||
| } | ||
|
|
||
| #[cfg(test)] | ||
| mod tests { | ||
| use super::{ | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.