From bd99fb7c4e9b96bec47e65e2518f0b7dde8fe926 Mon Sep 17 00:00:00 2001 From: Gonza Montiel Date: Fri, 5 Dec 2025 14:22:52 +0100 Subject: [PATCH] fix: pallet collective weights aliases (#337) We have two instances of `pallet_collective` - `pallet_collective_treasury_council` - `pallet_collective_technical_committee` Our weights template automatically generates an implementation for `pallet_collective_treasury_council::WeightInfo` or `pallet_collective_technical_committee::WeightInfo`, which don't exist, making the compilation fail right after running benches. I created aliases for both pallet names, and added a small tweak to the template so it does not break anymore. --------- Co-authored-by: Steve Degosserie <723552+stiiifff@users.noreply.github.com> --- operator/benchmarking/frame-weight-template.hbs | 1 + operator/runtime/mainnet/src/benchmarks.rs | 6 ------ operator/runtime/mainnet/src/lib.rs | 7 ++++++- .../src/weights/pallet_collective_technical_committee.rs | 3 ++- .../src/weights/pallet_collective_treasury_council.rs | 3 ++- operator/runtime/stagenet/src/benchmarks.rs | 6 ------ operator/runtime/stagenet/src/lib.rs | 7 ++++++- .../src/weights/pallet_collective_technical_committee.rs | 3 ++- .../src/weights/pallet_collective_treasury_council.rs | 3 ++- operator/runtime/testnet/src/benchmarks.rs | 7 ------- operator/runtime/testnet/src/lib.rs | 6 ++++++ .../src/weights/pallet_collective_technical_committee.rs | 3 ++- .../src/weights/pallet_collective_treasury_council.rs | 3 ++- 13 files changed, 31 insertions(+), 27 deletions(-) diff --git a/operator/benchmarking/frame-weight-template.hbs b/operator/benchmarking/frame-weight-template.hbs index 9fcc72c5..f9508559 100644 --- a/operator/benchmarking/frame-weight-template.hbs +++ b/operator/benchmarking/frame-weight-template.hbs @@ -19,6 +19,7 @@ use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; use sp_std::marker::PhantomData; +use crate::{{pallet}}; /// Weights for `{{pallet}}`. pub struct WeightInfo(PhantomData); diff --git a/operator/runtime/mainnet/src/benchmarks.rs b/operator/runtime/mainnet/src/benchmarks.rs index b52c1de5..48090e38 100644 --- a/operator/runtime/mainnet/src/benchmarks.rs +++ b/operator/runtime/mainnet/src/benchmarks.rs @@ -14,12 +14,6 @@ // You should have received a copy of the GNU General Public License // along with DataHaven. If not, see . -// TODO: Temporary workaround before upgrading to latest polkadot-sdk - fix https://github.com/paritytech/polkadot-sdk/pull/6435 -#[allow(unused_imports)] -use pallet_collective as pallet_collective_treasury_council; -#[allow(unused_imports)] -use pallet_collective as pallet_collective_technical_committee; - frame_benchmarking::define_benchmarks!( // System benchmarks [frame_system, SystemBench::] diff --git a/operator/runtime/mainnet/src/lib.rs b/operator/runtime/mainnet/src/lib.rs index 3c8c985e..306bc118 100644 --- a/operator/runtime/mainnet/src/lib.rs +++ b/operator/runtime/mainnet/src/lib.rs @@ -27,11 +27,16 @@ mod benchmarks; pub mod configs; pub mod precompiles; pub mod weights; - // Re-export governance for tests pub use configs::governance; pub use configs::Precompiles; +// TODO: Temporary workaround before upgrading to latest polkadot-sdk - fix https://github.com/paritytech/polkadot-sdk/pull/6435 +#[allow(unused_imports)] +use pallet_collective as pallet_collective_treasury_council; +#[allow(unused_imports)] +use pallet_collective as pallet_collective_technical_committee; + use alloc::{borrow::Cow, vec::Vec}; use codec::Encode; use fp_rpc::TransactionStatus; diff --git a/operator/runtime/mainnet/src/weights/pallet_collective_technical_committee.rs b/operator/runtime/mainnet/src/weights/pallet_collective_technical_committee.rs index 67097727..597821a2 100644 --- a/operator/runtime/mainnet/src/weights/pallet_collective_technical_committee.rs +++ b/operator/runtime/mainnet/src/weights/pallet_collective_technical_committee.rs @@ -51,10 +51,11 @@ use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; use sp_std::marker::PhantomData; +use crate::pallet_collective_technical_committee; /// Weights for `pallet_collective_technical_committee`. pub struct WeightInfo(PhantomData); -impl pallet_collective::WeightInfo for WeightInfo { +impl pallet_collective_technical_committee::WeightInfo for WeightInfo { /// Storage: `TechnicalCommittee::Members` (r:1 w:1) /// Proof: `TechnicalCommittee::Members` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `TechnicalCommittee::Proposals` (r:1 w:0) diff --git a/operator/runtime/mainnet/src/weights/pallet_collective_treasury_council.rs b/operator/runtime/mainnet/src/weights/pallet_collective_treasury_council.rs index 3413be1f..7044db0e 100644 --- a/operator/runtime/mainnet/src/weights/pallet_collective_treasury_council.rs +++ b/operator/runtime/mainnet/src/weights/pallet_collective_treasury_council.rs @@ -51,10 +51,11 @@ use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; use sp_std::marker::PhantomData; +use crate::pallet_collective_treasury_council; /// Weights for `pallet_collective_treasury_council`. pub struct WeightInfo(PhantomData); -impl pallet_collective::WeightInfo for WeightInfo { +impl pallet_collective_treasury_council::WeightInfo for WeightInfo { /// Storage: `TreasuryCouncil::Members` (r:1 w:1) /// Proof: `TreasuryCouncil::Members` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `TreasuryCouncil::Proposals` (r:1 w:0) diff --git a/operator/runtime/stagenet/src/benchmarks.rs b/operator/runtime/stagenet/src/benchmarks.rs index 45ea70b5..51f38f33 100644 --- a/operator/runtime/stagenet/src/benchmarks.rs +++ b/operator/runtime/stagenet/src/benchmarks.rs @@ -14,12 +14,6 @@ // You should have received a copy of the GNU General Public License // along with DataHaven. If not, see . -// TODO: Temporary workaround before upgrading to latest polkadot-sdk - fix https://github.com/paritytech/polkadot-sdk/pull/6435 -#[allow(unused_imports)] -use pallet_collective as pallet_collective_treasury_council; -#[allow(unused_imports)] -use pallet_collective as pallet_collective_technical_committee; - frame_benchmarking::define_benchmarks!( // System benchmarks [frame_system, SystemBench::] diff --git a/operator/runtime/stagenet/src/lib.rs b/operator/runtime/stagenet/src/lib.rs index de3e15f4..8c5f37d8 100644 --- a/operator/runtime/stagenet/src/lib.rs +++ b/operator/runtime/stagenet/src/lib.rs @@ -27,11 +27,16 @@ mod benchmarks; pub mod configs; pub mod precompiles; pub mod weights; - // Re-export governance for tests pub use configs::governance; pub use configs::Precompiles; +// TODO: Temporary workaround before upgrading to latest polkadot-sdk - fix https://github.com/paritytech/polkadot-sdk/pull/6435 +#[allow(unused_imports)] +use pallet_collective as pallet_collective_treasury_council; +#[allow(unused_imports)] +use pallet_collective as pallet_collective_technical_committee; + use alloc::{borrow::Cow, vec::Vec}; use codec::Encode; use fp_rpc::TransactionStatus; diff --git a/operator/runtime/stagenet/src/weights/pallet_collective_technical_committee.rs b/operator/runtime/stagenet/src/weights/pallet_collective_technical_committee.rs index ec26aa36..f8267195 100644 --- a/operator/runtime/stagenet/src/weights/pallet_collective_technical_committee.rs +++ b/operator/runtime/stagenet/src/weights/pallet_collective_technical_committee.rs @@ -51,10 +51,11 @@ use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; use sp_std::marker::PhantomData; +use crate::pallet_collective_technical_committee; /// Weights for `pallet_collective_technical_committee`. pub struct WeightInfo(PhantomData); -impl pallet_collective::WeightInfo for WeightInfo { +impl pallet_collective_technical_committee::WeightInfo for WeightInfo { /// Storage: `TechnicalCommittee::Members` (r:1 w:1) /// Proof: `TechnicalCommittee::Members` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `TechnicalCommittee::Proposals` (r:1 w:0) diff --git a/operator/runtime/stagenet/src/weights/pallet_collective_treasury_council.rs b/operator/runtime/stagenet/src/weights/pallet_collective_treasury_council.rs index 1b167eaf..836927a1 100644 --- a/operator/runtime/stagenet/src/weights/pallet_collective_treasury_council.rs +++ b/operator/runtime/stagenet/src/weights/pallet_collective_treasury_council.rs @@ -51,10 +51,11 @@ use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; use sp_std::marker::PhantomData; +use crate::pallet_collective_treasury_council; /// Weights for `pallet_collective_treasury_council`. pub struct WeightInfo(PhantomData); -impl pallet_collective::WeightInfo for WeightInfo { +impl pallet_collective_treasury_council::WeightInfo for WeightInfo { /// Storage: `TreasuryCouncil::Members` (r:1 w:1) /// Proof: `TreasuryCouncil::Members` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `TreasuryCouncil::Proposals` (r:1 w:0) diff --git a/operator/runtime/testnet/src/benchmarks.rs b/operator/runtime/testnet/src/benchmarks.rs index b51ed351..3e59c56f 100644 --- a/operator/runtime/testnet/src/benchmarks.rs +++ b/operator/runtime/testnet/src/benchmarks.rs @@ -14,13 +14,6 @@ // You should have received a copy of the GNU General Public License // along with DataHaven. If not, see . -// TODO: Temporary workaround before upgrading to latest polkadot-sdk - fix https://github.com/paritytech/polkadot-sdk/pull/6435 -#[allow(unused_imports)] -use pallet_collective as pallet_collective_treasury_council; -#[allow(unused_imports)] -use pallet_collective as pallet_collective_technical_committee; -use pallet_external_validator_slashes as pallet_external_validators_slashes; - frame_benchmarking::define_benchmarks!( // System benchmarks [frame_system, SystemBench::] diff --git a/operator/runtime/testnet/src/lib.rs b/operator/runtime/testnet/src/lib.rs index 68bbc753..4075c713 100644 --- a/operator/runtime/testnet/src/lib.rs +++ b/operator/runtime/testnet/src/lib.rs @@ -31,6 +31,12 @@ pub mod weights; pub use configs::governance; pub use configs::Precompiles; +// TODO: Temporary workaround before upgrading to latest polkadot-sdk - fix https://github.com/paritytech/polkadot-sdk/pull/6435 +#[allow(unused_imports)] +use pallet_collective as pallet_collective_treasury_council; +#[allow(unused_imports)] +use pallet_collective as pallet_collective_technical_committee; + use alloc::{borrow::Cow, vec::Vec}; use codec::Encode; use fp_rpc::TransactionStatus; diff --git a/operator/runtime/testnet/src/weights/pallet_collective_technical_committee.rs b/operator/runtime/testnet/src/weights/pallet_collective_technical_committee.rs index 407c3f33..b422d02a 100644 --- a/operator/runtime/testnet/src/weights/pallet_collective_technical_committee.rs +++ b/operator/runtime/testnet/src/weights/pallet_collective_technical_committee.rs @@ -51,10 +51,11 @@ use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; use sp_std::marker::PhantomData; +use crate::pallet_collective_technical_committee; /// Weights for `pallet_collective_technical_committee`. pub struct WeightInfo(PhantomData); -impl pallet_collective::WeightInfo for WeightInfo { +impl pallet_collective_technical_committee::WeightInfo for WeightInfo { /// Storage: `TechnicalCommittee::Members` (r:1 w:1) /// Proof: `TechnicalCommittee::Members` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `TechnicalCommittee::Proposals` (r:1 w:0) diff --git a/operator/runtime/testnet/src/weights/pallet_collective_treasury_council.rs b/operator/runtime/testnet/src/weights/pallet_collective_treasury_council.rs index d94d7c72..cf78c03b 100644 --- a/operator/runtime/testnet/src/weights/pallet_collective_treasury_council.rs +++ b/operator/runtime/testnet/src/weights/pallet_collective_treasury_council.rs @@ -51,10 +51,11 @@ use frame_support::{traits::Get, weights::{Weight, constants::RocksDbWeight}}; use sp_std::marker::PhantomData; +use crate::pallet_collective_treasury_council; /// Weights for `pallet_collective_treasury_council`. pub struct WeightInfo(PhantomData); -impl pallet_collective::WeightInfo for WeightInfo { +impl pallet_collective_treasury_council::WeightInfo for WeightInfo { /// Storage: `TreasuryCouncil::Members` (r:1 w:1) /// Proof: `TreasuryCouncil::Members` (`max_values`: Some(1), `max_size`: None, mode: `Measured`) /// Storage: `TreasuryCouncil::Proposals` (r:1 w:0)