From 60239a30eb97a45947e3951fe868049498ed0d9d Mon Sep 17 00:00:00 2001 From: Alejandro Martinez Andres <11448715+al3mart@users.noreply.github.com> Date: Wed, 23 Apr 2025 10:40:11 +0200 Subject: [PATCH] chore: add BlockNumberProvider for multisig, nfts & proxy --- runtime/devnet/src/config/assets.rs | 2 +- runtime/devnet/src/config/proxy.rs | 3 ++- runtime/devnet/src/lib.rs | 1 + runtime/mainnet/src/config/assets.rs | 11 ++++++++++- runtime/mainnet/src/config/proxy.rs | 11 ++++++++++- runtime/mainnet/src/config/utility.rs | 11 ++++++++++- runtime/testnet/src/config/assets.rs | 3 ++- runtime/testnet/src/config/proxy.rs | 3 ++- runtime/testnet/src/config/utility.rs | 3 ++- 9 files changed, 40 insertions(+), 8 deletions(-) diff --git a/runtime/devnet/src/config/assets.rs b/runtime/devnet/src/config/assets.rs index ca8d739ae..9436e9251 100644 --- a/runtime/devnet/src/config/assets.rs +++ b/runtime/devnet/src/config/assets.rs @@ -11,7 +11,7 @@ use sp_runtime::traits::Verify; use crate::{ deposit, AccountId, Assets, Balance, Balances, BlockNumber, Nfts, Runtime, RuntimeEvent, - RuntimeHoldReason, DAYS, EXISTENTIAL_DEPOSIT, UNIT, + RuntimeHoldReason, System, DAYS, EXISTENTIAL_DEPOSIT, UNIT, }; /// We allow root to execute privileged asset operations. diff --git a/runtime/devnet/src/config/proxy.rs b/runtime/devnet/src/config/proxy.rs index 486530276..289b51c08 100644 --- a/runtime/devnet/src/config/proxy.rs +++ b/runtime/devnet/src/config/proxy.rs @@ -6,7 +6,7 @@ use pop_runtime_common::proxy::{ use sp_runtime::traits::BlakeTwo256; use super::assets::{TrustBackedAssetsCall, TrustBackedNftsCall}; -use crate::{Balances, Runtime, RuntimeCall, RuntimeEvent}; +use crate::{Balances, Runtime, RuntimeCall, RuntimeEvent, System}; impl InstanceFilter for ProxyType { fn filter(&self, c: &RuntimeCall) -> bool { @@ -97,6 +97,7 @@ impl InstanceFilter for ProxyType { impl pallet_proxy::Config for Runtime { type AnnouncementDepositBase = AnnouncementDepositBase; type AnnouncementDepositFactor = AnnouncementDepositFactor; + type BlockNumberProvider = System; type CallHasher = BlakeTwo256; type Currency = Balances; type MaxPending = MaxPending; diff --git a/runtime/devnet/src/lib.rs b/runtime/devnet/src/lib.rs index 9dbf0ace1..9c73688ae 100644 --- a/runtime/devnet/src/lib.rs +++ b/runtime/devnet/src/lib.rs @@ -542,6 +542,7 @@ parameter_types! { } impl pallet_multisig::Config for Runtime { + type BlockNumberProvider = System; type Currency = Balances; type DepositBase = DepositBase; type DepositFactor = DepositFactor; diff --git a/runtime/mainnet/src/config/assets.rs b/runtime/mainnet/src/config/assets.rs index 13f19f978..9332e9f65 100644 --- a/runtime/mainnet/src/config/assets.rs +++ b/runtime/mainnet/src/config/assets.rs @@ -10,7 +10,7 @@ use sp_runtime::traits::Verify; use crate::{ config::monetary::ExistentialDeposit, deposit, weights, AccountId, Balance, Balances, - BlockNumber, Runtime, RuntimeEvent, DAYS, + BlockNumber, Runtime, RuntimeEvent, System, DAYS, }; /// We allow root to execute privileged asset operations. @@ -78,6 +78,7 @@ parameter_types! { impl pallet_nfts::Config for Runtime { type ApprovalsLimit = ConstU32<20>; type AttributeDepositBase = NftsAttributeDepositBase; + type BlockNumberProvider = System; type CollectionDeposit = NftsCollectionDeposit; type CollectionId = CollectionId; type CreateOrigin = AsEnsureOriginWithArg>; @@ -360,6 +361,14 @@ mod tests { assert_eq!(deposit(1, key_size as u32) / 100, NftsAttributeDepositBase::get()); } + #[test] + fn ensure_system_is_block_number_provider() { + assert_eq!( + TypeId::of::<::BlockNumberProvider>(), + TypeId::of::(), + ); + } + #[test] fn ensure_collection_deposit() { // We account for the different elements stored when creating a new collection: diff --git a/runtime/mainnet/src/config/proxy.rs b/runtime/mainnet/src/config/proxy.rs index 339012a47..e9e8e7c99 100644 --- a/runtime/mainnet/src/config/proxy.rs +++ b/runtime/mainnet/src/config/proxy.rs @@ -4,7 +4,7 @@ use pop_runtime_common::proxy::{MaxPending, MaxProxies, ProxyType}; use crate::{ config::assets::TrustBackedAssetsCall, deposit, parameter_types, weights, Balance, Balances, - BlakeTwo256, Runtime, RuntimeCall, RuntimeEvent, + BlakeTwo256, Runtime, RuntimeCall, RuntimeEvent, System, }; impl InstanceFilter for ProxyType { @@ -106,6 +106,7 @@ parameter_types! { impl pallet_proxy::Config for Runtime { type AnnouncementDepositBase = AnnouncementDepositBase; type AnnouncementDepositFactor = AnnouncementDepositFactor; + type BlockNumberProvider = System; type CallHasher = BlakeTwo256; type Currency = Balances; type MaxPending = MaxPending; @@ -192,6 +193,14 @@ mod tests { ); } + #[test] + fn ensure_system_is_block_number_provider() { + assert_eq!( + TypeId::of::<::BlockNumberProvider>(), + TypeId::of::(), + ); + } + #[test] fn proxy_uses_blaketwo256_as_hasher() { assert_eq!(TypeId::of::<::CallHasher>(), TypeId::of::(),); diff --git a/runtime/mainnet/src/config/utility.rs b/runtime/mainnet/src/config/utility.rs index 61e02fb52..ea66d76a0 100644 --- a/runtime/mainnet/src/config/utility.rs +++ b/runtime/mainnet/src/config/utility.rs @@ -2,7 +2,7 @@ use crate::{ config::system::RuntimeBlockWeights, deposit, parameter_types, weights, AccountId, Balance, Balances, ConstU32, EnsureRoot, EqualPrivilegeOnly, HoldConsideration, LinearStoragePrice, OriginCaller, Perbill, Preimage, Runtime, RuntimeCall, RuntimeEvent, RuntimeHoldReason, - RuntimeOrigin, Weight, + RuntimeOrigin, System, Weight, }; parameter_types! { @@ -15,6 +15,7 @@ parameter_types! { } impl pallet_multisig::Config for Runtime { + type BlockNumberProvider = System; type Currency = Balances; type DepositBase = DepositBase; type DepositFactor = DepositFactor; @@ -87,6 +88,14 @@ mod tests { use super::*; + #[test] + fn ensure_system_is_block_number_provider() { + assert_eq!( + TypeId::of::<::BlockNumberProvider>(), + TypeId::of::(), + ); + } + #[test] fn balances_is_used_for_deposits() { assert_eq!( diff --git a/runtime/testnet/src/config/assets.rs b/runtime/testnet/src/config/assets.rs index d2de9b15c..ccd840cdf 100644 --- a/runtime/testnet/src/config/assets.rs +++ b/runtime/testnet/src/config/assets.rs @@ -11,7 +11,7 @@ use sp_runtime::traits::Verify; use crate::{ deposit, AccountId, Assets, Balance, Balances, BlockNumber, Nfts, Runtime, RuntimeEvent, - RuntimeHoldReason, DAYS, EXISTENTIAL_DEPOSIT, UNIT, + RuntimeHoldReason, System, DAYS, EXISTENTIAL_DEPOSIT, UNIT, }; /// We allow root to execute privileged asset operations. @@ -66,6 +66,7 @@ impl pallet_nfts::Config for Runtime { // TODO: source from primitives type ApprovalsLimit = ConstU32<20>; type AttributeDepositBase = NftsAttributeDepositBase; + type BlockNumberProvider = System; type CollectionDeposit = NftsCollectionDeposit; // TODO: source from primitives type CollectionId = CollectionId; diff --git a/runtime/testnet/src/config/proxy.rs b/runtime/testnet/src/config/proxy.rs index dd322bc2a..d60e34fb5 100644 --- a/runtime/testnet/src/config/proxy.rs +++ b/runtime/testnet/src/config/proxy.rs @@ -7,7 +7,7 @@ use pop_runtime_common::proxy::{ use sp_runtime::traits::BlakeTwo256; use super::assets::TrustBackedAssetsCall; -use crate::{Balances, Runtime, RuntimeCall, RuntimeEvent}; +use crate::{Balances, Runtime, RuntimeCall, RuntimeEvent, System}; impl InstanceFilter for ProxyType { fn filter(&self, c: &RuntimeCall) -> bool { @@ -98,6 +98,7 @@ impl InstanceFilter for ProxyType { impl pallet_proxy::Config for Runtime { type AnnouncementDepositBase = AnnouncementDepositBase; type AnnouncementDepositFactor = AnnouncementDepositFactor; + type BlockNumberProvider = System; type CallHasher = BlakeTwo256; type Currency = Balances; type MaxPending = MaxPending; diff --git a/runtime/testnet/src/config/utility.rs b/runtime/testnet/src/config/utility.rs index c0abe5203..c7d0c6a4f 100644 --- a/runtime/testnet/src/config/utility.rs +++ b/runtime/testnet/src/config/utility.rs @@ -8,7 +8,7 @@ use parachains_common::Balance; use crate::{ config::system::RuntimeBlockWeights, deposit, AccountId, Balances, OriginCaller, Perbill, - Preimage, Runtime, RuntimeCall, RuntimeEvent, RuntimeHoldReason, RuntimeOrigin, Weight, + Preimage, Runtime, RuntimeCall, RuntimeEvent, RuntimeHoldReason, RuntimeOrigin, System, Weight, }; parameter_types! { @@ -20,6 +20,7 @@ parameter_types! { } impl pallet_multisig::Config for Runtime { + type BlockNumberProvider = System; type Currency = Balances; type DepositBase = DepositBase; type DepositFactor = DepositFactor;