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>
This commit is contained in:
Gonza Montiel 2025-12-05 14:22:52 +01:00 committed by GitHub
parent 207f2ff86a
commit bd99fb7c4e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
13 changed files with 31 additions and 27 deletions

View file

@ -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<T>(PhantomData<T>);

View file

@ -14,12 +14,6 @@
// You should have received a copy of the GNU General Public License
// along with DataHaven. If not, see <http://www.gnu.org/licenses/>.
// 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::<Runtime>]

View file

@ -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;

View file

@ -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<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_collective::WeightInfo for WeightInfo<T> {
impl<T: frame_system::Config> pallet_collective_technical_committee::WeightInfo for WeightInfo<T> {
/// 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)

View file

@ -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<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_collective::WeightInfo for WeightInfo<T> {
impl<T: frame_system::Config> pallet_collective_treasury_council::WeightInfo for WeightInfo<T> {
/// 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)

View file

@ -14,12 +14,6 @@
// You should have received a copy of the GNU General Public License
// along with DataHaven. If not, see <http://www.gnu.org/licenses/>.
// 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::<Runtime>]

View file

@ -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;

View file

@ -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<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_collective::WeightInfo for WeightInfo<T> {
impl<T: frame_system::Config> pallet_collective_technical_committee::WeightInfo for WeightInfo<T> {
/// 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)

View file

@ -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<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_collective::WeightInfo for WeightInfo<T> {
impl<T: frame_system::Config> pallet_collective_treasury_council::WeightInfo for WeightInfo<T> {
/// 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)

View file

@ -14,13 +14,6 @@
// You should have received a copy of the GNU General Public License
// along with DataHaven. If not, see <http://www.gnu.org/licenses/>.
// 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::<Runtime>]

View file

@ -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;

View file

@ -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<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_collective::WeightInfo for WeightInfo<T> {
impl<T: frame_system::Config> pallet_collective_technical_committee::WeightInfo for WeightInfo<T> {
/// 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)

View file

@ -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<T>(PhantomData<T>);
impl<T: frame_system::Config> pallet_collective::WeightInfo for WeightInfo<T> {
impl<T: frame_system::Config> pallet_collective_treasury_council::WeightInfo for WeightInfo<T> {
/// 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)