Skip to content

Commit

Permalink
refactor: Weights updates for v0.9.42
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Orris committed May 26, 2023
1 parent 73c3adf commit ae1f8ad
Show file tree
Hide file tree
Showing 30 changed files with 2,867 additions and 1,518 deletions.
3,710 changes: 2,508 additions & 1,202 deletions Cargo.lock

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions pallets/capacity/src/tests/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ impl pallet_balances::Config for Test {
type ExistentialDeposit = ConstU64<1>;
type AccountStore = System;
type WeightInfo = ();
type FreezeIdentifier = ();
type HoldIdentifier = ();
type MaxFreezes = ConstU32<0>;
type MaxHolds = ConstU32<0>;
}

pub type MaxSchemaGrantsPerDelegation = ConstU32<30>;
Expand Down
20 changes: 10 additions & 10 deletions pallets/capacity/src/weights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,21 +66,21 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Capacity CapacityLedger (r:1 w:1)
// Storage: Balances Locks (r:1 w:1)
fn stake() -> Weight {
Weight::from_ref_time(42_288_000 as u64)
Weight::from_parts(42_288_000 as u64, 0)
.saturating_add(T::DbWeight::get().reads(5 as u64))
.saturating_add(T::DbWeight::get().writes(4 as u64))
}
// Storage: Capacity StakingAccountLedger (r:1 w:1)
// Storage: Balances Locks (r:1 w:1)
fn withdraw_unstaked() -> Weight {
Weight::from_ref_time(35_504_000 as u64)
Weight::from_parts(35_504_000 as u64, 0)
.saturating_add(T::DbWeight::get().reads(2 as u64))
.saturating_add(T::DbWeight::get().writes(2 as u64))
}
// Storage: Capacity CurrentEpochInfo (r:1 w:1)
// Storage: Capacity EpochLength (r:1 w:0)
fn on_initialize() -> Weight {
Weight::from_ref_time(6_533_000 as u64)
Weight::from_parts(6_533_000 as u64, 0)
.saturating_add(T::DbWeight::get().reads(2 as u64))
.saturating_add(T::DbWeight::get().writes(1 as u64))
}
Expand All @@ -89,13 +89,13 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Capacity StakingTargetLedger (r:1 w:1)
// Storage: Capacity CapacityLedger (r:1 w:1)
fn unstake() -> Weight {
Weight::from_ref_time(42_486_000 as u64)
Weight::from_parts(42_486_000 as u64, 0)
.saturating_add(T::DbWeight::get().reads(4 as u64))
.saturating_add(T::DbWeight::get().writes(4 as u64))
}
// Storage: Capacity EpochLength (r:0 w:1)
fn set_epoch_length() -> Weight {
Weight::from_ref_time(13_063_000 as u64)
Weight::from_parts(13_063_000 as u64, 0)
.saturating_add(T::DbWeight::get().writes(1 as u64))
}
}
Expand All @@ -108,21 +108,21 @@ impl WeightInfo for () {
// Storage: Capacity CapacityLedger (r:1 w:1)
// Storage: Balances Locks (r:1 w:1)
fn stake() -> Weight {
Weight::from_ref_time(42_288_000 as u64)
Weight::from_parts(42_288_000 as u64, 0)
.saturating_add(RocksDbWeight::get().reads(5 as u64))
.saturating_add(RocksDbWeight::get().writes(4 as u64))
}
// Storage: Capacity StakingAccountLedger (r:1 w:1)
// Storage: Balances Locks (r:1 w:1)
fn withdraw_unstaked() -> Weight {
Weight::from_ref_time(35_504_000 as u64)
Weight::from_parts(35_504_000 as u64, 0)
.saturating_add(RocksDbWeight::get().reads(2 as u64))
.saturating_add(RocksDbWeight::get().writes(2 as u64))
}
// Storage: Capacity CurrentEpochInfo (r:1 w:1)
// Storage: Capacity EpochLength (r:1 w:0)
fn on_initialize() -> Weight {
Weight::from_ref_time(6_533_000 as u64)
Weight::from_parts(6_533_000 as u64, 0)
.saturating_add(RocksDbWeight::get().reads(2 as u64))
.saturating_add(RocksDbWeight::get().writes(1 as u64))
}
Expand All @@ -131,13 +131,13 @@ impl WeightInfo for () {
// Storage: Capacity StakingTargetLedger (r:1 w:1)
// Storage: Capacity CapacityLedger (r:1 w:1)
fn unstake() -> Weight {
Weight::from_ref_time(42_486_000 as u64)
Weight::from_parts(42_486_000 as u64, 0)
.saturating_add(RocksDbWeight::get().reads(4 as u64))
.saturating_add(RocksDbWeight::get().writes(4 as u64))
}
// Storage: Capacity EpochLength (r:0 w:1)
fn set_epoch_length() -> Weight {
Weight::from_ref_time(13_063_000 as u64)
Weight::from_parts(13_063_000 as u64, 0)
.saturating_add(RocksDbWeight::get().writes(1 as u64))
}
}
46 changes: 23 additions & 23 deletions pallets/frequency-tx-payment/src/capacity_stable_weights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ use sp_std::marker::PhantomData;
/// - 95th: 91_299
/// - 75th: 90_626
pub const CAPACITY_EXTRINSIC_BASE_WEIGHT: Weight =
Weight::from_ref_time(WEIGHT_REF_TIME_PER_NANOS.saturating_mul(90_764));
Weight::from_parts(WEIGHT_REF_TIME_PER_NANOS.saturating_mul(90_764), 0);

/// Weight functions needed for pallet_msa.
pub trait WeightInfo {
Expand Down Expand Up @@ -88,9 +88,9 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Msa DelegatorAndProviderToDelegation (r:1 w:1)
// Storage: Schemas CurrentSchemaIdentifierMaximum (r:1 w:0)
fn create_sponsored_account_with_delegation(s: u32) -> Weight {
Weight::from_ref_time(100_556_500 as u64)
Weight::from_parts(100_556_500 as u64, 0)
// Standard Error: 19_778
.saturating_add(Weight::from_ref_time(120_447 as u64).saturating_mul(s as u64))
.saturating_add(Weight::from_parts(120_447 as u64, 0).saturating_mul(s as u64))
.saturating_add(T::DbWeight::get().reads(9 as u64))
.saturating_add(T::DbWeight::get().writes(6 as u64))
}
Expand All @@ -99,7 +99,7 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Msa PublicKeyToMsaId (r:2 w:1)
// Storage: Msa PublicKeyCountForMsaId (r:1 w:1)
fn add_public_key_to_msa() -> Weight {
Weight::from_ref_time(147_786_000 as u64)
Weight::from_parts(147_786_000 as u64, 0)
.saturating_add(T::DbWeight::get().reads(6 as u64))
.saturating_add(T::DbWeight::get().writes(5 as u64))
}
Expand All @@ -110,19 +110,19 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Msa DelegatorAndProviderToDelegation (r:1 w:1)
// Storage: Schemas CurrentSchemaIdentifierMaximum (r:1 w:0)
fn grant_delegation(s: u32) -> Weight {
Weight::from_ref_time(94_743_045 as u64)
Weight::from_parts(94_743_045 as u64, 0)
// Standard Error: 19_748
.saturating_add(Weight::from_ref_time(125_241 as u64).saturating_mul(s as u64))
.saturating_add(Weight::from_parts(125_241 as u64, 0).saturating_mul(s as u64))
.saturating_add(T::DbWeight::get().reads(7 as u64))
.saturating_add(T::DbWeight::get().writes(3 as u64))
}
// Storage: Msa PublicKeyToMsaId (r:1 w:0)
// Storage: Msa DelegatorAndProviderToDelegation (r:1 w:1)
// Storage: Schemas CurrentSchemaIdentifierMaximum (r:1 w:0)
fn grant_schema_permissions(s: u32) -> Weight {
Weight::from_ref_time(26_682_873 as u64)
Weight::from_parts(26_682_873 as u64, 0)
// Standard Error: 7_236
.saturating_add(Weight::from_ref_time(63_887 as u64).saturating_mul(s as u64))
.saturating_add(Weight::from_parts(63_887 as u64, 0).saturating_mul(s as u64))
.saturating_add(T::DbWeight::get().reads(3 as u64))
.saturating_add(T::DbWeight::get().writes(1 as u64))
}
Expand All @@ -131,17 +131,17 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Msa DelegatorAndProviderToDelegation (r:1 w:0)
// Storage: Messages Messages (r:1 w:1)
fn add_onchain_message(n: u32) -> Weight {
Weight::from_ref_time(139_432_286 as u64)
Weight::from_parts(139_432_286 as u64, 0)
// Standard Error: 43
.saturating_add(Weight::from_ref_time(1_441 as u64).saturating_mul(n as u64))
.saturating_add(Weight::from_parts(1_441 as u64, 0).saturating_mul(n as u64))
.saturating_add(T::DbWeight::get().reads(4 as u64))
.saturating_add(T::DbWeight::get().writes(1 as u64))
}
// Storage: Schemas Schemas (r:1 w:0)
// Storage: Msa PublicKeyToMsaId (r:1 w:0)
// Storage: Messages Messages (r:1 w:1)
fn add_ipfs_message() -> Weight {
Weight::from_ref_time(131_669_000 as u64)
Weight::from_parts(131_669_000 as u64, 0)
.saturating_add(T::DbWeight::get().reads(3 as u64))
.saturating_add(T::DbWeight::get().writes(1 as u64))
}
Expand All @@ -150,9 +150,9 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Msa DelegatorAndProviderToDelegation (r:1 w:0)
// Storage: unknown [0xbd1557c8db6bd8599a811a7175fbc2fc6400] (r:1 w:1)
fn apply_item_actions(s: u32) -> Weight {
Weight::from_ref_time(66_026_301 as u64)
Weight::from_parts(66_026_301 as u64, 0)
// Standard Error: 161
.saturating_add(Weight::from_ref_time(2_145 as u64).saturating_mul(s as u64))
.saturating_add(Weight::from_parts(2_145 as u64, 0).saturating_mul(s as u64))
.saturating_add(T::DbWeight::get().reads(4 as u64))
.saturating_add(T::DbWeight::get().writes(1 as u64))
}
Expand All @@ -161,9 +161,9 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Msa DelegatorAndProviderToDelegation (r:1 w:0)
// Storage: unknown [0x0763c98381dc89abe38627fe2f98cb7af1577fbf1d628fdddb4ebfc6e8d95fb1] (r:1 w:1)
fn upsert_page(s: u32) -> Weight {
Weight::from_ref_time(23_029_186 as u64)
Weight::from_parts(23_029_186 as u64, 0)
// Standard Error: 53
.saturating_add(Weight::from_ref_time(339 as u64).saturating_mul(s as u64))
.saturating_add(Weight::from_parts(339 as u64, 0).saturating_mul(s as u64))
.saturating_add(T::DbWeight::get().reads(4 as u64))
.saturating_add(T::DbWeight::get().writes(1 as u64))
}
Expand All @@ -172,35 +172,35 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Msa DelegatorAndProviderToDelegation (r:1 w:0)
// Storage: unknown [0x0763c98381dc89abe38627fe2f98cb7af1577fbf1d628fdddb4ebfc6e8d95fb1] (r:1 w:1)
fn delete_page() -> Weight {
Weight::from_ref_time(26_000_000 as u64)
Weight::from_parts(26_000_000 as u64, 0)
.saturating_add(T::DbWeight::get().reads(4 as u64))
.saturating_add(T::DbWeight::get().writes(1 as u64))
}
// Storage: Msa PublicKeyToMsaId (r:1 w:0)
// Storage: Schemas Schemas (r:1 w:0)
// Storage: unknown [0xbd1557c8db6bd8599a811a7175fbc2fc6400] (r:1 w:1)
fn apply_item_actions_with_signature(s: u32) -> Weight {
Weight::from_ref_time(105_921_191 as u64)
Weight::from_parts(105_921_191 as u64, 0)
// Standard Error: 267
.saturating_add(Weight::from_ref_time(6_150 as u64).saturating_mul(s as u64))
.saturating_add(Weight::from_parts(6_150 as u64, 0).saturating_mul(s as u64))
.saturating_add(T::DbWeight::get().reads(3 as u64))
.saturating_add(T::DbWeight::get().writes(1 as u64))
}
// Storage: Msa PublicKeyToMsaId (r:1 w:0)
// Storage: Schemas Schemas (r:1 w:0)
// Storage: unknown [0x0763c98381dc89abe38627fe2f98cb7af1577fbf1d628fdddb4ebfc6e8d95fb1] (r:1 w:1)
fn upsert_page_with_signature(s: u32) -> Weight {
Weight::from_ref_time(61_324_707 as u64)
Weight::from_parts(61_324_707 as u64, 0)
// Standard Error: 249
.saturating_add(Weight::from_ref_time(4_406 as u64).saturating_mul(s as u64))
.saturating_add(Weight::from_parts(4_406 as u64, 0).saturating_mul(s as u64))
.saturating_add(T::DbWeight::get().reads(3 as u64))
.saturating_add(T::DbWeight::get().writes(1 as u64))
}
// Storage: Msa PublicKeyToMsaId (r:1 w:0)
// Storage: Schemas Schemas (r:1 w:0)
// Storage: unknown [0x0763c98381dc89abe38627fe2f98cb7af1577fbf1d628fdddb4ebfc6e8d95fb1] (r:1 w:1)
fn delete_page_with_signature() -> Weight {
Weight::from_ref_time(65_000_000 as u64)
Weight::from_parts(65_000_000 as u64, 0)
.saturating_add(T::DbWeight::get().reads(3 as u64))
.saturating_add(T::DbWeight::get().writes(1 as u64))
}
Expand All @@ -209,9 +209,9 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Handles CanonicalBaseHandleToSuffixIndex (r:1 w:1)
// Storage: Handles CanonicalBaseHandleAndSuffixToMSAId (r:0 w:1)
fn claim_handle(b: u32) -> Weight {
Weight::from_ref_time(90_537_753 as u64)
Weight::from_parts(90_537_753 as u64, 0)
// Standard Error: 27_078
.saturating_add(Weight::from_ref_time(104_522 as u64).saturating_mul(b as u64))
.saturating_add(Weight::from_parts(104_522 as u64, 0).saturating_mul(b as u64))
.saturating_add(T::DbWeight::get().reads(3 as u64))
.saturating_add(T::DbWeight::get().writes(3 as u64))
}
Expand Down
9 changes: 7 additions & 2 deletions pallets/frequency-tx-payment/src/tests/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,11 @@ impl pallet_balances::Config for Test {
type ExistentialDeposit = ConstU64<1>;
type AccountStore = System;
type MaxReserves = ();
type FreezeIdentifier = ();
type HoldIdentifier = ();
type MaxFreezes = ConstU32<0>;
type MaxHolds = ConstU32<0>;

}

pub type MaxSchemaGrantsPerDelegation = ConstU32<30>;
Expand Down Expand Up @@ -226,7 +231,7 @@ pub struct TestCapacityCalls;
impl GetStableWeight<RuntimeCall, Weight> for TestCapacityCalls {
fn get_stable_weight(call: &RuntimeCall) -> Option<Weight> {
match call {
RuntimeCall::Balances(BalancesCall::transfer { .. }) => Some(Weight::from_ref_time(11)),
RuntimeCall::Balances(BalancesCall::transfer { .. }) => Some(Weight::from_parts(11, 0)),
_ => None,
}
}
Expand Down Expand Up @@ -269,7 +274,7 @@ impl Default for ExtBuilder {
fn default() -> Self {
Self {
balance_factor: 1,
base_weight: Weight::from_ref_time(0),
base_weight: Weight::from_parts(0, 0),
byte_fee: 1,
weight_to_fee: 1,
}
Expand Down
5 changes: 2 additions & 3 deletions pallets/frequency-tx-payment/src/tests/pallet_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -566,17 +566,16 @@ fn withdraw_fee_returns_custom_error_when_the_account_key_is_not_associated_with

ExtBuilder::default()
.balance_factor(balance_factor)
.base_weight(Weight::from_ref_time(5))
.base_weight(Weight::from_parts(5, 0))
.build()
.execute_with(|| {
let account_id_not_associated_with_msa = 10u64;

// This allows it not to fail on the requirement of an existential deposit.
assert_ok!(Balances::set_balance(
assert_ok!(Balances::force_set_balance(
RawOrigin::Root.into(),
account_id_not_associated_with_msa,
1u32.into(),
Zero::zero(),
));

let call: &<Test as Config>::RuntimeCall =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ fn test_weights_are_stable() {
(SubstrateWeight::<Test>::claim_handle(100), 100989953),
];
for t in table {
assert_eq!(t.0, Weight::from_ref_time(t.1));
assert_eq!(t.0, Weight::from_parts(t.1, 0));
}
});
}
12 changes: 6 additions & 6 deletions pallets/frequency-tx-payment/src/weights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,23 +58,23 @@ pub trait WeightInfo {
pub struct SubstrateWeight<T>(PhantomData<T>);
impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
fn pay_with_capacity() -> Weight {
Weight::from_ref_time(5_446_000 as u64)
Weight::from_parts(5_446_000 as u64, 0)
}
fn pay_with_capacity_batch_all(n: u32, ) -> Weight {
Weight::from_ref_time(14_021_898 as u64)
Weight::from_parts(14_021_898 as u64, 0)
// Standard Error: 65_672
.saturating_add(Weight::from_ref_time(4_317_127 as u64).saturating_mul(n as u64))
.saturating_add(Weight::from_parts(4_317_127 as u64, 0).saturating_mul(n as u64))
}
}

// For backwards compatibility and tests
impl WeightInfo for () {
fn pay_with_capacity() -> Weight {
Weight::from_ref_time(5_446_000 as u64)
Weight::from_parts(5_446_000 as u64, 0)
}
fn pay_with_capacity_batch_all(n: u32, ) -> Weight {
Weight::from_ref_time(14_021_898 as u64)
Weight::from_parts(14_021_898 as u64, 0)
// Standard Error: 65_672
.saturating_add(Weight::from_ref_time(4_317_127 as u64).saturating_mul(n as u64))
.saturating_add(Weight::from_parts(4_317_127 as u64, 0).saturating_mul(n as u64))
}
}
12 changes: 6 additions & 6 deletions pallets/handles/src/weights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,17 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: Handles CanonicalBaseHandleToSuffixIndex (r:1 w:1)
// Storage: Handles CanonicalBaseHandleAndSuffixToMSAId (r:0 w:1)
fn claim_handle(b: u32, ) -> Weight {
Weight::from_ref_time(86_997_731 as u64)
Weight::from_parts(86_997_731 as u64, 0)
// Standard Error: 13_866
.saturating_add(Weight::from_ref_time(91_385 as u64).saturating_mul(b as u64))
.saturating_add(Weight::from_parts(91_385 as u64, 0).saturating_mul(b as u64))
.saturating_add(T::DbWeight::get().reads(3 as u64))
.saturating_add(T::DbWeight::get().writes(3 as u64))
}
// Storage: Msa PublicKeyToMsaId (r:1 w:0)
// Storage: Handles MSAIdToDisplayName (r:1 w:1)
// Storage: Handles CanonicalBaseHandleAndSuffixToMSAId (r:0 w:1)
fn retire_handle() -> Weight {
Weight::from_ref_time(27_820_000 as u64)
Weight::from_parts(27_820_000 as u64, 0)
.saturating_add(T::DbWeight::get().reads(2 as u64))
.saturating_add(T::DbWeight::get().writes(2 as u64))
}
Expand All @@ -85,17 +85,17 @@ impl WeightInfo for () {
// Storage: Handles CanonicalBaseHandleToSuffixIndex (r:1 w:1)
// Storage: Handles CanonicalBaseHandleAndSuffixToMSAId (r:0 w:1)
fn claim_handle(b: u32, ) -> Weight {
Weight::from_ref_time(86_997_731 as u64)
Weight::from_parts(86_997_731 as u64, 0)
// Standard Error: 13_866
.saturating_add(Weight::from_ref_time(91_385 as u64).saturating_mul(b as u64))
.saturating_add(Weight::from_parts(91_385 as u64, 0).saturating_mul(b as u64))
.saturating_add(RocksDbWeight::get().reads(3 as u64))
.saturating_add(RocksDbWeight::get().writes(3 as u64))
}
// Storage: Msa PublicKeyToMsaId (r:1 w:0)
// Storage: Handles MSAIdToDisplayName (r:1 w:1)
// Storage: Handles CanonicalBaseHandleAndSuffixToMSAId (r:0 w:1)
fn retire_handle() -> Weight {
Weight::from_ref_time(27_820_000 as u64)
Weight::from_parts(27_820_000 as u64, 0)
.saturating_add(RocksDbWeight::get().reads(2 as u64))
.saturating_add(RocksDbWeight::get().writes(2 as u64))
}
Expand Down
Loading

0 comments on commit ae1f8ad

Please sign in to comment.