mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-25 21:11:07 +00:00
Contracts: Remove ED from base deposit (#3536)
- Update internal logic so that the storage_base_deposit does not include ED - add v16 migration to update ContractInfo struct with this change Before: <img width="820" alt="Screenshot 2024-03-21 at 11 23 29" src="https://github.com/paritytech/polkadot-sdk/assets/521091/a0a8df0d-e743-42c5-9e16-cf2ec1aa949c"> After:  --------- Co-authored-by: Cyrill Leutwiler <cyrill@parity.io> Co-authored-by: command-bot <>
This commit is contained in:
@@ -32,7 +32,7 @@ use self::{
|
||||
use crate::{
|
||||
exec::Key,
|
||||
migration::{
|
||||
codegen::LATEST_MIGRATION_VERSION, v09, v10, v11, v12, v13, v14, v15, MigrationStep,
|
||||
codegen::LATEST_MIGRATION_VERSION, v09, v10, v11, v12, v13, v14, v15, v16, MigrationStep,
|
||||
},
|
||||
Pallet as Contracts, *,
|
||||
};
|
||||
@@ -331,6 +331,26 @@ mod benchmarks {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// This benchmarks the v16 migration step (Remove ED from base_deposit).
|
||||
#[benchmark(pov_mode = Measured)]
|
||||
fn v16_migration_step() -> Result<(), BenchmarkError> {
|
||||
let contract =
|
||||
<Contract<T>>::with_caller(whitelisted_caller(), WasmModule::dummy(), vec![])?;
|
||||
|
||||
let info = contract.info()?;
|
||||
let base_deposit = v16::store_old_contract_info::<T>(contract.account_id.clone(), &info);
|
||||
let mut m = v16::Migration::<T>::default();
|
||||
|
||||
#[block]
|
||||
{
|
||||
m.step(&mut WeightMeter::new());
|
||||
}
|
||||
let ed = Pallet::<T>::min_balance();
|
||||
let info = v16::ContractInfoOf::<T>::get(&contract.account_id).unwrap();
|
||||
assert_eq!(info.storage_base_deposit, base_deposit - ed);
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// This benchmarks the weight of executing Migration::migrate to execute a noop migration.
|
||||
#[benchmark(pov_mode = Measured)]
|
||||
fn migration_noop() {
|
||||
|
||||
Reference in New Issue
Block a user