mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-20 12:51:02 +00:00
Update contract multi-block migration (#14313)
* move migrate sequence to config * remove commented out code * Update frame/contracts/src/lib.rs Co-authored-by: PG Herveou <pgherveou@gmail.com> * remove Migrations generic * make runtime use noop migrations * restrict is_upgrade_supported * Update contract multi-block migration Ensure that we do as many steps as possible given the weight limit passed to on_idle * undo is_upgrade_supported change * Update bin/node/runtime/src/lib.rs Co-authored-by: PG Herveou <pgherveou@gmail.com> * wip * fix comment (#14316) * fix test * fix * Update frame/contracts/src/migration.rs Co-authored-by: Juan <juangirini@gmail.com> * fix test doc * Apply suggestions from code review Co-authored-by: Sasha Gryaznov <hi@agryaznov.com> * Fix compilation with feature runtime-benchmarks * fix example * fix cargo doc --document-private-items * private links * Remove dup comment * add doc for MigrationInProgress * PR review remove duplicate asserts * simplify upper bound * fix link * typo * typo * no unwrap() * correct log message * missing * fix typo * PR comment * Add example with single element tuple * Improve migration message * Update frame/contracts/src/benchmarking/mod.rs Co-authored-by: Sasha Gryaznov <hi@agryaznov.com> * Update frame/contracts/src/migration.rs Co-authored-by: Sasha Gryaznov <hi@agryaznov.com> * Update frame/contracts/src/migration.rs Co-authored-by: Sasha Gryaznov <hi@agryaznov.com> * use saturating_accrue instead of += * add more doc * Contracts: Better migration types (#14418) * Add explicit error, if try-runtime runs a noop migration * use mut remaining_weight --------- Co-authored-by: Juan Girini <juangirini@gmail.com> Co-authored-by: Sasha Gryaznov <hi@agryaznov.com>
This commit is contained in:
@@ -30,7 +30,7 @@ use self::{
|
||||
};
|
||||
use crate::{
|
||||
exec::{AccountIdOf, Key},
|
||||
migration::{v10, v11, v9, Migrate},
|
||||
migration::{v10, v11, v9, MigrationStep},
|
||||
wasm::CallFlags,
|
||||
Pallet as Contracts, *,
|
||||
};
|
||||
@@ -237,7 +237,7 @@ benchmarks! {
|
||||
// This benchmarks the v9 migration step. (update codeStorage)
|
||||
#[pov_mode = Measured]
|
||||
v9_migration_step {
|
||||
let c in 0 .. Perbill::from_percent(49).mul_ceil(T::MaxCodeLen::get());
|
||||
let c in 0 .. T::MaxCodeLen::get();
|
||||
v9::store_old_dummy_code::<T>(c as usize);
|
||||
let mut m = v9::Migration::<T>::default();
|
||||
}: {
|
||||
@@ -251,7 +251,7 @@ benchmarks! {
|
||||
whitelisted_caller(), WasmModule::dummy(), vec![],
|
||||
)?;
|
||||
|
||||
v10::store_old_contrat_info::<T>(contract.account_id.clone(), contract.info()?);
|
||||
v10::store_old_contract_info::<T>(contract.account_id.clone(), contract.info()?);
|
||||
let mut m = v10::Migration::<T>::default();
|
||||
}: {
|
||||
m.step();
|
||||
@@ -277,15 +277,15 @@ benchmarks! {
|
||||
assert_eq!(StorageVersion::get::<Pallet<T>>(), 2);
|
||||
}
|
||||
|
||||
// This benchmarks the weight of executing Migration::migrate when there are no migration in progress.
|
||||
// This benchmarks the weight of dispatching migrate to execute 1 `NoopMigraton`
|
||||
#[pov_mode = Measured]
|
||||
migrate {
|
||||
StorageVersion::new(0).put::<Pallet<T>>();
|
||||
<Migration::<T, false> as frame_support::traits::OnRuntimeUpgrade>::on_runtime_upgrade();
|
||||
let origin: RawOrigin<<T as frame_system::Config>::AccountId> = RawOrigin::Signed(whitelisted_caller());
|
||||
}: {
|
||||
<Contracts<T>>::migrate(origin.into(), Weight::MAX).unwrap()
|
||||
} verify {
|
||||
let caller: T::AccountId = whitelisted_caller();
|
||||
let origin = RawOrigin::Signed(caller.clone());
|
||||
}: _(origin, Weight::MAX)
|
||||
verify {
|
||||
assert_eq!(StorageVersion::get::<Pallet<T>>(), 1);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user