Skip to content

Commit

Permalink
Contracts: remove kitchensink dynamic parameters (#4489)
Browse files Browse the repository at this point in the history
Using Dynamic Parameters for contracts seems like a bad idea for now.

Given that we have benchmarks for each host function (in addition to our
extrinsics), parameter storage reads will be counted multiple times. We
will work on updates to the benchmarking framework to mitigate this
issue in future iterations.

---------

Co-authored-by: command-bot <>
  • Loading branch information
pgherveou authored May 17, 2024
1 parent d5fe478 commit f86f213
Show file tree
Hide file tree
Showing 2 changed files with 710 additions and 788 deletions.
26 changes: 6 additions & 20 deletions substrate/bin/node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1341,6 +1341,9 @@ impl pallet_tips::Config for Runtime {
}

parameter_types! {
pub const DepositPerItem: Balance = deposit(1, 0);
pub const DepositPerByte: Balance = deposit(0, 1);
pub const DefaultDepositLimit: Balance = deposit(1024, 1024 * 1024);
pub Schedule: pallet_contracts::Schedule<Runtime> = Default::default();
pub CodeHashLockupDepositPercent: Perbill = Perbill::from_percent(30);
}
Expand All @@ -1358,9 +1361,9 @@ impl pallet_contracts::Config for Runtime {
/// change because that would break already deployed contracts. The `Call` structure itself
/// is not allowed to change the indices of existing pallets, too.
type CallFilter = Nothing;
type DepositPerItem = dynamic_params::contracts::DepositPerItem;
type DepositPerByte = dynamic_params::contracts::DepositPerByte;
type DefaultDepositLimit = dynamic_params::contracts::DefaultDepositLimit;
type DepositPerItem = DepositPerItem;
type DepositPerByte = DepositPerByte;
type DefaultDepositLimit = DefaultDepositLimit;
type CallStack = [pallet_contracts::Frame<Self>; 5];
type WeightPrice = pallet_transaction_payment::Pallet<Self>;
type WeightInfo = pallet_contracts::weights::SubstrateWeight<Self>;
Expand Down Expand Up @@ -2182,19 +2185,6 @@ pub mod dynamic_params {
#[codec(index = 1)]
pub static ByteDeposit: Balance = 1 * CENTS;
}

#[dynamic_pallet_params]
#[codec(index = 1)]
pub mod contracts {
#[codec(index = 0)]
pub static DepositPerItem: Balance = deposit(1, 0);

#[codec(index = 1)]
pub static DepositPerByte: Balance = deposit(0, 1);

#[codec(index = 2)]
pub static DefaultDepositLimit: Balance = deposit(1024, 1024 * 1024);
}
}

#[cfg(feature = "runtime-benchmarks")]
Expand All @@ -2220,10 +2210,6 @@ impl EnsureOriginWithArg<RuntimeOrigin, RuntimeParametersKey> for DynamicParamet
frame_system::ensure_root(origin.clone()).map_err(|_| origin)?;
return Ok(())
},
RuntimeParametersKey::Contracts(_) => {
frame_system::ensure_root(origin.clone()).map_err(|_| origin)?;
return Ok(())
},
}
}

Expand Down
Loading

0 comments on commit f86f213

Please sign in to comment.