Skip to content

Commit 03380f1

Browse files
paritytech-release-backport-bot[bot]cirko33github-actions[bot]EgorPopelyaev
authored
[stable2603] Backport #11115 (#11130)
Backport #11115 into `stable2603` from cirko33. See the [documentation](https://github.com/paritytech/polkadot-sdk/blob/master/docs/BACKPORT.md) on how to use this bot. <!-- # To be used by other automation, do not modify: original-pr-number: #${pull_number} --> --------- Co-authored-by: Luka Ciric <luka.ciric2106@gmail.com> Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Egor_P <egor@parity.io>
1 parent 022ec72 commit 03380f1

File tree

7 files changed

+18
-26
lines changed

7 files changed

+18
-26
lines changed

cumulus/parachains/runtimes/assets/asset-hub-westend/src/staking.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -338,8 +338,6 @@ impl pallet_staking_async_rc_client::Config for Runtime {
338338
// | beefy | ECDSA | 33 bytes | 65 bytes |
339339
// | Total | | 193 bytes | 385 bytes |
340340
// We add some buffer for SCALE encoding overhead and future expansions
341-
type MaxSessionKeysLength = ConstU32<256>;
342-
type MaxSessionKeysProofLength = ConstU32<512>;
343341
type WeightInfo = weights::pallet_staking_async_rc_client::WeightInfo<Runtime>;
344342
}
345343

prdoc/pr_11115.prdoc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
title: Remove MaxSessionKeysLength and MaxSessionKeysProofLength
2+
doc:
3+
- audience: Runtime Dev
4+
description: |-
5+
fixes the issue #11083 where MaxSessionKeysLength and MaxSessionKeysProofLength were unnecessary because there are not stored, just validated.
6+
crates:
7+
- name: pallet-staking-async-rc-client
8+
bump: patch
9+
validate: false
10+
- name: asset-hub-westend-runtime
11+
bump: patch

substrate/frame/staking-async/integration-tests/src/ah/mock.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -496,8 +496,6 @@ impl pallet_staking_async_rc_client::Config for Runtime {
496496
type ValidatorSetExportSession = ValidatorSetExportSession;
497497
type RelayChainSessionKeys = RCSessionKeys;
498498
type Balance = Balance;
499-
type MaxSessionKeysLength = ConstU32<256>;
500-
type MaxSessionKeysProofLength = ConstU32<512>;
501499
type WeightInfo = ();
502500
}
503501

substrate/frame/staking-async/integration-tests/src/ah/test.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1419,11 +1419,11 @@ mod session_keys {
14191419
SetKeysExecutionCost,
14201420
};
14211421
use codec::Encode;
1422-
use frame_support::{assert_noop, BoundedVec};
1422+
use frame_support::assert_noop;
14231423
use rc_client::AHStakingInterface;
14241424

1425-
type Keys = BoundedVec<u8, <T as rc_client::Config>::MaxSessionKeysLength>;
1426-
type Proof = BoundedVec<u8, <T as rc_client::Config>::MaxSessionKeysProofLength>;
1425+
type Keys = Vec<u8>;
1426+
type Proof = Vec<u8>;
14271427

14281428
/// Helper to create properly encoded session keys and ownership proof.
14291429
fn make_session_keys_and_proof(owner: AccountId) -> (Keys, Proof) {
@@ -1437,7 +1437,7 @@ mod session_keys {
14371437
// GIVEN: Account 1 is a validator with delivery fees configured
14381438
let validator: AccountId = 1;
14391439
let (keys, proof) = make_session_keys_and_proof(validator);
1440-
let keys_raw: Vec<u8> = keys.clone().into_inner();
1440+
let keys_raw: Vec<u8> = keys.clone();
14411441
let delivery_fee: u128 = 50;
14421442
XcmDeliveryFee::set(delivery_fee);
14431443
let execution_cost = SetKeysExecutionCost::get();

substrate/frame/staking-async/rc-client/src/benchmarking.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,17 +60,12 @@ pub trait Config: crate::Config {
6060
#[benchmarks]
6161
mod benchmarks {
6262
use super::*;
63-
use frame_support::BoundedVec;
6463
use xcm_executor::traits::FeeReason;
6564

6665
#[benchmark]
6766
fn set_keys() -> Result<(), BenchmarkError> {
6867
let stash = T::setup_validator();
6968
let (keys, proof) = T::generate_session_keys_and_proof(stash.clone());
70-
let keys: BoundedVec<u8, <T as crate::Config>::MaxSessionKeysLength> =
71-
keys.try_into().expect("keys should fit in bounded vec");
72-
let proof: BoundedVec<u8, <T as crate::Config>::MaxSessionKeysProofLength> =
73-
proof.try_into().expect("proof should fit in bounded vec");
7469

7570
// Ensure XCM delivery will succeed by setting up required fees/accounts.
7671
let stash_location = T::account_to_location(stash.clone());

substrate/frame/staking-async/rc-client/src/lib.rs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,14 +1056,6 @@ pub mod pallet {
10561056
/// The balance type used for delivery fee limits.
10571057
type Balance: BalanceTrait;
10581058

1059-
/// Maximum length of encoded session keys.
1060-
#[pallet::constant]
1061-
type MaxSessionKeysLength: Get<u32>;
1062-
1063-
/// Maximum length of the session keys ownership proof.
1064-
#[pallet::constant]
1065-
type MaxSessionKeysProofLength: Get<u32>;
1066-
10671059
/// Weight information for extrinsics in this pallet.
10681060
type WeightInfo: WeightInfo;
10691061
}
@@ -1294,8 +1286,8 @@ pub mod pallet {
12941286
#[pallet::weight(T::WeightInfo::set_keys())]
12951287
pub fn set_keys(
12961288
origin: OriginFor<T>,
1297-
keys: BoundedVec<u8, T::MaxSessionKeysLength>,
1298-
proof: BoundedVec<u8, T::MaxSessionKeysProofLength>,
1289+
keys: Vec<u8>,
1290+
proof: Vec<u8>,
12991291
max_delivery_and_remote_execution_fee: Option<BalanceOf<T>>,
13001292
) -> DispatchResult {
13011293
let stash = ensure_signed(origin)?;
@@ -1316,7 +1308,7 @@ pub mod pallet {
13161308
// Forward validated keys to RC (no proof needed, already validated)
13171309
let fees = T::SendToRelayChain::set_keys(
13181310
stash.clone(),
1319-
keys.into_inner(),
1311+
keys,
13201312
max_delivery_and_remote_execution_fee,
13211313
)
13221314
.map_err(|e| match e {

substrate/frame/staking-async/runtimes/parachain/src/staking.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -487,8 +487,6 @@ impl pallet_staking_async_rc_client::Config for Runtime {
487487
type ValidatorSetExportSession = ConstU32<4>;
488488
type RelayChainSessionKeys = RelayChainSessionKeys;
489489
type Balance = Balance;
490-
type MaxSessionKeysLength = ConstU32<256>;
491-
type MaxSessionKeysProofLength = ConstU32<512>;
492490
type WeightInfo = ();
493491
}
494492

0 commit comments

Comments
 (0)