Skip to content

Commit

Permalink
chore: fix mock runtime after auditing
Browse files Browse the repository at this point in the history
Signed-off-by: dung5ire <[email protected]>
  • Loading branch information
dung5ire committed Aug 26, 2024
1 parent 97432cf commit a7bd712
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 2 deletions.
2 changes: 2 additions & 0 deletions frame/babe/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion frame/esg/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
47 changes: 46 additions & 1 deletion frame/esg/src/weights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -82,3 +82,48 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeightInfo<T> {
.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))
}
}
2 changes: 2 additions & 0 deletions frame/grandpa/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions frame/im-online/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions frame/reward/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 2 additions & 0 deletions frame/staking/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<RuntimeCall, ()>;
Expand Down

0 comments on commit a7bd712

Please sign in to comment.