Skip to content

Commit 708026f

Browse files
olanodpandres95Virto Benchmarking Machine
authored
feat: Updated weights (#447)
* Manually run benchmark on reference machine to update weights * feat(kreivo-runtime): set new weights in pallet configs * Manually run benchmark on reference machine to update weights * chore(kreivo-runtime): insert weights for frame-system and pallet-contracts * fix(kreivo-runtime): missing references to weights in pallet configs * fix(kreivo-runtime): version bump and fix release command to include specific features --------- Co-authored-by: Pablo Andrés Dorado Suárez <hola@pablodorado.com> Co-authored-by: Virto Benchmarking Machine <devops@us3.virto.one>
1 parent 6e3c040 commit 708026f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+4814
-746
lines changed

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ jobs:
3030
cache-all-crates: true
3131
key: build
3232

33-
- name: Release build with runtime-benchmarks
33+
- name: Production build
3434
uses: actions-rs/cargo@v1
3535
with:
3636
command: build
37-
args: --profile production --locked -p kreivo-runtime
37+
args: --profile production --features ${{ contains(github.ref, '-pre') && 'paseo' || 'try-runtime' }} --locked -p kreivo-runtime
3838

3939
- name: Upload runtime to artifacts
4040
uses: actions/upload-artifact@v4

Cargo.lock

Lines changed: 2 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

chain-spec-generator/Cargo.toml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,13 @@ homepage.workspace = true
66
license.workspace = true
77
name = "chain-spec-generator"
88
repository.workspace = true
9-
version = "0.15.0"
9+
version = "0.15.1"
1010

1111
[dependencies]
1212
clap = { workspace = true, features = ["derive"] }
13-
serde_json.workspace = true
1413
serde = { workspace = true, features = ["derive"] }
15-
1614
kreivo-runtime = { workspace = true, default-features = true }
17-
18-
cumulus-primitives-core.workspace = true
19-
sp-core.workspace = true
20-
sp-runtime.workspace = true
2115
sc-chain-spec.workspace = true
22-
sc-network.workspace = true
2316

2417
[features]
2518
runtime-benchmarks = [

justfile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ check: _check_deps
4646
build-local features="":
4747
cargo build --release --features '{{features}}'
4848

49+
build-benchmarks:
50+
cargo build --release --features 'runtime-benchmarks' -p kreivo-runtime
51+
4952
benchmarks:
5053
# TODO: build benchmarks for every pallet that's currently within the runtime as
5154
# a dependency
@@ -72,6 +75,8 @@ release-artifacts:
7275
cp {{ runtime }} release/
7376
cp *.container release
7477

78+
prerelease-tag count="1":
79+
git tag {{ ver }}-pre.{{count}}
7580
release-tag:
7681
git tag {{ ver }}
7782

runtime/kreivo/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ homepage.workspace = true
66
license.workspace = true
77
name = "kreivo-runtime"
88
repository.workspace = true
9-
version = "0.15.0"
9+
version = "0.15.1"
1010

1111
[package.metadata.docs.rs]
1212
targets = ["x86_64-unknown-linux-gnu"]

runtime/kreivo/src/benchmarking/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ frame_benchmarking::define_benchmarks!(
2828

2929
// XCM
3030
[cumulus_pallet_xcmp_queue, XcmpQueue]
31+
[pallet_message_queue, MessageQueue]
3132
// NOTE: Make sure you point to the individual modules below.
3233
[pallet_xcm_benchmarks::fungible, XcmBalances]
3334
[pallet_xcm_benchmarks::generic, XcmGeneric]

runtime/kreivo/src/config/collator_support.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ impl pallet_collator_selection::Config for Runtime {
3939
type ValidatorId = <Self as frame_system::Config>::AccountId;
4040
type ValidatorIdOf = pallet_collator_selection::IdentityCollator;
4141
type ValidatorRegistration = Session;
42-
type WeightInfo = ();
42+
type WeightInfo = weights::pallet_collator_selection::WeightInfo<Self>;
4343
}
4444

4545
// #[runtime::pallet_index(22)]
@@ -60,7 +60,7 @@ impl pallet_session::Config for Runtime {
6060
// Essentially just Aura, but let's be pedantic.
6161
type SessionHandler = <SessionKeys as sp_runtime::traits::OpaqueKeys>::KeyTypeIdProviders;
6262
type Keys = SessionKeys;
63-
type WeightInfo = ();
63+
type WeightInfo = weights::pallet_session::WeightInfo<Self>;
6464
}
6565

6666
// #[runtime::pallet_index(23)]

runtime/kreivo/src/config/collective/governance.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ pub type KreivoReferendaInstance = pallet_referenda::Instance1;
99
impl pallet_referenda::Config<KreivoReferendaInstance> for Runtime {
1010
type RuntimeCall = RuntimeCall;
1111
type RuntimeEvent = RuntimeEvent;
12-
type WeightInfo = pallet_referenda::weights::SubstrateWeight<Self>;
12+
type WeightInfo = weights::pallet_referenda::WeightInfo<Self>;
1313
type Scheduler = Scheduler;
1414
type Currency = Balances;
1515
type SubmitOrigin = EnsureSigned<AccountId>;

runtime/kreivo/src/config/communities/governance.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,12 @@ impl EnsureOriginWithArg<RuntimeOrigin, TrackIdOf<Runtime, CommunityTracksInstan
3737
}
3838

3939
impl pallet_referenda_tracks::Config<CommunityTracksInstance> for Runtime {
40+
type AdminOrigin = EnsureRoot<AccountId>;
41+
type UpdateOrigin = EnsureOriginToTrack;
4042
type RuntimeEvent = RuntimeEvent;
4143
type TrackId = CommunityId;
4244
type MaxTracks = ConstU32<65536>;
43-
type AdminOrigin = EnsureRoot<AccountId>;
44-
type UpdateOrigin = EnsureOriginToTrack;
45-
type WeightInfo = pallet_referenda_tracks::weights::SubstrateWeight<Runtime>;
45+
type WeightInfo = weights::pallet_referenda_tracks::WeightInfo<Self>;
4646

4747
#[cfg(feature = "runtime-benchmarks")]
4848
type BenchmarkHelper = CommunityTracksBenchmarkHelper;
@@ -90,9 +90,9 @@ where
9090

9191
// Paritally from https://github.com/polkadot-fellows/runtimes/blob/b5ba0e91d5dd3c4020e848b27be5f2b47e16f281/relay/kusama/src/governance/mod.rs#L75
9292
impl pallet_referenda::Config<CommunityReferendaInstance> for Runtime {
93-
type WeightInfo = pallet_referenda::weights::SubstrateWeight<Runtime>;
9493
type RuntimeCall = RuntimeCall;
9594
type RuntimeEvent = RuntimeEvent;
95+
type WeightInfo = weights::pallet_referenda::WeightInfo<Self>;
9696
type Scheduler = Scheduler;
9797
type Currency = Balances;
9898
type SubmitOrigin = EitherOf<

runtime/kreivo/src/config/contracts/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ impl pallet_contracts::Config for Runtime {
7777
type CallFilter = CallFilter;
7878

7979
type WeightPrice = pallet_transaction_payment::Pallet<Self>;
80-
type WeightInfo = pallet_contracts::weights::SubstrateWeight<Self>;
80+
type WeightInfo = weights::pallet_contracts::WeightInfo<Self>;
8181
type ChainExtension = KreivoChainExtensions<Self, Assets>;
8282
type Schedule = Schedule;
8383
type CallStack = [pallet_contracts::Frame<Self>; 23];

runtime/kreivo/src/config/currency.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ impl pallet_balances::Config for Runtime {
3131
type RuntimeEvent = RuntimeEvent;
3232
type RuntimeHoldReason = RuntimeHoldReason;
3333
type RuntimeFreezeReason = RuntimeFreezeReason;
34-
type WeightInfo = pallet_balances::weights::SubstrateWeight<Runtime>;
34+
type WeightInfo = weights::pallet_balances::WeightInfo<Self>;
3535
/// The type for recording an account's balance.
3636
type Balance = Balance;
3737
type DustRemoval = ();
@@ -109,7 +109,7 @@ impl pallet_assets::Config<KreivoAssetsInstance> for Runtime {
109109
type Freezer = AssetsFreezer;
110110
type Extra = ();
111111
type CallbackHandle = ();
112-
type WeightInfo = weights::pallet_assets::WeightInfo<Runtime>;
112+
type WeightInfo = weights::pallet_assets::WeightInfo<Self>;
113113
#[cfg(feature = "runtime-benchmarks")]
114114
type BenchmarkHelper = ();
115115
}
@@ -138,7 +138,7 @@ impl pallet_vesting::Config for Runtime {
138138
type Currency = Balances;
139139
type BlockNumberToBalance = ConvertInto;
140140
type MinVestedTransfer = MinVestedTransfer;
141-
type WeightInfo = pallet_vesting::weights::SubstrateWeight<Runtime>;
141+
type WeightInfo = weights::pallet_vesting::WeightInfo<Self>;
142142
type UnvestedFundsAllowedWithdrawReasons = UnvestedFundsAllowedWithdrawReasons;
143143
type BlockNumberProvider = System;
144144
const MAX_VESTING_SCHEDULES: u32 = 28;

runtime/kreivo/src/config/governance/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ impl pallet_treasury::Config for Runtime {
3838
type Burn = ();
3939
type PalletId = TreasuryPalletId;
4040
type BurnDestination = ();
41-
type WeightInfo = pallet_treasury::weights::SubstrateWeight<Runtime>;
41+
type WeightInfo = weights::pallet_treasury::WeightInfo<Self>;
4242
type SpendFunds = ();
4343
type MaxApprovals = MaxApprovals;
4444
type SpendOrigin = frame_support::traits::NeverEnsureOrigin<Balance>;

runtime/kreivo/src/config/system.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ impl frame_system::Config for Runtime {
9494
/// The action to take on a Runtime Upgrade
9595
type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode<Self>;
9696
type MaxConsumers = frame_support::traits::ConstU32<16>;
97+
type SystemWeightInfo = weights::frame_system::WeightInfo<Self>;
9798
}
9899

99100
// #[runtime::pallet_index(1)]
@@ -114,7 +115,7 @@ impl cumulus_pallet_parachain_system::Config for Runtime {
114115
type XcmpMessageHandler = XcmpQueue;
115116
type ReservedXcmpWeight = ReservedXcmpWeight;
116117
type CheckAssociatedRelayNumber = RelayNumberMonotonicallyIncreases;
117-
type WeightInfo = ();
118+
type WeightInfo = weights::cumulus_pallet_parachain_system::WeightInfo<Self>;
118119
type ConsensusHook = ConsensusHook;
119120
}
120121

@@ -125,7 +126,7 @@ impl pallet_timestamp::Config for Runtime {
125126
type Moment = u64;
126127
type OnTimestampSet = Aura;
127128
type MinimumPeriod = ConstU64<0>;
128-
type WeightInfo = ();
129+
type WeightInfo = weights::pallet_timestamp::WeightInfo<Self>;
129130
}
130131

131132
// #[runtime::pallet_index(3)]
@@ -214,7 +215,7 @@ impl pallet_pass::Config for Runtime {
214215
type RuntimeEvent = RuntimeEvent;
215216
type RuntimeCall = RuntimeCall;
216217
type Currency = Balances;
217-
type WeightInfo = pallet_pass::SubstrateWeight<Self>;
218+
type WeightInfo = weights::pallet_pass::WeightInfo<Self>;
218219
type Authenticator = PassAuthenticator; // WebAuthn;
219220
type PalletsOrigin = OriginCaller;
220221
type PalletId = PassPalletId;

runtime/kreivo/src/config/utilities.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ impl pallet_multisig::Config for Runtime {
1919
type DepositBase = DepositBase;
2020
type DepositFactor = DepositFactor;
2121
type MaxSignatories = ConstU32<100>;
22-
type WeightInfo = pallet_multisig::weights::SubstrateWeight<Runtime>;
22+
type WeightInfo = weights::pallet_multisig::WeightInfo<Self>;
2323
}
2424

2525
// #[runtime::pallet_index(43)]
@@ -28,7 +28,7 @@ impl pallet_utility::Config for Runtime {
2828
type RuntimeEvent = RuntimeEvent;
2929
type RuntimeCall = RuntimeCall;
3030
type PalletsOrigin = OriginCaller;
31-
type WeightInfo = pallet_utility::weights::SubstrateWeight<Runtime>;
31+
type WeightInfo = weights::pallet_utility::WeightInfo<Self>;
3232
}
3333

3434
// #[runtime::pallet_index(44)]
@@ -53,7 +53,7 @@ impl pallet_proxy::Config for Runtime {
5353
type ProxyDepositBase = ProxyDepositBase;
5454
type ProxyDepositFactor = ProxyDepositFactor;
5555
type MaxProxies = MaxProxies;
56-
type WeightInfo = weights::pallet_proxy::WeightInfo<Runtime>;
56+
type WeightInfo = weights::pallet_proxy::WeightInfo<Self>;
5757
type MaxPending = MaxPending;
5858
type CallHasher = BlakeTwo256;
5959
type AnnouncementDepositBase = AnnouncementDepositBase;
@@ -85,7 +85,7 @@ impl pallet_scheduler::Config for Runtime {
8585
type ScheduleOrigin = EnsureRoot<AccountId>;
8686
type OriginPrivilegeCmp = EqualOrGreatestRootCmp;
8787
type MaxScheduledPerBlock = MaxScheduledPerBlock;
88-
type WeightInfo = pallet_scheduler::weights::SubstrateWeight<Runtime>;
88+
type WeightInfo = weights::pallet_scheduler::WeightInfo<Self>;
8989
type Preimages = Preimage;
9090
}
9191

@@ -99,7 +99,7 @@ parameter_types! {
9999

100100
impl pallet_preimage::Config for Runtime {
101101
type RuntimeEvent = RuntimeEvent;
102-
type WeightInfo = pallet_preimage::weights::SubstrateWeight<Runtime>;
102+
type WeightInfo = weights::pallet_preimage::WeightInfo<Self>;
103103
type Currency = Balances;
104104
type ManagerOrigin = EnsureRoot<AccountId>;
105105
type Consideration = HoldConsideration<

runtime/kreivo/src/config/xcm.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime {
2323
type ControllerOrigin = EnsureRoot<AccountId>;
2424
type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin;
2525
type PriceForSiblingDelivery = NoPriceForMessageDelivery<ParaId>;
26-
type WeightInfo = ();
26+
type WeightInfo = weights::cumulus_pallet_xcmp_queue::WeightInfo<Self>;
2727
}
2828

2929
// #[runtime::pallet_index(33)]
@@ -42,8 +42,7 @@ impl pallet_message_queue::Config for Runtime {
4242
RuntimeCall,
4343
>;
4444
#[cfg(feature = "runtime-benchmarks")]
45-
type MessageProcessor =
46-
pallet_message_queue::mock_helpers::NoopMessageProcessor<cumulus_primitives_core::AggregateMessageOrigin>;
45+
type MessageProcessor = pallet_message_queue::mock_helpers::NoopMessageProcessor<AggregateMessageOrigin>;
4746
type Size = u32;
4847
// The XCMP queue pallet is only ever able to handle the `Sibling(ParaId)`
4948
// origin:

runtime/kreivo/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
126126
spec_name: create_runtime_str!("kreivo-parachain"),
127127
impl_name: create_runtime_str!("kreivo-parachain"),
128128
authoring_version: 1,
129-
spec_version: 115,
129+
spec_version: 116,
130130
impl_version: 0,
131131
apis: RUNTIME_API_VERSIONS,
132132
transaction_version: 10,
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
2+
//! Autogenerated weights for `cumulus_pallet_parachain_system`
3+
//!
4+
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 45.0.0
5+
//! DATE: 2025-01-26, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
6+
//! WORST CASE MAP SIZE: `1000000`
7+
//! HOSTNAME: `virto-us3`, CPU: `Intel(R) Xeon(R) Silver 4216 CPU @ 2.10GHz`
8+
//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024
9+
10+
// Executed Command:
11+
// /home/devops/.cargo/bin/frame-omni-bencher
12+
// v1
13+
// benchmark
14+
// pallet
15+
// --runtime
16+
// target/release/wbuild/kreivo-runtime/kreivo_runtime.compact.compressed.wasm
17+
// --pallet
18+
// cumulus_pallet_parachain_system
19+
// --extrinsic
20+
// *
21+
// --steps
22+
// 50
23+
// --repeat
24+
// 20
25+
// --output
26+
// ./runtime/kreivo/src/weights/
27+
28+
#![cfg_attr(rustfmt, rustfmt_skip)]
29+
#![allow(unused_parens)]
30+
#![allow(unused_imports)]
31+
#![allow(missing_docs)]
32+
33+
use frame_support::{traits::Get, weights::Weight};
34+
use core::marker::PhantomData;
35+
36+
/// Weight functions for `cumulus_pallet_parachain_system`.
37+
pub struct WeightInfo<T>(PhantomData<T>);
38+
impl<T: frame_system::Config> cumulus_pallet_parachain_system::WeightInfo for WeightInfo<T> {
39+
/// Storage: `ParachainSystem::LastDmqMqcHead` (r:1 w:1)
40+
/// Proof: `ParachainSystem::LastDmqMqcHead` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
41+
/// Storage: `MessageQueue::BookStateFor` (r:1 w:1)
42+
/// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`)
43+
/// Storage: `MessageQueue::ServiceHead` (r:1 w:1)
44+
/// Proof: `MessageQueue::ServiceHead` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `MaxEncodedLen`)
45+
/// Storage: `ParachainSystem::ProcessedDownwardMessages` (r:0 w:1)
46+
/// Proof: `ParachainSystem::ProcessedDownwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
47+
/// Storage: `MessageQueue::Pages` (r:0 w:1000)
48+
/// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(65585), added: 68060, mode: `MaxEncodedLen`)
49+
/// The range of component `n` is `[0, 1000]`.
50+
fn enqueue_inbound_downward_messages(n: u32, ) -> Weight {
51+
// Proof Size summary in bytes:
52+
// Measured: `152`
53+
// Estimated: `3517`
54+
// Minimum execution time: 10_901_000 picoseconds.
55+
Weight::from_parts(11_282_000, 0)
56+
.saturating_add(Weight::from_parts(0, 3517))
57+
// Standard Error: 682_622
58+
.saturating_add(Weight::from_parts(411_319_777, 0).saturating_mul(n.into()))
59+
.saturating_add(T::DbWeight::get().reads(3))
60+
.saturating_add(T::DbWeight::get().writes(4))
61+
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into())))
62+
}
63+
}

0 commit comments

Comments
 (0)