Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FRAME: Revamp Preimage pallet to use Consideration #1363

Merged
merged 55 commits into from
Sep 17, 2023
Merged
Show file tree
Hide file tree
Changes from 47 commits
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
fe5e59e
Consideration (abstraction over storage deposits)
gavofyork Sep 2, 2023
176194a
Fix stuff
gavofyork Sep 2, 2023
ae05a0d
Whitespace
gavofyork Sep 2, 2023
b14f28d
Repot
gavofyork Sep 2, 2023
13be42a
Docs and fixes
gavofyork Sep 2, 2023
4eebde0
Fixes and docs
gavofyork Sep 2, 2023
d94f888
Consideration trait
gavofyork Sep 2, 2023
3570b1b
Merge branch 'master' into gav-consideration-preimage
gavofyork Sep 2, 2023
9e2dd10
Merge branch 'gav-consideration' into gav-consideration-preimage
gavofyork Sep 2, 2023
c0d8ca6
Merge branch 'master' into gav-consideration
gavofyork Sep 2, 2023
0766ba0
Avoid associated type in Consideration
gavofyork Sep 3, 2023
eae1767
Merge branch 'gav-consideration' into gav-consideration-preimage
gavofyork Sep 3, 2023
f773a55
Fix for new API
gavofyork Sep 6, 2023
7aeae8c
Remove type params from preimage
gavofyork Sep 6, 2023
ae6d315
Make benches compile
ggwpez Sep 6, 2023
45b4160
Expose ensure_updated
ggwpez Sep 6, 2023
3479c19
Fixup mocks
ggwpez Sep 6, 2023
22e3fcf
Fix more mocks
ggwpez Sep 6, 2023
27f5885
More weight fixes
ggwpez Sep 6, 2023
6167e4a
Clippy
ggwpez Sep 6, 2023
c20a5f5
More clippy
ggwpez Sep 6, 2023
2582232
".git/.scripts/commands/bench/bench.sh" --subcommand=pallet --runtime…
Sep 6, 2023
4922ba1
Merge branch 'master' into gav-consideration
gavofyork Sep 7, 2023
8971c64
Merge branch 'master' into gav-consideration
gavofyork Sep 7, 2023
fd0a3d7
Add proper hold reasons
ggwpez Sep 7, 2023
05ac24e
Fix mocks
ggwpez Sep 7, 2023
bdb5407
Fix mock
ggwpez Sep 7, 2023
6d04572
Always use whitelisted caller
ggwpez Sep 8, 2023
aaeb552
Set MaxHolds to 1
ggwpez Sep 8, 2023
915cdc0
Update substrate/frame/support/src/traits/tokens/fungible/freeze.rs
gavofyork Sep 8, 2023
c549398
Update substrate/frame/support/src/traits/tokens/fungible/freeze.rs
gavofyork Sep 8, 2023
d781c55
Update substrate/frame/support/src/traits/storage.rs
gavofyork Sep 8, 2023
4da8bc9
Update substrate/frame/support/src/traits/tokens/fungible/mod.rs
gavofyork Sep 8, 2023
47fce97
Merge branch 'master' into gav-consideration
gavofyork Sep 8, 2023
1ba478f
Clippy
ggwpez Sep 8, 2023
87d182c
Merge remote-tracking branch 'origin/master' into gav-consideration-p…
ggwpez Sep 8, 2023
5b29c2a
import
ggwpez Sep 8, 2023
2f2924e
".git/.scripts/commands/fmt/fmt.sh"
Sep 8, 2023
90c4440
Merge branch 'master' into gav-consideration
gavofyork Sep 8, 2023
ced055e
Add
gavofyork Sep 8, 2023
161755d
Merge branch 'gav-consideration' into gav-consideration-preimage
gavofyork Sep 8, 2023
52233f0
fmt
ggwpez Sep 8, 2023
a742bd9
Update substrate/frame/preimage/src/lib.rs
ggwpez Sep 8, 2023
0b757e8
Merge remote-tracking branch 'origin/master' into gav-consideration-p…
gavofyork Sep 8, 2023
de459b3
Add tests
ggwpez Sep 8, 2023
b10b7aa
Benchmark one account per depositor
ggwpez Sep 8, 2023
b5f484c
Merge branch 'master' into gav-consideration-preimage
gavofyork Sep 10, 2023
fdbacb1
Update substrate/frame/preimage/src/lib.rs
gavofyork Sep 12, 2023
c2097b2
Update substrate/frame/preimage/src/lib.rs
gavofyork Sep 12, 2023
97542d2
Update substrate/frame/preimage/src/tests.rs
gavofyork Sep 12, 2023
2ed225d
Minor tweaks
gavofyork Sep 14, 2023
095a56d
Merge branch 'gav-consideration-preimage' of github.com:paritytech/po…
gavofyork Sep 14, 2023
369f8f5
Merge branch 'master' into gav-consideration-preimage
gavofyork Sep 14, 2023
061573f
Fixes
gavofyork Sep 14, 2023
86d8022
Merge branch 'gav-consideration-preimage' of github.com:paritytech/po…
gavofyork Sep 14, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ use frame_support::{
construct_runtime,
dispatch::DispatchClass,
parameter_types,
traits::{ConstBool, ConstU16, ConstU32, ConstU64, ConstU8, EitherOfDiverse, InstanceFilter},
traits::{
fungible::HoldConsideration, ConstBool, ConstU16, ConstU32, ConstU64, ConstU8,
EitherOfDiverse, InstanceFilter, LinearStoragePrice,
},
weights::{ConstantMultiplier, Weight},
PalletId,
};
Expand Down Expand Up @@ -209,7 +212,7 @@ impl pallet_balances::Config for Runtime {
type ReserveIdentifier = [u8; 8];
type RuntimeHoldReason = RuntimeHoldReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxHolds = ConstU32<1>;
type MaxFreezes = ConstU32<0>;
}

