Skip to content

Commit 9e2e592

Browse files
committed
chore: default contracts config
1 parent 373225e commit 9e2e592

2 files changed

Lines changed: 6 additions & 28 deletions

File tree

runtime/devnet/src/config/contracts.rs

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,6 @@ use crate::{
1212
Timestamp,
1313
};
1414

15-
fn schedule<T: pallet_contracts::Config>() -> pallet_contracts::Schedule<T> {
16-
pallet_contracts::Schedule {
17-
limits: pallet_contracts::Limits {
18-
runtime_memory: 1024 * 1024 * 1024,
19-
validator_runtime_memory: 2 * 1024 * 1024 * 1024,
20-
..Default::default()
21-
},
22-
..Default::default()
23-
}
24-
}
25-
2615
// randomness-collective-flip is insecure. Provide dummy randomness as placeholder for the
2716
// deprecated trait. https://github.com/paritytech/polkadot-sdk/blob/9bf1a5e23884921498b381728bfddaae93f83744/substrate/frame/contracts/mock-network/src/parachain/contracts_config.rs#L45
2817
pub struct DummyRandomness<T: pallet_contracts::Config>(PhantomData<T>);
@@ -36,7 +25,7 @@ impl<T: pallet_contracts::Config> Randomness<T::Hash, BlockNumberFor<T>> for Dum
3625
parameter_types! {
3726
pub const DepositPerItem: Balance = deposit(1, 0);
3827
pub const DepositPerByte: Balance = deposit(0, 1);
39-
pub Schedule: pallet_contracts::Schedule<Runtime> = schedule::<Runtime>();
28+
pub Schedule: pallet_contracts::Schedule<Runtime> = Default::default();
4029
pub const DefaultDepositLimit: Balance = deposit(1024, 1024 * 1024);
4130
pub const CodeHashLockupDepositPercent: Perbill = Perbill::from_percent(0);
4231
}
@@ -46,7 +35,7 @@ impl pallet_contracts::Config for Runtime {
4635
type ApiVersion = ();
4736
// IMPORTANT: only runtime calls through the api are allowed.
4837
type CallFilter = Nothing;
49-
type CallStack = [pallet_contracts::Frame<Self>; 23];
38+
type CallStack = [pallet_contracts::Frame<Self>; 5];
5039
type ChainExtension = api::Extension<Config>;
5140
type CodeHashLockupDepositPercent = CodeHashLockupDepositPercent;
5241
type Currency = Balances;
@@ -64,7 +53,7 @@ impl pallet_contracts::Config for Runtime {
6453
// if a too-large contract is uploaded. We noticed that it poses
6554
// less friction during development when the requirement here is
6655
// just more lax.
67-
type MaxCodeLen = ConstU32<{ 256 * 1024 }>;
56+
type MaxCodeLen = ConstU32<{ 123 * 1024 }>;
6857
type MaxDebugBufferLen = ConstU32<{ 2 * 1024 * 1024 }>;
6958
type MaxDelegateDependencies = ConstU32<32>;
7059
type MaxStorageKeyLen = ConstU32<128>;

runtime/testnet/src/config/contracts.rs

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -12,17 +12,6 @@ use crate::{
1212
Timestamp,
1313
};
1414

15-
fn schedule<T: pallet_contracts::Config>() -> pallet_contracts::Schedule<T> {
16-
pallet_contracts::Schedule {
17-
limits: pallet_contracts::Limits {
18-
runtime_memory: 1024 * 1024 * 1024,
19-
validator_runtime_memory: 2 * 1024 * 1024 * 1024,
20-
..Default::default()
21-
},
22-
..Default::default()
23-
}
24-
}
25-
2615
// randomness-collective-flip is insecure. Provide dummy randomness as placeholder for the
2716
// deprecated trait. https://github.com/paritytech/polkadot-sdk/blob/9bf1a5e23884921498b381728bfddaae93f83744/substrate/frame/contracts/mock-network/src/parachain/contracts_config.rs#L45
2817
pub struct DummyRandomness<T: pallet_contracts::Config>(PhantomData<T>);
@@ -36,7 +25,7 @@ impl<T: pallet_contracts::Config> Randomness<T::Hash, BlockNumberFor<T>> for Dum
3625
parameter_types! {
3726
pub const DepositPerItem: Balance = deposit(1, 0);
3827
pub const DepositPerByte: Balance = deposit(0, 1);
39-
pub Schedule: pallet_contracts::Schedule<Runtime> = schedule::<Runtime>();
28+
pub Schedule: pallet_contracts::Schedule<Runtime> = Default::default();
4029
pub const DefaultDepositLimit: Balance = deposit(1024, 1024 * 1024);
4130
pub const CodeHashLockupDepositPercent: Perbill = Perbill::from_percent(0);
4231
}
@@ -46,7 +35,7 @@ impl pallet_contracts::Config for Runtime {
4635
type ApiVersion = ();
4736
// IMPORTANT: only runtime calls through the api are allowed.
4837
type CallFilter = Nothing;
49-
type CallStack = [pallet_contracts::Frame<Self>; 23];
38+
type CallStack = [pallet_contracts::Frame<Self>; 5];
5039
type ChainExtension = api::Extension<Config>;
5140
type CodeHashLockupDepositPercent = CodeHashLockupDepositPercent;
5241
type Currency = Balances;
@@ -64,7 +53,7 @@ impl pallet_contracts::Config for Runtime {
6453
// if a too-large contract is uploaded. We noticed that it poses
6554
// less friction during development when the requirement here is
6655
// just more lax.
67-
type MaxCodeLen = ConstU32<{ 256 * 1024 }>;
56+
type MaxCodeLen = ConstU32<{ 123 * 1024 }>;
6857
type MaxDebugBufferLen = ConstU32<{ 2 * 1024 * 1024 }>;
6958
type MaxDelegateDependencies = ConstU32<32>;
7059
type MaxStorageKeyLen = ConstU32<128>;

0 commit comments

Comments
 (0)