Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Updated weights #447

Merged
merged 9 commits into from
Jan 29, 2025
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ jobs:
cache-all-crates: true
key: build

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

- name: Upload runtime to artifacts
uses: actions/upload-artifact@v4
Expand Down
9 changes: 2 additions & 7 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 1 addition & 8 deletions chain-spec-generator/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,13 @@ homepage.workspace = true
license.workspace = true
name = "chain-spec-generator"
repository.workspace = true
version = "0.15.0"
version = "0.15.1"

[dependencies]
clap = { workspace = true, features = ["derive"] }
serde_json.workspace = true
serde = { workspace = true, features = ["derive"] }

kreivo-runtime = { workspace = true, default-features = true }

cumulus-primitives-core.workspace = true
sp-core.workspace = true
sp-runtime.workspace = true
sc-chain-spec.workspace = true
sc-network.workspace = true

[features]
runtime-benchmarks = [
Expand Down
5 changes: 5 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ check: _check_deps
build-local features="":
cargo build --release --features '{{features}}'

build-benchmarks:
cargo build --release --features 'runtime-benchmarks' -p kreivo-runtime

benchmarks:
# TODO: build benchmarks for every pallet that's currently within the runtime as
# a dependency
Expand All @@ -72,6 +75,8 @@ release-artifacts:
cp {{ runtime }} release/
cp *.container release

prerelease-tag count="1":
git tag {{ ver }}-pre.{{count}}
release-tag:
git tag {{ ver }}

Expand Down
2 changes: 1 addition & 1 deletion runtime/kreivo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ homepage.workspace = true
license.workspace = true
name = "kreivo-runtime"
repository.workspace = true
version = "0.15.0"
version = "0.15.1"

[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
Expand Down
1 change: 1 addition & 0 deletions runtime/kreivo/src/benchmarking/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ frame_benchmarking::define_benchmarks!(

// XCM
[cumulus_pallet_xcmp_queue, XcmpQueue]
[pallet_message_queue, MessageQueue]
// NOTE: Make sure you point to the individual modules below.
[pallet_xcm_benchmarks::fungible, XcmBalances]
[pallet_xcm_benchmarks::generic, XcmGeneric]
Expand Down
4 changes: 2 additions & 2 deletions runtime/kreivo/src/config/collator_support.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ impl pallet_collator_selection::Config for Runtime {
type ValidatorId = <Self as frame_system::Config>::AccountId;
type ValidatorIdOf = pallet_collator_selection::IdentityCollator;
type ValidatorRegistration = Session;
type WeightInfo = ();
type WeightInfo = weights::pallet_collator_selection::WeightInfo<Self>;
}

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

// #[runtime::pallet_index(23)]
Expand Down
2 changes: 1 addition & 1 deletion runtime/kreivo/src/config/collective/governance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub type KreivoReferendaInstance = pallet_referenda::Instance1;
impl pallet_referenda::Config<KreivoReferendaInstance> for Runtime {
type RuntimeCall = RuntimeCall;
type RuntimeEvent = RuntimeEvent;
type WeightInfo = pallet_referenda::weights::SubstrateWeight<Self>;
type WeightInfo = weights::pallet_referenda::WeightInfo<Self>;
type Scheduler = Scheduler;
type Currency = Balances;
type SubmitOrigin = EnsureSigned<AccountId>;
Expand Down
8 changes: 4 additions & 4 deletions runtime/kreivo/src/config/communities/governance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,17 @@

#[cfg(feature = "runtime-benchmarks")]
fn try_successful_origin(id: &TrackIdOf<Runtime, CommunityTracksInstance>) -> Result<RuntimeOrigin, ()> {
Ok(pallet_communities::Origin::<Runtime>::new(id.clone()).into())

Check warning on line 35 in runtime/kreivo/src/config/communities/governance.rs

View workflow job for this annotation

GitHub Actions / clippy

using `clone` on type `u16` which implements the `Copy` trait

warning: using `clone` on type `u16` which implements the `Copy` trait --> runtime/kreivo/src/config/communities/governance.rs:35:49 | 35 | Ok(pallet_communities::Origin::<Runtime>::new(id.clone()).into()) | ^^^^^^^^^^ help: try dereferencing it: `*id` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#clone_on_copy = note: `#[warn(clippy::clone_on_copy)]` on by default
}
}

impl pallet_referenda_tracks::Config<CommunityTracksInstance> for Runtime {
type AdminOrigin = EnsureRoot<AccountId>;
type UpdateOrigin = EnsureOriginToTrack;
type RuntimeEvent = RuntimeEvent;
type TrackId = CommunityId;
type MaxTracks = ConstU32<65536>;
type AdminOrigin = EnsureRoot<AccountId>;
type UpdateOrigin = EnsureOriginToTrack;
type WeightInfo = pallet_referenda_tracks::weights::SubstrateWeight<Runtime>;
type WeightInfo = weights::pallet_referenda_tracks::WeightInfo<Self>;

#[cfg(feature = "runtime-benchmarks")]
type BenchmarkHelper = CommunityTracksBenchmarkHelper;
Expand Down Expand Up @@ -90,9 +90,9 @@

// Paritally from https://github.com/polkadot-fellows/runtimes/blob/b5ba0e91d5dd3c4020e848b27be5f2b47e16f281/relay/kusama/src/governance/mod.rs#L75
impl pallet_referenda::Config<CommunityReferendaInstance> for Runtime {
type WeightInfo = pallet_referenda::weights::SubstrateWeight<Runtime>;
type RuntimeCall = RuntimeCall;
type RuntimeEvent = RuntimeEvent;
type WeightInfo = weights::pallet_referenda::WeightInfo<Self>;
type Scheduler = Scheduler;
type Currency = Balances;
type SubmitOrigin = EitherOf<
Expand Down
2 changes: 1 addition & 1 deletion runtime/kreivo/src/config/contracts/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ impl pallet_contracts::Config for Runtime {
type CallFilter = CallFilter;

type WeightPrice = pallet_transaction_payment::Pallet<Self>;
type WeightInfo = pallet_contracts::weights::SubstrateWeight<Self>;
type WeightInfo = weights::pallet_contracts::WeightInfo<Self>;
type ChainExtension = KreivoChainExtensions<Self, Assets>;
type Schedule = Schedule;
type CallStack = [pallet_contracts::Frame<Self>; 23];
Expand Down
6 changes: 3 additions & 3 deletions runtime/kreivo/src/config/currency.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ impl pallet_balances::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type RuntimeHoldReason = RuntimeHoldReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type WeightInfo = pallet_balances::weights::SubstrateWeight<Runtime>;
type WeightInfo = weights::pallet_balances::WeightInfo<Self>;
/// The type for recording an account's balance.
type Balance = Balance;
type DustRemoval = ();
Expand Down Expand Up @@ -109,7 +109,7 @@ impl pallet_assets::Config<KreivoAssetsInstance> for Runtime {
type Freezer = AssetsFreezer;
type Extra = ();
type CallbackHandle = ();
type WeightInfo = weights::pallet_assets::WeightInfo<Runtime>;
type WeightInfo = weights::pallet_assets::WeightInfo<Self>;
#[cfg(feature = "runtime-benchmarks")]
type BenchmarkHelper = ();
}
Expand Down Expand Up @@ -138,7 +138,7 @@ impl pallet_vesting::Config for Runtime {
type Currency = Balances;
type BlockNumberToBalance = ConvertInto;
type MinVestedTransfer = MinVestedTransfer;
type WeightInfo = pallet_vesting::weights::SubstrateWeight<Runtime>;
type WeightInfo = weights::pallet_vesting::WeightInfo<Self>;
type UnvestedFundsAllowedWithdrawReasons = UnvestedFundsAllowedWithdrawReasons;
type BlockNumberProvider = System;
const MAX_VESTING_SCHEDULES: u32 = 28;
Expand Down
2 changes: 1 addition & 1 deletion runtime/kreivo/src/config/governance/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ impl pallet_treasury::Config for Runtime {
type Burn = ();
type PalletId = TreasuryPalletId;
type BurnDestination = ();
type WeightInfo = pallet_treasury::weights::SubstrateWeight<Runtime>;
type WeightInfo = weights::pallet_treasury::WeightInfo<Self>;
type SpendFunds = ();
type MaxApprovals = MaxApprovals;
type SpendOrigin = frame_support::traits::NeverEnsureOrigin<Balance>;
Expand Down
7 changes: 4 additions & 3 deletions runtime/kreivo/src/config/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ impl frame_system::Config for Runtime {
/// The action to take on a Runtime Upgrade
type OnSetCode = cumulus_pallet_parachain_system::ParachainSetCode<Self>;
type MaxConsumers = frame_support::traits::ConstU32<16>;
type SystemWeightInfo = weights::frame_system::WeightInfo<Self>;
}

// #[runtime::pallet_index(1)]
Expand All @@ -114,7 +115,7 @@ impl cumulus_pallet_parachain_system::Config for Runtime {
type XcmpMessageHandler = XcmpQueue;
type ReservedXcmpWeight = ReservedXcmpWeight;
type CheckAssociatedRelayNumber = RelayNumberMonotonicallyIncreases;
type WeightInfo = ();
type WeightInfo = weights::cumulus_pallet_parachain_system::WeightInfo<Self>;
type ConsensusHook = ConsensusHook;
}

Expand All @@ -125,7 +126,7 @@ impl pallet_timestamp::Config for Runtime {
type Moment = u64;
type OnTimestampSet = Aura;
type MinimumPeriod = ConstU64<0>;
type WeightInfo = ();
type WeightInfo = weights::pallet_timestamp::WeightInfo<Self>;
}

// #[runtime::pallet_index(3)]
Expand Down Expand Up @@ -214,7 +215,7 @@ impl pallet_pass::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type RuntimeCall = RuntimeCall;
type Currency = Balances;
type WeightInfo = pallet_pass::SubstrateWeight<Self>;
type WeightInfo = weights::pallet_pass::WeightInfo<Self>;
type Authenticator = PassAuthenticator; // WebAuthn;
type PalletsOrigin = OriginCaller;
type PalletId = PassPalletId;
Expand Down
10 changes: 5 additions & 5 deletions runtime/kreivo/src/config/utilities.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ impl pallet_multisig::Config for Runtime {
type DepositBase = DepositBase;
type DepositFactor = DepositFactor;
type MaxSignatories = ConstU32<100>;
type WeightInfo = pallet_multisig::weights::SubstrateWeight<Runtime>;
type WeightInfo = weights::pallet_multisig::WeightInfo<Self>;
}

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

// #[runtime::pallet_index(44)]
Expand All @@ -53,7 +53,7 @@ impl pallet_proxy::Config for Runtime {
type ProxyDepositBase = ProxyDepositBase;
type ProxyDepositFactor = ProxyDepositFactor;
type MaxProxies = MaxProxies;
type WeightInfo = weights::pallet_proxy::WeightInfo<Runtime>;
type WeightInfo = weights::pallet_proxy::WeightInfo<Self>;
type MaxPending = MaxPending;
type CallHasher = BlakeTwo256;
type AnnouncementDepositBase = AnnouncementDepositBase;
Expand Down Expand Up @@ -85,7 +85,7 @@ impl pallet_scheduler::Config for Runtime {
type ScheduleOrigin = EnsureRoot<AccountId>;
type OriginPrivilegeCmp = EqualOrGreatestRootCmp;
type MaxScheduledPerBlock = MaxScheduledPerBlock;
type WeightInfo = pallet_scheduler::weights::SubstrateWeight<Runtime>;
type WeightInfo = weights::pallet_scheduler::WeightInfo<Self>;
type Preimages = Preimage;
}

Expand All @@ -99,7 +99,7 @@ parameter_types! {

impl pallet_preimage::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type WeightInfo = pallet_preimage::weights::SubstrateWeight<Runtime>;
type WeightInfo = weights::pallet_preimage::WeightInfo<Self>;
type Currency = Balances;
type ManagerOrigin = EnsureRoot<AccountId>;
type Consideration = HoldConsideration<
Expand Down
5 changes: 2 additions & 3 deletions runtime/kreivo/src/config/xcm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ impl cumulus_pallet_xcmp_queue::Config for Runtime {
type ControllerOrigin = EnsureRoot<AccountId>;
type ControllerOriginConverter = XcmOriginToTransactDispatchOrigin;
type PriceForSiblingDelivery = NoPriceForMessageDelivery<ParaId>;
type WeightInfo = ();
type WeightInfo = weights::cumulus_pallet_xcmp_queue::WeightInfo<Self>;
}

// #[runtime::pallet_index(33)]
Expand All @@ -42,8 +42,7 @@ impl pallet_message_queue::Config for Runtime {
RuntimeCall,
>;
#[cfg(feature = "runtime-benchmarks")]
type MessageProcessor =
pallet_message_queue::mock_helpers::NoopMessageProcessor<cumulus_primitives_core::AggregateMessageOrigin>;
type MessageProcessor = pallet_message_queue::mock_helpers::NoopMessageProcessor<AggregateMessageOrigin>;
type Size = u32;
// The XCMP queue pallet is only ever able to handle the `Sibling(ParaId)`
// origin:
Expand Down
2 changes: 1 addition & 1 deletion runtime/kreivo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
spec_name: create_runtime_str!("kreivo-parachain"),
impl_name: create_runtime_str!("kreivo-parachain"),
authoring_version: 1,
spec_version: 115,
spec_version: 116,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 10,
Expand Down
63 changes: 63 additions & 0 deletions runtime/kreivo/src/weights/cumulus_pallet_parachain_system.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@

//! Autogenerated weights for `cumulus_pallet_parachain_system`
//!
//! THIS FILE WAS AUTO-GENERATED USING THE SUBSTRATE BENCHMARK CLI VERSION 45.0.0
//! DATE: 2025-01-26, STEPS: `50`, REPEAT: `20`, LOW RANGE: `[]`, HIGH RANGE: `[]`
//! WORST CASE MAP SIZE: `1000000`
//! HOSTNAME: `virto-us3`, CPU: `Intel(R) Xeon(R) Silver 4216 CPU @ 2.10GHz`
//! WASM-EXECUTION: `Compiled`, CHAIN: `None`, DB CACHE: 1024

// Executed Command:
// /home/devops/.cargo/bin/frame-omni-bencher
// v1
// benchmark
// pallet
// --runtime
// target/release/wbuild/kreivo-runtime/kreivo_runtime.compact.compressed.wasm
// --pallet
// cumulus_pallet_parachain_system
// --extrinsic
// *
// --steps
// 50
// --repeat
// 20
// --output
// ./runtime/kreivo/src/weights/

#![cfg_attr(rustfmt, rustfmt_skip)]
#![allow(unused_parens)]
#![allow(unused_imports)]
#![allow(missing_docs)]

use frame_support::{traits::Get, weights::Weight};
use core::marker::PhantomData;

/// Weight functions for `cumulus_pallet_parachain_system`.
pub struct WeightInfo<T>(PhantomData<T>);
impl<T: frame_system::Config> cumulus_pallet_parachain_system::WeightInfo for WeightInfo<T> {
/// Storage: `ParachainSystem::LastDmqMqcHead` (r:1 w:1)
/// Proof: `ParachainSystem::LastDmqMqcHead` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `MessageQueue::BookStateFor` (r:1 w:1)
/// Proof: `MessageQueue::BookStateFor` (`max_values`: None, `max_size`: Some(52), added: 2527, mode: `MaxEncodedLen`)
/// Storage: `MessageQueue::ServiceHead` (r:1 w:1)
/// Proof: `MessageQueue::ServiceHead` (`max_values`: Some(1), `max_size`: Some(5), added: 500, mode: `MaxEncodedLen`)
/// Storage: `ParachainSystem::ProcessedDownwardMessages` (r:0 w:1)
/// Proof: `ParachainSystem::ProcessedDownwardMessages` (`max_values`: Some(1), `max_size`: None, mode: `Measured`)
/// Storage: `MessageQueue::Pages` (r:0 w:1000)
/// Proof: `MessageQueue::Pages` (`max_values`: None, `max_size`: Some(65585), added: 68060, mode: `MaxEncodedLen`)
/// The range of component `n` is `[0, 1000]`.
fn enqueue_inbound_downward_messages(n: u32, ) -> Weight {
// Proof Size summary in bytes:
// Measured: `152`
// Estimated: `3517`
// Minimum execution time: 10_901_000 picoseconds.
Weight::from_parts(11_282_000, 0)
.saturating_add(Weight::from_parts(0, 3517))
// Standard Error: 682_622
.saturating_add(Weight::from_parts(411_319_777, 0).saturating_mul(n.into()))
.saturating_add(T::DbWeight::get().reads(3))
.saturating_add(T::DbWeight::get().writes(4))
.saturating_add(T::DbWeight::get().writes((1_u64).saturating_mul(n.into())))
}
}
Loading
Loading