mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 07:37:57 +00:00
support upgrade hooks to directly pass data (#12185)
* update interfaces of OnRuntimeUpgrade & Hooks Signed-off-by: linning <linningde25@gmail.com> * remove try-runtime for PreStateDigest Signed-off-by: linning <linningde25@gmail.com> * remove the Default bound of PreStateDigest Signed-off-by: linning <linningde25@gmail.com> * remove try-runtime for PreStateDigest & pre_upgrade Signed-off-by: linning <linningde25@gmail.com> * remove tmp storage between upgrade hooks Signed-off-by: linning <linningde25@gmail.com> * ensure hooks are storage noop Signed-off-by: linning <linningde25@gmail.com> * remove OnRuntimeUpgradeHelpersExt Signed-off-by: linning <linningde25@gmail.com> * cargo check & fmt Signed-off-by: linning <linningde25@gmail.com> * rename PreStateDigest to PreUpgradeState Signed-off-by: linning <linningde25@gmail.com> * replace associate type with codec & vec Signed-off-by: linning <linningde25@gmail.com> * add helper strcut to help encode/decode tuple Signed-off-by: linning <linningde25@gmail.com> * update comment Signed-off-by: linning <linningde25@gmail.com> * fix Signed-off-by: linning <linningde25@gmail.com> * add test Signed-off-by: linning <linningde25@gmail.com> * address comment Signed-off-by: linning <linningde25@gmail.com> * fix doc Signed-off-by: linning <linningde25@gmail.com> * fix ci Signed-off-by: linning <linningde25@gmail.com> * address comment Signed-off-by: linning <linningde25@gmail.com> * add more test cases Signed-off-by: linning <linningde25@gmail.com> * make clippy happy Signed-off-by: linning <linningde25@gmail.com> * fmt Signed-off-by: linning <linningde25@gmail.com> * update comment Signed-off-by: linning <linningde25@gmail.com> * fmt Signed-off-by: linning <linningde25@gmail.com> Signed-off-by: linning <linningde25@gmail.com>
This commit is contained in:
@@ -132,20 +132,20 @@
|
||||
//! added, given the right flag:
|
||||
//!
|
||||
//! ```ignore
|
||||
//!
|
||||
//! #[cfg(feature = try-runtime)]
|
||||
//! fn pre_upgrade() -> Result<(), &'static str> {}
|
||||
//! fn pre_upgrade() -> Result<Vec<u8>, &'static str> {}
|
||||
//!
|
||||
//! #[cfg(feature = try-runtime)]
|
||||
//! fn post_upgrade() -> Result<(), &'static str> {}
|
||||
//! fn post_upgrade(state: Vec<u8>) -> Result<(), &'static str> {}
|
||||
//! ```
|
||||
//!
|
||||
//! (The pallet macro syntax will support this simply as a part of `#[pallet::hooks]`).
|
||||
//!
|
||||
//! These hooks allow you to execute some code, only within the `on-runtime-upgrade` command, before
|
||||
//! and after the migration. If any data needs to be temporarily stored between the pre/post
|
||||
//! migration hooks, `OnRuntimeUpgradeHelpersExt` can help with that. Note that you should be
|
||||
//! mindful with any mutable storage ops in the pre/post migration checks, as you almost certainly
|
||||
//! will not want to mutate any of the storage that is to be migrated.
|
||||
//! and after the migration. Moreover, `pre_upgrade` can return a `Vec<u8>` that contains arbitrary
|
||||
//! encoded data (usually some pre-upgrade state) which will be passed to `post_upgrade` after
|
||||
//! upgrading and used for post checking.
|
||||
//!
|
||||
//! #### Logging
|
||||
//!
|
||||
|
||||
Reference in New Issue
Block a user