Skip to content

Commit

Permalink
Use zero extension weights
Browse files Browse the repository at this point in the history
  • Loading branch information
s0me0ne-unkn0wn committed Nov 10, 2024
1 parent 6888999 commit 179fb0c
Showing 1 changed file with 17 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));

extern crate alloc;

use core::marker::PhantomData;

use alloc::{vec, vec::Vec};
use cumulus_pallet_parachain_system::RelayNumberMonotonicallyIncreases;
use sp_api::impl_runtime_apis;
Expand Down Expand Up @@ -159,6 +161,18 @@ parameter_types! {
pub const SS58Prefix: u8 = 42;
}

pub struct ZeroWeight<T>(PhantomData<T>);
impl<T: frame_system::Config> frame_system::ExtensionsWeightInfo for ZeroWeight<T> {
fn check_genesis() -> Weight { Weight::zero() }
fn check_mortality_mortal_transaction() -> Weight { Weight::zero() }
fn check_mortality_immortal_transaction() -> Weight { Weight::zero() }
fn check_non_zero_sender() -> Weight { Weight::zero() }
fn check_nonce() -> Weight { Weight::zero() }
fn check_spec_version() -> Weight { Weight::zero() }
fn check_tx_version() -> Weight { Weight::zero() }
fn check_weight() -> Weight { Weight::zero() }
}

#[derive_impl(frame_system::config_preludes::TestDefaultConfig)]
impl frame_system::Config for Runtime {
/// The identifier used to distinguish between accounts.
Expand Down Expand Up @@ -196,6 +210,9 @@ impl frame_system::Config for Runtime {
type SS58Prefix = SS58Prefix;
type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode<Self>;
type MaxConsumers = frame_support::traits::ConstU32<16>;
/// The extensions weight is accounted for in the base extrinsic weight for this para, so
/// we use dummy zero weights here
type ExtensionsWeightInfo = ZeroWeight<Self>;
}

impl pallet_timestamp::Config for Runtime {
Expand Down

0 comments on commit 179fb0c

Please sign in to comment.