File tree Expand file tree Collapse file tree 7 files changed +18
-26
lines changed
cumulus/parachains/runtimes/assets/asset-hub-westend/src
substrate/frame/staking-async Expand file tree Collapse file tree 7 files changed +18
-26
lines changed Original file line number Diff line number Diff 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
Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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 ( ) ;
Original file line number Diff line number Diff line change @@ -60,17 +60,12 @@ pub trait Config: crate::Config {
6060#[ benchmarks]
6161mod 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 ( ) ) ;
Original file line number Diff line number Diff 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 {
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments