Skip to content

Commit f0da77a

Browse files
Run benchmarks
1 parent 85e27b3 commit f0da77a

File tree

3 files changed

+43
-64
lines changed

3 files changed

+43
-64
lines changed

pallets/settlement/src/benchmarking.rs

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -554,22 +554,6 @@ benchmarks! {
554554
let portfolios = parameters.sdr_portfolios();
555555
}: _(alice.origin, InstructionId(1), portfolios)
556556

557-
reject_instruction {
558-
// Number of fungible, non-fungible and offchain LEGS in the instruction
559-
let f in 1..T::MaxNumberOfFungibleAssets::get();
560-
let n in 0..T::MaxNumberOfNFTs::get();
561-
let o in 0..T::MaxNumberOfOffChainAssets::get();
562-
563-
let m = T::MaxInstructionMediators::get();
564-
565-
let alice = UserBuilder::<T>::default().generate_did().build("Alice");
566-
let bob = UserBuilder::<T>::default().generate_did().build("Bob");
567-
let settlement_type = SettlementType::SettleOnBlock(100u32.into());
568-
let venue_id = create_venue_::<T>(alice.did(), vec![alice.account(), bob.account()]);
569-
570-
let parameters = setup_execute_instruction::<T>(&alice, &bob, settlement_type, venue_id, f, n, o, m, false, false);
571-
}: _(alice.origin, InstructionId(1), parameters.portfolios.sdr_portfolios[0])
572-
573557
execute_instruction_paused {
574558
// Number of fungible, non-fungible and offchain assets in the instruction
575559
let f in 1..T::MaxNumberOfFungibleAssets::get() as u32;
@@ -781,22 +765,6 @@ benchmarks! {
781765
).unwrap();
782766
}: _(david.origin, InstructionId(1))
783767

784-
reject_instruction_as_mediator {
785-
// Number of fungible, non-fungible and offchain LEGS in the instruction
786-
let f in 1..T::MaxNumberOfFungibleAssets::get();
787-
let n in 0..T::MaxNumberOfNFTs::get();
788-
let o in 0..T::MaxNumberOfOffChainAssets::get();
789-
790-
let m = T::MaxInstructionMediators::get();
791-
792-
let alice = UserBuilder::<T>::default().generate_did().build("Alice");
793-
let bob = UserBuilder::<T>::default().generate_did().build("Bob");
794-
let settlement_type = SettlementType::SettleOnBlock(100u32.into());
795-
let venue_id = create_venue_::<T>(alice.did(), vec![alice.account(), bob.account()]);
796-
797-
let parameters = setup_execute_instruction::<T>(&alice, &bob, settlement_type, venue_id, f, n, o, m, false, false);
798-
}: _(parameters.asset_mediators[0].origin.clone(), InstructionId(1), None)
799-
800768
valid_caller_portfolio {
801769
let bob = UserBuilder::<T>::default().generate_did().build("Bob");
802770
let alice = UserBuilder::<T>::default().generate_did().build("Alice");

pallets/settlement/src/lib.rs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2973,7 +2973,10 @@ impl<T: Config> Pallet<T> {
29732973
weight_meter: &mut WeightMeter,
29742974
) -> DispatchResult {
29752975
if let Some(caller_pid) = caller_pid {
2976-
Self::check_accrue(weight_meter, <T as Config>::WeightInfo::valid_caller_portfolio())?;
2976+
Self::check_accrue(
2977+
weight_meter,
2978+
<T as Config>::WeightInfo::valid_caller_portfolio(),
2979+
)?;
29772980

29782981
T::Portfolio::ensure_portfolio_custody_and_permission(
29792982
caller_pid, caller_did, caller_sk,
@@ -2983,14 +2986,20 @@ impl<T: Config> Pallet<T> {
29832986
}
29842987

29852988
if let Some(venue_id) = venue_id {
2986-
Self::check_accrue(weight_meter, <T as Config>::WeightInfo::valid_caller_venue())?;
2989+
Self::check_accrue(
2990+
weight_meter,
2991+
<T as Config>::WeightInfo::valid_caller_venue(),
2992+
)?;
29872993

29882994
if Self::ensure_venue_creator(&venue_id, &caller_did).is_ok() {
29892995
return Ok(());
29902996
}
29912997
}
29922998

2993-
Self::check_accrue(weight_meter, <T as Config>::WeightInfo::valid_caller_mediator())?;
2999+
Self::check_accrue(
3000+
weight_meter,
3001+
<T as Config>::WeightInfo::valid_caller_mediator(),
3002+
)?;
29943003
if Self::ensure_mediator(&inst_id, &caller_did).is_ok() {
29953004
return Ok(());
29963005
}
@@ -3208,7 +3217,7 @@ impl<T: Config> Pallet<T> {
32083217
weight_meter,
32093218
)
32103219
}
3211-
Leg::NonFungible { sender, receiver, nfts} => {
3220+
Leg::NonFungible { sender, receiver, nfts } => {
32123221
<Nft<T>>::nft_transfer_report(
32133222
&sender,
32143223
&receiver,

pallets/weights/src/pallet_settlement.rs

Lines changed: 30 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,24 +1030,24 @@ impl pallet_settlement::WeightInfo for SubstrateWeight {
10301030
// Storage: Settlement UserAffirmations (r:1 w:0)
10311031
// Proof: Settlement UserAffirmations (max_values: None, max_size: Some(66), added: 2541, mode: MaxEncodedLen)
10321032
fn valid_caller_portfolio() -> Weight {
1033-
// Minimum execution time: 26_005 nanoseconds.
1034-
Weight::from_ref_time(26_467_000).saturating_add(DbWeight::get().reads(2))
1033+
// Minimum execution time: 23_085 nanoseconds.
1034+
Weight::from_ref_time(24_816_000).saturating_add(DbWeight::get().reads(2))
10351035
}
10361036
// Storage: Settlement VenueInfo (r:1 w:0)
10371037
// Proof: Settlement VenueInfo (max_values: None, max_size: Some(49), added: 2524, mode: MaxEncodedLen)
10381038
fn valid_caller_venue() -> Weight {
1039-
// Minimum execution time: 14_417 nanoseconds.
1040-
Weight::from_ref_time(14_605_000).saturating_add(DbWeight::get().reads(1))
1039+
// Minimum execution time: 12_472 nanoseconds.
1040+
Weight::from_ref_time(14_225_000).saturating_add(DbWeight::get().reads(1))
10411041
}
10421042
// Storage: Settlement InstructionMediatorsAffirmations (r:1 w:0)
10431043
// Proof: Settlement InstructionMediatorsAffirmations (max_values: None, max_size: Some(58), added: 2533, mode: MaxEncodedLen)
10441044
fn valid_caller_mediator() -> Weight {
1045-
// Minimum execution time: 17_304 nanoseconds.
1046-
Weight::from_ref_time(17_688_000).saturating_add(DbWeight::get().reads(1))
1045+
// Minimum execution time: 15_279 nanoseconds.
1046+
Weight::from_ref_time(15_612_000).saturating_add(DbWeight::get().reads(1))
10471047
}
10481048
// Storage: Settlement InstructionDetails (r:1 w:1)
10491049
// Proof: Settlement InstructionDetails (max_values: None, max_size: Some(65), added: 2540, mode: MaxEncodedLen)
1050-
// Storage: Settlement InstructionMediatorsAffirmations (r:5 w:4)
1050+
// Storage: Settlement InstructionMediatorsAffirmations (r:444 w:444)
10511051
// Proof: Settlement InstructionMediatorsAffirmations (max_values: None, max_size: Some(58), added: 2533, mode: MaxEncodedLen)
10521052
// Storage: Settlement InstructionLegs (r:0 w:120)
10531053
// Proof Skipped: Settlement InstructionLegs (max_values: None, max_size: None, mode: Measured)
@@ -1063,22 +1063,24 @@ impl pallet_settlement::WeightInfo for SubstrateWeight {
10631063
// Proof: Settlement AffirmsReceived (max_values: None, max_size: Some(66), added: 2541, mode: MaxEncodedLen)
10641064
// Storage: Settlement InstructionLegStatus (r:0 w:120)
10651065
// Proof: Settlement InstructionLegStatus (max_values: None, max_size: Some(73), added: 2548, mode: MaxEncodedLen)
1066-
/// The range of component `f` is `[1, 10]`.
1066+
/// The range of component `f` is `[0, 10]`.
10671067
/// The range of component `n` is `[0, 100]`.
10681068
/// The range of component `o` is `[0, 10]`.
10691069
fn prune_instruction(f: u32, n: u32, o: u32) -> Weight {
1070-
// Minimum execution time: 196_496 nanoseconds.
1071-
Weight::from_ref_time(18_994_606)
1072-
// Standard Error: 179_133
1073-
.saturating_add(Weight::from_ref_time(12_167_762).saturating_mul(f.into()))
1074-
// Standard Error: 16_570
1075-
.saturating_add(Weight::from_ref_time(10_959_904).saturating_mul(n.into()))
1076-
// Standard Error: 162_267
1077-
.saturating_add(Weight::from_ref_time(5_137_386).saturating_mul(o.into()))
1078-
.saturating_add(DbWeight::get().reads(6))
1070+
// Minimum execution time: 236_685 nanoseconds.
1071+
Weight::from_ref_time(15_570_114)
1072+
// Standard Error: 192_325
1073+
.saturating_add(Weight::from_ref_time(15_112_669).saturating_mul(f.into()))
1074+
// Standard Error: 19_641
1075+
.saturating_add(Weight::from_ref_time(15_658_802).saturating_mul(n.into()))
1076+
// Standard Error: 192_325
1077+
.saturating_add(Weight::from_ref_time(5_224_711).saturating_mul(o.into()))
1078+
.saturating_add(DbWeight::get().reads(5))
1079+
.saturating_add(DbWeight::get().reads((4_u64).saturating_mul(f.into())))
1080+
.saturating_add(DbWeight::get().reads((4_u64).saturating_mul(n.into())))
10791081
.saturating_add(DbWeight::get().writes(7))
1080-
.saturating_add(DbWeight::get().writes((6_u64).saturating_mul(f.into())))
1081-
.saturating_add(DbWeight::get().writes((6_u64).saturating_mul(n.into())))
1082+
.saturating_add(DbWeight::get().writes((10_u64).saturating_mul(f.into())))
1083+
.saturating_add(DbWeight::get().writes((10_u64).saturating_mul(n.into())))
10821084
.saturating_add(DbWeight::get().writes((3_u64).saturating_mul(o.into())))
10831085
}
10841086
// Storage: Identity KeyRecords (r:1 w:0)
@@ -1097,18 +1099,18 @@ impl pallet_settlement::WeightInfo for SubstrateWeight {
10971099
// Proof: Portfolio PortfolioLockedAssets (max_values: None, max_size: Some(97), added: 2572, mode: MaxEncodedLen)
10981100
// Storage: Scheduler Lookup (r:1 w:0)
10991101
// Proof: Scheduler Lookup (max_values: None, max_size: Some(48), added: 2523, mode: MaxEncodedLen)
1100-
/// The range of component `f` is `[1, 10]`.
1102+
/// The range of component `f` is `[0, 10]`.
11011103
/// The range of component `n` is `[0, 100]`.
11021104
/// The range of component `o` is `[0, 10]`.
11031105
fn reject_instruction_common(f: u32, n: u32, o: u32) -> Weight {
1104-
// Minimum execution time: 282_870 nanoseconds.
1105-
Weight::from_ref_time(93_122_214)
1106-
// Standard Error: 293_193
1107-
.saturating_add(Weight::from_ref_time(15_347_713).saturating_mul(f.into()))
1108-
// Standard Error: 27_121
1109-
.saturating_add(Weight::from_ref_time(15_307_640).saturating_mul(n.into()))
1110-
// Standard Error: 265_588
1111-
.saturating_add(Weight::from_ref_time(5_795_044).saturating_mul(o.into()))
1106+
// Minimum execution time: 285_164 nanoseconds.
1107+
Weight::from_ref_time(41_970_402)
1108+
// Standard Error: 144_403
1109+
.saturating_add(Weight::from_ref_time(16_977_714).saturating_mul(f.into()))
1110+
// Standard Error: 14_747
1111+
.saturating_add(Weight::from_ref_time(15_564_979).saturating_mul(n.into()))
1112+
// Standard Error: 144_403
1113+
.saturating_add(Weight::from_ref_time(9_071_494).saturating_mul(o.into()))
11121114
.saturating_add(DbWeight::get().reads(5))
11131115
.saturating_add(DbWeight::get().reads((3_u64).saturating_mul(f.into())))
11141116
.saturating_add(DbWeight::get().reads((3_u64).saturating_mul(n.into())))

0 commit comments

Comments
 (0)