diff --git a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/staking.rs b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/staking.rs index dea476cdcc4ae..8c9b95ba71bc5 100644 --- a/cumulus/parachains/runtimes/assets/asset-hub-westend/src/staking.rs +++ b/cumulus/parachains/runtimes/assets/asset-hub-westend/src/staking.rs @@ -338,8 +338,6 @@ impl pallet_staking_async_rc_client::Config for Runtime { // | beefy | ECDSA | 33 bytes | 65 bytes | // | Total | | 193 bytes | 385 bytes | // We add some buffer for SCALE encoding overhead and future expansions - type MaxSessionKeysLength = ConstU32<256>; - type MaxSessionKeysProofLength = ConstU32<512>; type WeightInfo = weights::pallet_staking_async_rc_client::WeightInfo; } diff --git a/prdoc/pr_11115.prdoc b/prdoc/pr_11115.prdoc new file mode 100644 index 0000000000000..ac6385cdea075 --- /dev/null +++ b/prdoc/pr_11115.prdoc @@ -0,0 +1,11 @@ +title: Remove MaxSessionKeysLength and MaxSessionKeysProofLength +doc: +- audience: Runtime Dev + description: |- + fixes the issue #11083 where MaxSessionKeysLength and MaxSessionKeysProofLength were unnecessary because there are not stored, just validated. +crates: +- name: pallet-staking-async-rc-client + bump: patch + validate: false +- name: asset-hub-westend-runtime + bump: patch diff --git a/substrate/frame/staking-async/integration-tests/src/ah/mock.rs b/substrate/frame/staking-async/integration-tests/src/ah/mock.rs index 854e126fd11d9..3a79e1112496a 100644 --- a/substrate/frame/staking-async/integration-tests/src/ah/mock.rs +++ b/substrate/frame/staking-async/integration-tests/src/ah/mock.rs @@ -496,8 +496,6 @@ impl pallet_staking_async_rc_client::Config for Runtime { type ValidatorSetExportSession = ValidatorSetExportSession; type RelayChainSessionKeys = RCSessionKeys; type Balance = Balance; - type MaxSessionKeysLength = ConstU32<256>; - type MaxSessionKeysProofLength = ConstU32<512>; type WeightInfo = (); } diff --git a/substrate/frame/staking-async/integration-tests/src/ah/test.rs b/substrate/frame/staking-async/integration-tests/src/ah/test.rs index b47c1d5af8ec8..dadc2c998c17d 100644 --- a/substrate/frame/staking-async/integration-tests/src/ah/test.rs +++ b/substrate/frame/staking-async/integration-tests/src/ah/test.rs @@ -1419,11 +1419,11 @@ mod session_keys { SetKeysExecutionCost, }; use codec::Encode; - use frame_support::{assert_noop, BoundedVec}; + use frame_support::assert_noop; use rc_client::AHStakingInterface; - type Keys = BoundedVec::MaxSessionKeysLength>; - type Proof = BoundedVec::MaxSessionKeysProofLength>; + type Keys = Vec; + type Proof = Vec; /// Helper to create properly encoded session keys and ownership proof. fn make_session_keys_and_proof(owner: AccountId) -> (Keys, Proof) { @@ -1437,7 +1437,7 @@ mod session_keys { // GIVEN: Account 1 is a validator with delivery fees configured let validator: AccountId = 1; let (keys, proof) = make_session_keys_and_proof(validator); - let keys_raw: Vec = keys.clone().into_inner(); + let keys_raw: Vec = keys.clone(); let delivery_fee: u128 = 50; XcmDeliveryFee::set(delivery_fee); let execution_cost = SetKeysExecutionCost::get(); diff --git a/substrate/frame/staking-async/rc-client/src/benchmarking.rs b/substrate/frame/staking-async/rc-client/src/benchmarking.rs index 1babd18b1c781..72e6aa99b78d7 100644 --- a/substrate/frame/staking-async/rc-client/src/benchmarking.rs +++ b/substrate/frame/staking-async/rc-client/src/benchmarking.rs @@ -60,17 +60,12 @@ pub trait Config: crate::Config { #[benchmarks] mod benchmarks { use super::*; - use frame_support::BoundedVec; use xcm_executor::traits::FeeReason; #[benchmark] fn set_keys() -> Result<(), BenchmarkError> { let stash = T::setup_validator(); let (keys, proof) = T::generate_session_keys_and_proof(stash.clone()); - let keys: BoundedVec::MaxSessionKeysLength> = - keys.try_into().expect("keys should fit in bounded vec"); - let proof: BoundedVec::MaxSessionKeysProofLength> = - proof.try_into().expect("proof should fit in bounded vec"); // Ensure XCM delivery will succeed by setting up required fees/accounts. let stash_location = T::account_to_location(stash.clone()); diff --git a/substrate/frame/staking-async/rc-client/src/lib.rs b/substrate/frame/staking-async/rc-client/src/lib.rs index a5e4818c702a3..cfadb160659ca 100644 --- a/substrate/frame/staking-async/rc-client/src/lib.rs +++ b/substrate/frame/staking-async/rc-client/src/lib.rs @@ -1056,14 +1056,6 @@ pub mod pallet { /// The balance type used for delivery fee limits. type Balance: BalanceTrait; - /// Maximum length of encoded session keys. - #[pallet::constant] - type MaxSessionKeysLength: Get; - - /// Maximum length of the session keys ownership proof. - #[pallet::constant] - type MaxSessionKeysProofLength: Get; - /// Weight information for extrinsics in this pallet. type WeightInfo: WeightInfo; } @@ -1294,8 +1286,8 @@ pub mod pallet { #[pallet::weight(T::WeightInfo::set_keys())] pub fn set_keys( origin: OriginFor, - keys: BoundedVec, - proof: BoundedVec, + keys: Vec, + proof: Vec, max_delivery_and_remote_execution_fee: Option>, ) -> DispatchResult { let stash = ensure_signed(origin)?; @@ -1316,7 +1308,7 @@ pub mod pallet { // Forward validated keys to RC (no proof needed, already validated) let fees = T::SendToRelayChain::set_keys( stash.clone(), - keys.into_inner(), + keys, max_delivery_and_remote_execution_fee, ) .map_err(|e| match e { diff --git a/substrate/frame/staking-async/runtimes/parachain/src/staking.rs b/substrate/frame/staking-async/runtimes/parachain/src/staking.rs index 02ee5817db8a4..48b262ab1ed6e 100644 --- a/substrate/frame/staking-async/runtimes/parachain/src/staking.rs +++ b/substrate/frame/staking-async/runtimes/parachain/src/staking.rs @@ -487,8 +487,6 @@ impl pallet_staking_async_rc_client::Config for Runtime { type ValidatorSetExportSession = ConstU32<4>; type RelayChainSessionKeys = RelayChainSessionKeys; type Balance = Balance; - type MaxSessionKeysLength = ConstU32<256>; - type MaxSessionKeysProofLength = ConstU32<512>; type WeightInfo = (); }