Expand Down Expand Up @@ -545,15 +548,21 @@ impl pallet_scheduler::Config for Runtime {
parameter_types! {
pub const PreimageBaseDeposit: Balance = deposit(2, 64);
pub const PreimageByteDeposit: Balance = deposit(0, 1);
pub const PreimageHoldReason: RuntimeHoldReason = RuntimeHoldReason::Preimage(pallet_preimage::HoldReason::Preimage);
}

impl pallet_preimage::Config for Runtime {
type WeightInfo = weights::pallet_preimage::WeightInfo<Runtime>;
type RuntimeEvent = RuntimeEvent;
type Currency = Balances;
type ManagerOrigin = EnsureRoot<AccountId>;
type BaseDeposit = PreimageBaseDeposit;
type ByteDeposit = PreimageByteDeposit;
type RuntimeHoldReason = RuntimeHoldReason;
type Consideration = HoldConsideration<
AccountId,
Balances,
PreimageHoldReason,
LinearStoragePrice<PreimageBaseDeposit, PreimageByteDeposit, Balance>,
>;
}

// Create the runtime by composing the FRAME pallets that were previously configured.
Expand Down Expand Up @@ -589,7 +598,7 @@ construct_runtime!(
Utility: pallet_utility::{Pallet, Call, Event} = 40,
Multisig: pallet_multisig::{Pallet, Call, Storage, Event<T>} = 41,
Proxy: pallet_proxy::{Pallet, Call, Storage, Event<T>} = 42,
Preimage: pallet_preimage::{Pallet, Call, Storage, Event<T>} = 43,
Preimage: pallet_preimage::{Pallet, Call, Storage, Event<T>, HoldReason} = 43,
Scheduler: pallet_scheduler::{Pallet, Call, Storage, Event<T>} = 44,

// The main stage.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,21 @@ use core::marker::PhantomData;
/// Weight functions for `pallet_preimage`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_preimage::WeightInfo for WeightInfo<T> {
fn ensure_updated(n: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `193 + n * (91 ±0)`
// Estimated: `3593 + n * (2566 ±0)`
// Minimum execution time: 2_000_000 picoseconds.
Weight::from_parts(2_000_000, 3593)
// Standard Error: 13_720
.saturating_add(Weight::from_parts(17_309_199, 0).saturating_mul(n.into()))
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into())))
.saturating_add(T::DbWeight::get().writes(1_u64))
.saturating_add(T::DbWeight::get().writes((2_u64).saturating_mul(n.into())))
.saturating_add(Weight::from_parts(0, 2566).saturating_mul(n.into()))
}

