diff --git a/frame/babe/src/mock.rs b/frame/babe/src/mock.rs index 46d0f8ca..46133c95 100644 --- a/frame/babe/src/mock.rs +++ b/frame/babe/src/mock.rs @@ -275,6 +275,8 @@ impl pallet_esg::Config for Test { type RuntimeEvent = RuntimeEvent; type MaxFileSize = ConstU32<1024000>; type WeightInfo = (); + type MaxNumOfSudoOracles = ConstU32<5>; + type MaxNumOfNonSudoOracles = ConstU32<5>; } impl pallet_offences::Config for Test { diff --git a/frame/esg/src/mock.rs b/frame/esg/src/mock.rs index da64c62c..7637fab1 100644 --- a/frame/esg/src/mock.rs +++ b/frame/esg/src/mock.rs @@ -69,7 +69,7 @@ parameter_types! { pub const MaxNumOfNonSudoOracles: u32 = 100; } -impl pallet_esg::Config for Runtime { +impl pallet_esg::Config for Test { type RuntimeEvent = RuntimeEvent; type MaxFileSize = MaxFileSize; type MaxNumOfSudoOracles = MaxNumOfSudoOracles; diff --git a/frame/esg/src/weights.rs b/frame/esg/src/weights.rs index 3040e056..5b151c81 100644 --- a/frame/esg/src/weights.rs +++ b/frame/esg/src/weights.rs @@ -29,7 +29,7 @@ #![allow(unused_imports)] #![allow(missing_docs)] -use frame_support::{traits::Get, weights::Weight}; +use frame_support::{traits::Get, weights::{constants::RocksDbWeight, Weight}}; use core::marker::PhantomData; pub trait WeightInfo { @@ -82,3 +82,48 @@ impl WeightInfo for SubstrateWeightInfo { .saturating_add(T::DbWeight::get().writes(2)) } } + + + +impl WeightInfo for () { + /// Storage: `EsgScore::SudoOraclesStore` (r:1 w:1) + /// Proof: `EsgScore::SudoOraclesStore` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `EsgScore::NonSudoOraclesStore` (r:1 w:0) + /// Proof: `EsgScore::NonSudoOraclesStore` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + fn register_an_oracle() -> Weight { + // Proof Size summary in bytes: + // Measured: `2109` + // Estimated: `3594` + // Minimum execution time: 17_000_000 picoseconds. + Weight::from_parts(18_000_000, 0) + .saturating_add(Weight::from_parts(0, 3594)) + .saturating_add(RocksDbWeight::get().reads(2)) + .saturating_add(RocksDbWeight::get().writes(1)) + } + /// Storage: `EsgScore::SudoOraclesStore` (r:1 w:1) + /// Proof: `EsgScore::SudoOraclesStore` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + fn deregister_an_oracle() -> Weight { + // Proof Size summary in bytes: + // Measured: `238` + // Estimated: `1723` + // Minimum execution time: 14_000_000 picoseconds. + Weight::from_parts(14_000_000, 0) + .saturating_add(Weight::from_parts(0, 1723)) + .saturating_add(RocksDbWeight::get().reads(1)) + .saturating_add(RocksDbWeight::get().writes(1)) + } + /// Storage: `EsgScore::SudoOraclesStore` (r:1 w:0) + /// Proof: `EsgScore::SudoOraclesStore` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) + /// Storage: `EsgScore::ESGScoresMap` (r:2 w:2) + /// Proof: `EsgScore::ESGScoresMap` (`max_values`: None, `max_size`: None, mode: `Measured`) + fn upsert_esg_scores() -> Weight { + // Proof Size summary in bytes: + // Measured: `238` + // Estimated: `6178` + // Minimum execution time: 1_028_000_000 picoseconds. + Weight::from_parts(1_048_000_000, 0) + .saturating_add(Weight::from_parts(0, 6178)) + .saturating_add(RocksDbWeight::get().reads(3)) + .saturating_add(RocksDbWeight::get().writes(2)) + } +} \ No newline at end of file diff --git a/frame/grandpa/src/mock.rs b/frame/grandpa/src/mock.rs index e0b2c767..fd879284 100644 --- a/frame/grandpa/src/mock.rs +++ b/frame/grandpa/src/mock.rs @@ -220,6 +220,8 @@ impl pallet_esg::Config for Test { type RuntimeEvent = RuntimeEvent; type MaxFileSize = ConstU32<1024000>; type WeightInfo = (); + type MaxNumOfSudoOracles = ConstU32<5>; + type MaxNumOfNonSudoOracles = ConstU32<5>; } pub struct OnChainSeqPhragmen; diff --git a/frame/im-online/src/mock.rs b/frame/im-online/src/mock.rs index 4b299c5b..e1bcc470 100644 --- a/frame/im-online/src/mock.rs +++ b/frame/im-online/src/mock.rs @@ -243,6 +243,8 @@ impl pallet_esg::Config for Test { type WeightInfo = (); type MaxFileSize = ConstU32<102400>; type RuntimeEvent = RuntimeEvent; + type MaxNumOfSudoOracles = ConstU32<5>; + type MaxNumOfNonSudoOracles = ConstU32<5>; } type VoterBagsListInstance = pallet_bags_list::Instance1; diff --git a/frame/reward/src/mock.rs b/frame/reward/src/mock.rs index b82aa671..141c04f3 100644 --- a/frame/reward/src/mock.rs +++ b/frame/reward/src/mock.rs @@ -277,6 +277,8 @@ impl pallet_esg::Config for Test { type WeightInfo = (); type RuntimeEvent = RuntimeEvent; type MaxFileSize = ConstU32<1024000>; + type MaxNumOfSudoOracles = ConstU32<5>; + type MaxNumOfNonSudoOracles = ConstU32<5>; } impl pallet_offences::Config for Test { diff --git a/frame/staking/src/mock.rs b/frame/staking/src/mock.rs index b68e17f8..db53c489 100644 --- a/frame/staking/src/mock.rs +++ b/frame/staking/src/mock.rs @@ -177,6 +177,8 @@ impl pallet_esg::Config for Test { type WeightInfo = (); type RuntimeEvent = RuntimeEvent; type MaxFileSize = ConstU32<1024000>; + type MaxNumOfSudoOracles = ConstU32<5>; + type MaxNumOfNonSudoOracles = ConstU32<5>; } pub type Extrinsic = sp_runtime::testing::TestXt;