Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Post merge fix
  • Loading branch information
pgherveou committed Apr 10, 2024
commit 0014dff6e2f7a61e7076d79f295a8f5ca16e624b
2 changes: 1 addition & 1 deletion substrate/frame/contracts/src/benchmarking/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ mod benchmarks {

#[block]
{
m.step();
m.step(&mut WeightMeter::new());
}
let ed = Pallet::<T>::min_balance();
let info = v16::ContractInfoOf::<T>::get(&contract.account_id).unwrap();
Expand Down
10 changes: 6 additions & 4 deletions substrate/frame/contracts/src/migration/v16.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
use crate::{
migration::{IsFinished, MigrationStep},
weights::WeightInfo,
BalanceOf, CodeHash, Config, Pallet, TrieId, Weight, LOG_TARGET,
BalanceOf, CodeHash, Config, Pallet, TrieId, Weight, WeightMeter, LOG_TARGET,
};
use codec::{Decode, Encode};
use frame_support::{pallet_prelude::*, storage_alias, DefaultNoBound};
Expand Down Expand Up @@ -80,7 +80,7 @@ impl<T: Config> MigrationStep for Migration<T> {
T::WeightInfo::v16_migration_step()
}

fn step(&mut self) -> (IsFinished, Weight) {
fn step(&mut self, meter: &mut WeightMeter) -> IsFinished {
let mut iter = if let Some(last_account) = self.last_account.take() {
ContractInfoOf::<T>::iter_keys_from(ContractInfoOf::<T>::hashed_key_for(last_account))
} else {
Expand All @@ -96,10 +96,12 @@ impl<T: Config> MigrationStep for Migration<T> {
*info = Some(updated_info);
});
self.last_account = Some(key);
(IsFinished::No, T::WeightInfo::v16_migration_step())
meter.consume(T::WeightInfo::v16_migration_step());
IsFinished::No
} else {
log::debug!(target: LOG_TARGET, "No more contracts to migrate");
(IsFinished::Yes, T::WeightInfo::v16_migration_step())
meter.consume(T::WeightInfo::v16_migration_step());
IsFinished::Yes
}
}
}