/// Storage: `Preimage::StatusFor` (r:1 w:1)
/// Proof: `Preimage::StatusFor` (`max_values`: None, `max_size`: Some(91), added: 2566, mode: `MaxEncodedLen`)
/// Storage: `Preimage::PreimageFor` (r:0 w:1)
Expand Down
17 changes: 12 additions & 5 deletions polkadot/runtime/kusama/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,9 @@ use frame_election_provider_support::{
use frame_support::{
construct_runtime, parameter_types,
traits::{
ConstU32, Contains, EitherOf, EitherOfDiverse, InstanceFilter, KeyOwnerProofSystem,
PrivilegeCmp, ProcessMessage, ProcessMessageError, StorageMapShim, WithdrawReasons,
fungible::HoldConsideration, ConstU32, Contains, EitherOf, EitherOfDiverse, InstanceFilter,
KeyOwnerProofSystem, LinearStoragePrice, PrivilegeCmp, ProcessMessage, ProcessMessageError,
StorageMapShim, WithdrawReasons,
},
weights::{ConstantMultiplier, WeightMeter},
PalletId,
Expand Down Expand Up @@ -239,15 +240,21 @@ impl pallet_scheduler::Config for Runtime {
parameter_types! {
pub const PreimageBaseDeposit: Balance = deposit(2, 64);
pub const PreimageByteDeposit: Balance = deposit(0, 1);
pub const PreimageHoldReason: RuntimeHoldReason = RuntimeHoldReason::Preimage(pallet_preimage::HoldReason::Preimage);
}

impl pallet_preimage::Config for Runtime {
type WeightInfo = weights::pallet_preimage::WeightInfo<Runtime>;
type RuntimeEvent = RuntimeEvent;
type Currency = Balances;
type ManagerOrigin = EnsureRoot<AccountId>;
type BaseDeposit = PreimageBaseDeposit;
type ByteDeposit = PreimageByteDeposit;
type RuntimeHoldReason = RuntimeHoldReason;
type Consideration = HoldConsideration<
AccountId,
Balances,
PreimageHoldReason,
LinearStoragePrice<PreimageBaseDeposit, PreimageByteDeposit, Balance>,
>;
}

parameter_types! {
Expand Down Expand Up @@ -1560,7 +1567,7 @@ construct_runtime! {
Multisig: pallet_multisig::{Pallet, Call, Storage, Event<T>} = 31,

// Preimage registrar.
Preimage: pallet_preimage::{Pallet, Call, Storage, Event<T>} = 32,
Preimage: pallet_preimage::{Pallet, Call, Storage, Event<T>, HoldReason} = 32,

// Bounties modules.
Bounties: pallet_bounties::{Pallet, Call, Storage, Event<T>} = 35,
Expand Down
15 changes: 15 additions & 0 deletions polkadot/runtime/kusama/src/weights/pallet_preimage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,21 @@ use core::marker::PhantomData;
/// Weight functions for `pallet_preimage`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_preimage::WeightInfo for WeightInfo<T> {
fn ensure_updated(n: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `193 + n * (91 ±0)`
// Estimated: `3593 + n * (2566 ±0)`
// Minimum execution time: 2_000_000 picoseconds.
Weight::from_parts(2_000_000, 3593)
// Standard Error: 13_720
.saturating_add(Weight::from_parts(17_309_199, 0).saturating_mul(n.into()))
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into())))
.saturating_add(T::DbWeight::get().writes(1_u64))
.saturating_add(T::DbWeight::get().writes((2_u64).saturating_mul(n.into())))
.saturating_add(Weight::from_parts(0, 2566).saturating_mul(n.into()))
}

/// Storage: Preimage StatusFor (r:1 w:1)
/// Proof: Preimage StatusFor (max_values: None, max_size: Some(91), added: 2566, mode: MaxEncodedLen)
/// Storage: Preimage PreimageFor (r:0 w:1)
Expand Down
20 changes: 13 additions & 7 deletions polkadot/runtime/polkadot/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,9 @@ use frame_election_provider_support::{
use frame_support::{
construct_runtime, parameter_types,
traits::{
ConstU32, Contains, EitherOf, EitherOfDiverse, InstanceFilter, KeyOwnerProofSystem,
PrivilegeCmp, ProcessMessage, ProcessMessageError, WithdrawReasons,
fungible::HoldConsideration, ConstU32, Contains, EitherOf, EitherOfDiverse, InstanceFilter,
KeyOwnerProofSystem, LinearStoragePrice, PrivilegeCmp, ProcessMessage, ProcessMessageError,
WithdrawReasons,
},
weights::{ConstantMultiplier, WeightMeter},
PalletId,
Expand Down Expand Up @@ -221,18 +222,23 @@ impl pallet_scheduler::Config for Runtime {
}

parameter_types! {
pub const PreimageMaxSize: u32 = 4096 * 1024;
pub const PreimageBaseDeposit: Balance = deposit(2, 64);
pub const PreimageByteDeposit: Balance = deposit(0, 1);
pub const PreimageHoldReason: RuntimeHoldReason = RuntimeHoldReason::Preimage(pallet_preimage::HoldReason::Preimage);
}

impl pallet_preimage::Config for Runtime {
type WeightInfo = weights::pallet_preimage::WeightInfo<Runtime>;
type RuntimeEvent = RuntimeEvent;
type Currency = Balances;
type ManagerOrigin = EnsureRoot<AccountId>;
type BaseDeposit = PreimageBaseDeposit;
type ByteDeposit = PreimageByteDeposit;
type RuntimeHoldReason = RuntimeHoldReason;
type Consideration = HoldConsideration<
AccountId,
Balances,
PreimageHoldReason,
LinearStoragePrice<PreimageBaseDeposit, PreimageByteDeposit, Balance>,
>;
}

parameter_types! {
Expand Down Expand Up @@ -297,7 +303,7 @@ impl pallet_balances::Config for Runtime {
type WeightInfo = weights::pallet_balances::WeightInfo<Runtime>;
type RuntimeHoldReason = RuntimeHoldReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxHolds = ConstU32<1>;
type MaxFreezes = ConstU32<0>;
}

Expand Down Expand Up @@ -1326,7 +1332,7 @@ construct_runtime! {
// Basic stuff; balances is uncallable initially.
System: frame_system::{Pallet, Call, Storage, Config<T>, Event<T>} = 0,
Scheduler: pallet_scheduler::{Pallet, Call, Storage, Event<T>} = 1,
Preimage: pallet_preimage::{Pallet, Call, Storage, Event<T>} = 10,
Preimage: pallet_preimage::{Pallet, Call, Storage, Event<T>, HoldReason} = 10,

// Babe must be before session.
Babe: pallet_babe::{Pallet, Call, Storage, Config<T>, ValidateUnsigned} = 2,
Expand Down
15 changes: 15 additions & 0 deletions polkadot/runtime/polkadot/src/weights/pallet_preimage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,21 @@ use core::marker::PhantomData;
/// Weight functions for `pallet_preimage`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_preimage::WeightInfo for WeightInfo<T> {
fn ensure_updated(n: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `193 + n * (91 ±0)`
// Estimated: `3593 + n * (2566 ±0)`
// Minimum execution time: 2_000_000 picoseconds.
Weight::from_parts(2_000_000, 3593)
// Standard Error: 13_720
.saturating_add(Weight::from_parts(17_309_199, 0).saturating_mul(n.into()))
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into())))
.saturating_add(T::DbWeight::get().writes(1_u64))
.saturating_add(T::DbWeight::get().writes((2_u64).saturating_mul(n.into())))
.saturating_add(Weight::from_parts(0, 2566).saturating_mul(n.into()))
}

/// Storage: Preimage StatusFor (r:1 w:1)
/// Proof: Preimage StatusFor (max_values: None, max_size: Some(91), added: 2566, mode: MaxEncodedLen)
/// Storage: Preimage PreimageFor (r:0 w:1)
Expand Down
17 changes: 12 additions & 5 deletions polkadot/runtime/rococo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,9 @@ use beefy_primitives::{
use frame_support::{
construct_runtime, parameter_types,
traits::{
Contains, EitherOfDiverse, InstanceFilter, KeyOwnerProofSystem, LockIdentifier,
PrivilegeCmp, ProcessMessage, ProcessMessageError, StorageMapShim, WithdrawReasons,
fungible::HoldConsideration, Contains, EitherOfDiverse, InstanceFilter,
KeyOwnerProofSystem, LinearStoragePrice, LockIdentifier, PrivilegeCmp, ProcessMessage,
ProcessMessageError, StorageMapShim, WithdrawReasons,
},
weights::{ConstantMultiplier, WeightMeter},
PalletId,
Expand Down Expand Up @@ -224,15 +225,21 @@ impl pallet_scheduler::Config for Runtime {
parameter_types! {
pub const PreimageBaseDeposit: Balance = deposit(2, 64);
pub const PreimageByteDeposit: Balance = deposit(0, 1);
pub const PreimageHoldReason: RuntimeHoldReason = RuntimeHoldReason::Preimage(pallet_preimage::HoldReason::Preimage);
}

impl pallet_preimage::Config for Runtime {
type WeightInfo = weights::pallet_preimage::WeightInfo<Runtime>;
type RuntimeEvent = RuntimeEvent;
type Currency = Balances;
type ManagerOrigin = EnsureRoot<AccountId>;
type BaseDeposit = PreimageBaseDeposit;
type ByteDeposit = PreimageByteDeposit;
type RuntimeHoldReason = RuntimeHoldReason;
type Consideration = HoldConsideration<
AccountId,
Balances,
PreimageHoldReason,
LinearStoragePrice<PreimageBaseDeposit, PreimageByteDeposit, Balance>,
>;
}

parameter_types! {
Expand Down Expand Up @@ -1449,7 +1456,7 @@ construct_runtime! {
Multisig: pallet_multisig::{Pallet, Call, Storage, Event<T>} = 31,

// Preimage registrar.
Preimage: pallet_preimage::{Pallet, Call, Storage, Event<T>} = 32,
Preimage: pallet_preimage::{Pallet, Call, Storage, Event<T>, HoldReason} = 32,

// Bounties modules.
Bounties: pallet_bounties::{Pallet, Call, Storage, Event<T>} = 35,
Expand Down
15 changes: 15 additions & 0 deletions polkadot/runtime/rococo/src/weights/pallet_preimage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,21 @@ use core::marker::PhantomData;
/// Weight functions for `pallet_preimage`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_preimage::WeightInfo for WeightInfo<T> {
fn ensure_updated(n: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `193 + n * (91 ±0)`
// Estimated: `3593 + n * (2566 ±0)`
// Minimum execution time: 2_000_000 picoseconds.
Weight::from_parts(2_000_000, 3593)
// Standard Error: 13_720
.saturating_add(Weight::from_parts(17_309_199, 0).saturating_mul(n.into()))
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into())))
.saturating_add(T::DbWeight::get().writes(1_u64))
.saturating_add(T::DbWeight::get().writes((2_u64).saturating_mul(n.into())))
.saturating_add(Weight::from_parts(0, 2566).saturating_mul(n.into()))
}

/// Storage: Preimage StatusFor (r:1 w:1)
/// Proof: Preimage StatusFor (max_values: None, max_size: Some(91), added: 2566, mode: MaxEncodedLen)
/// Storage: Preimage PreimageFor (r:0 w:1)
Expand Down
19 changes: 12 additions & 7 deletions polkadot/runtime/westend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ use frame_election_provider_support::{bounds::ElectionBoundsBuilder, onchain, Se
use frame_support::{
construct_runtime, parameter_types,
traits::{
ConstU32, InstanceFilter, KeyOwnerProofSystem, ProcessMessage, ProcessMessageError,
WithdrawReasons,
fungible::HoldConsideration, ConstU32, InstanceFilter, KeyOwnerProofSystem,
LinearStoragePrice, ProcessMessage, ProcessMessageError, WithdrawReasons,
},
weights::{ConstantMultiplier, WeightMeter},
PalletId,
Expand Down Expand Up @@ -193,18 +193,23 @@ impl pallet_scheduler::Config for Runtime {
}

parameter_types! {
pub const PreimageMaxSize: u32 = 4096 * 1024;
pub const PreimageBaseDeposit: Balance = deposit(2, 64);
pub const PreimageByteDeposit: Balance = deposit(0, 1);
pub const PreimageHoldReason: RuntimeHoldReason = RuntimeHoldReason::Preimage(pallet_preimage::HoldReason::Preimage);
}

impl pallet_preimage::Config for Runtime {
type WeightInfo = weights::pallet_preimage::WeightInfo<Runtime>;
type RuntimeEvent = RuntimeEvent;
type Currency = Balances;
type ManagerOrigin = EnsureRoot<AccountId>;
type BaseDeposit = PreimageBaseDeposit;
type ByteDeposit = PreimageByteDeposit;
type RuntimeHoldReason = RuntimeHoldReason;
type Consideration = HoldConsideration<
AccountId,
Balances,
PreimageHoldReason,
LinearStoragePrice<PreimageBaseDeposit, PreimageByteDeposit, Balance>,
>;
}

parameter_types! {
Expand Down Expand Up @@ -268,7 +273,7 @@ impl pallet_balances::Config for Runtime {
type WeightInfo = weights::pallet_balances::WeightInfo<Runtime>;
type RuntimeHoldReason = RuntimeHoldReason;
type FreezeIdentifier = ();
type MaxHolds = ConstU32<0>;
type MaxHolds = ConstU32<1>;
type MaxFreezes = ConstU32<0>;
}

Expand Down Expand Up @@ -1311,7 +1316,7 @@ construct_runtime! {
Scheduler: pallet_scheduler::{Pallet, Call, Storage, Event<T>} = 20,

// Preimage registrar.
Preimage: pallet_preimage::{Pallet, Call, Storage, Event<T>} = 28,
Preimage: pallet_preimage::{Pallet, Call, Storage, Event<T>, HoldReason} = 28,

// Sudo.
Sudo: pallet_sudo::{Pallet, Call, Storage, Event<T>, Config<T>} = 21,
Expand Down
15 changes: 15 additions & 0 deletions polkadot/runtime/westend/src/weights/pallet_preimage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,21 @@ use core::marker::PhantomData;
/// Weight functions for `pallet_preimage`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_preimage::WeightInfo for WeightInfo<T> {
fn ensure_updated(n: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `193 + n * (91 ±0)`
// Estimated: `3593 + n * (2566 ±0)`
// Minimum execution time: 2_000_000 picoseconds.
Weight::from_parts(2_000_000, 3593)
// Standard Error: 13_720
.saturating_add(Weight::from_parts(17_309_199, 0).saturating_mul(n.into()))
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().reads((1_u64).saturating_mul(n.into())))
.saturating_add(T::DbWeight::get().writes(1_u64))
.saturating_add(T::DbWeight::get().writes((2_u64).saturating_mul(n.into())))
.saturating_add(Weight::from_parts(0, 2566).saturating_mul(n.into()))
}

/// Storage: Preimage StatusFor (r:1 w:1)
/// Proof: Preimage StatusFor (max_values: None, max_size: Some(91), added: 2566, mode: MaxEncodedLen)
/// Storage: Preimage PreimageFor (r:0 w:1)
Expand Down
Loading