Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
b7253a2
First draft
Krayt78 Mar 18, 2025
da72746
Implement reserved balance tracking for test accounts in the session …
Krayt78 Mar 18, 2025
691e38d
Update inner_set_keys to accept old keys as an argument to reduce red…
Krayt78 Mar 18, 2025
734ffc6
Update session pallet to use NamedReservableCurrency for key reservat…
Krayt78 Mar 18, 2025
5843e53
Refactor session pallet to replace NamedReservableCurrency with hold …
Krayt78 Mar 18, 2025
1d9351e
removed events and reverted some logic according to comments
Krayt78 Apr 22, 2025
851ff35
frogot a let
Krayt78 Apr 22, 2025
ebce494
rewrote mock file to use pallet_balances
Krayt78 Apr 22, 2025
69be552
fmt
Krayt78 Apr 23, 2025
59881ad
fix toml
Krayt78 Apr 23, 2025
f91a083
Merge branch 'master' into add-deposit-for-setting-session-keys
Krayt78 Apr 23, 2025
2141bde
fix merge issue
Krayt78 Apr 23, 2025
c279916
removed useless deps
Krayt78 Apr 23, 2025
783f9f4
Update benchmarking.rs to use fully qualified path for Currency methods
Krayt78 May 6, 2025
1f00943
started fixing runtimes
Krayt78 May 8, 2025
740d3e7
reworked hold reason and reworked on the runtime impls
Krayt78 May 9, 2025
d6d9dc7
fix soem runtime issues
Krayt78 May 9, 2025
a392303
some more runtimes
Krayt78 May 9, 2025
4e61c71
Merge branch 'master' into add-deposit-for-setting-session-keys
Krayt78 May 11, 2025
132a0ad
fmt
Krayt78 May 11, 2025
d3b7ae5
updated almost all runtimes and mocks
Krayt78 May 11, 2025
a5d2a42
converted other mocks
Krayt78 May 11, 2025
702a3bb
fix mock const type
Krayt78 May 11, 2025
bb1894b
fixed some dependecies
Krayt78 May 11, 2025
8366315
fix some cargo that were missing pallet_balances
Krayt78 May 11, 2025
f121b18
cargo update since i changed some deps
Krayt78 May 11, 2025
a67a35e
Revert "cargo update since i changed some deps"
Krayt78 May 13, 2025
8bbb2e2
Merge branch 'master' into add-deposit-for-setting-session-keys
Krayt78 May 13, 2025
a8752f0
updated beefy mmr (need review one test breaks)
Krayt78 May 13, 2025
78cb376
fix imonline
Krayt78 May 13, 2025
5b91dc4
taplo
Krayt78 May 13, 2025
cb4f308
markdown lint the readme
Krayt78 May 13, 2025
070d5c5
authority discovery done
Krayt78 May 13, 2025
bcac4ae
removed unused deps
Krayt78 May 13, 2025
6c8fdf2
fix session typing
Krayt78 May 13, 2025
180ce6c
fix type
Krayt78 May 13, 2025
8198623
fixed the broken test
Krayt78 May 17, 2025
6821b1e
Update cumulus/pallets/collator-selection/src/mock.rs
Krayt78 May 18, 2025
3f2a737
Update cumulus/parachains/runtimes/assets/asset-hub-rococo/src/lib.rs
Krayt78 May 18, 2025
1303f82
Update cumulus/parachains/runtimes/bridge-hubs/bridge-hub-rococo/src/…
Krayt78 May 18, 2025
ef13458
Update cumulus/parachains/runtimes/assets/asset-hub-westend/src/lib.rs
Krayt78 May 18, 2025
3b0422e
Update cumulus/parachains/runtimes/bridge-hubs/bridge-hub-westend/src…
Krayt78 May 18, 2025
995b4df
Update substrate/frame/session/src/lib.rs
Krayt78 May 18, 2025
4317b66
Update substrate/frame/session/src/tests.rs
Krayt78 May 18, 2025
ced83aa
Update substrate/frame/session/src/lib.rs
Krayt78 May 18, 2025
f5af9c2
set all the key deposits to () outside session pallet
Krayt78 May 18, 2025
aae6d13
fmt
Krayt78 May 18, 2025
87439c3
Merge branch 'master' into add-deposit-for-setting-session-keys
Krayt78 May 18, 2025
6768103
removed all the config that was already done with derive_impl
Krayt78 May 18, 2025
18cb873
changed test mock to be key deopsit-1 instead of existencial deposit
Krayt78 May 18, 2025
587db5b
optimized test
Krayt78 May 18, 2025
f848567
went back and removed unused deps and added back comments that were d…
Krayt78 May 18, 2025
33316dd
Merge branch 'master' into add-deposit-for-setting-session-keys
kianenigma May 29, 2025
c2ae469
some cleanup
kianenigma Jun 10, 2025
3b64867
Update from github-actions[bot] running command 'prdoc --bump minor -…
github-actions[bot] Jun 10, 2025
22c6fff
Merge branch 'master' of github.com:paritytech/polkadot-sdk into add-…
kianenigma Jun 10, 2025
370a8d9
Merge branch 'add-deposit-for-setting-session-keys' of https://github…
kianenigma Jun 10, 2025
495a134
update prdoc
kianenigma Jun 10, 2025
7293fe2
update prdoc
kianenigma Jun 10, 2025
a8c94cf
remove alias
kianenigma Jun 10, 2025
db4ffe7
more cleanup
kianenigma Jun 10, 2025
691f0f8
fix toml
kianenigma Jun 10, 2025
9abd148
Update substrate/frame/session/src/lib.rs
Krayt78 Jun 11, 2025
5664b75
Update substrate/frame/session/src/lib.rs
Krayt78 Jun 11, 2025
caa7800
removed unused mock value
Krayt78 Jun 11, 2025
086eee9
Update prdoc/pr_7953.prdoc
kianenigma Jun 11, 2025
aedd820
Merge branch 'master' into add-deposit-for-setting-session-keys
kianenigma Jun 11, 2025
90b58a3
Removed RuntimeHoldReasons
Krayt78 Jun 11, 2025
d6ddabe
Update prdoc/pr_7953.prdoc
Krayt78 Jun 11, 2025
d026a13
fix prdoc
kianenigma Jun 14, 2025
cef9544
Merge branch 'master' into add-deposit-for-setting-session-keys
kianenigma Jun 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

58 changes: 31 additions & 27 deletions cumulus/pallets/collator-selection/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ fn create_funded_user<T: Config>(
balance_factor: u32,
) -> T::AccountId {
let user = account(string, n, SEED);
let balance = T::Currency::minimum_balance() * balance_factor.into();
let _ = T::Currency::make_free_balance_be(&user, balance);
let balance = <T as pallet::Config>::Currency::minimum_balance() * balance_factor.into();
let _ = <T as pallet::Config>::Currency::make_free_balance_be(&user, balance);
user
}

Expand Down Expand Up @@ -90,7 +90,10 @@ fn register_candidates<T: Config>(count: u32) {
assert!(CandidacyBond::<T>::get() > 0u32.into(), "Bond cannot be zero!");

for who in candidates {
T::Currency::make_free_balance_be(&who, CandidacyBond::<T>::get() * 3u32.into());
<T as pallet::Config>::Currency::make_free_balance_be(
&who,
CandidacyBond::<T>::get() * 3u32.into(),
);
<CollatorSelection<T>>::register_as_candidate(RawOrigin::Signed(who).into()).unwrap();
}
}
Expand Down Expand Up @@ -144,7 +147,7 @@ mod benchmarks {
T::UpdateOrigin::try_successful_origin().map_err(|_| BenchmarkError::Weightless)?;

// need to fill up candidates
CandidacyBond::<T>::put(T::Currency::minimum_balance());
CandidacyBond::<T>::put(<T as pallet::Config>::Currency::minimum_balance());
DesiredCandidates::<T>::put(c);
// get accounts and keys for the `c` candidates
let mut candidates = (0..c).map(|cc| validator::<T>(cc)).collect::<Vec<_>>();
Expand All @@ -161,13 +164,13 @@ mod benchmarks {
// ... and register them.
for (who, _) in candidates.iter() {
let deposit = CandidacyBond::<T>::get();
T::Currency::make_free_balance_be(who, deposit * 1000_u32.into());
<T as pallet::Config>::Currency::make_free_balance_be(who, deposit * 1000_u32.into());
CandidateList::<T>::try_mutate(|list| {
list.try_push(CandidateInfo { who: who.clone(), deposit }).unwrap();
Ok::<(), BenchmarkError>(())
})
.unwrap();
T::Currency::reserve(who, deposit)?;
<T as pallet::Config>::Currency::reserve(who, deposit)?;
LastAuthoredBlock::<T>::insert(
who.clone(),
frame_system::Pallet::<T>::block_number() + T::KickThreshold::get(),
Expand Down Expand Up @@ -226,7 +229,8 @@ mod benchmarks {
c: Linear<0, { T::MaxCandidates::get() }>,
k: Linear<0, { T::MaxCandidates::get() }>,
) -> Result<(), BenchmarkError> {
let initial_bond_amount: BalanceOf<T> = T::Currency::minimum_balance() * 2u32.into();
let initial_bond_amount: BalanceOf<T> =
<T as pallet::Config>::Currency::minimum_balance() * 2u32.into();
CandidacyBond::<T>::put(initial_bond_amount);
register_validators::<T>(c);
register_candidates::<T>(c);
Expand All @@ -236,12 +240,12 @@ mod benchmarks {
let bond_amount = if k > 0 {
CandidateList::<T>::mutate(|candidates| {
for info in candidates.iter_mut().skip(kicked as usize) {
info.deposit = T::Currency::minimum_balance() * 3u32.into();
info.deposit = <T as pallet::Config>::Currency::minimum_balance() * 3u32.into();
}
});
T::Currency::minimum_balance() * 3u32.into()
<T as pallet::Config>::Currency::minimum_balance() * 3u32.into()
} else {
T::Currency::minimum_balance()
<T as pallet::Config>::Currency::minimum_balance()
};

#[extrinsic_call]
Expand All @@ -255,7 +259,7 @@ mod benchmarks {
fn update_bond(
c: Linear<{ min_candidates::<T>() + 1 }, { T::MaxCandidates::get() }>,
) -> Result<(), BenchmarkError> {
CandidacyBond::<T>::put(T::Currency::minimum_balance());
CandidacyBond::<T>::put(<T as pallet::Config>::Currency::minimum_balance());
DesiredCandidates::<T>::put(c);

register_validators::<T>(c);
Expand All @@ -264,8 +268,8 @@ mod benchmarks {
let caller = CandidateList::<T>::get()[0].who.clone();
v2::whitelist!(caller);

let bond_amount: BalanceOf<T> =
T::Currency::minimum_balance() + T::Currency::minimum_balance();
let bond_amount: BalanceOf<T> = <T as pallet::Config>::Currency::minimum_balance() +
<T as pallet::Config>::Currency::minimum_balance();

#[extrinsic_call]
_(RawOrigin::Signed(caller.clone()), bond_amount);
Expand All @@ -275,7 +279,7 @@ mod benchmarks {
);
assert!(
CandidateList::<T>::get().iter().last().unwrap().deposit ==
T::Currency::minimum_balance() * 2u32.into()
<T as pallet::Config>::Currency::minimum_balance() * 2u32.into()
);
Ok(())
}
Expand All @@ -284,15 +288,15 @@ mod benchmarks {
// one.
#[benchmark]
fn register_as_candidate(c: Linear<1, { T::MaxCandidates::get() - 1 }>) {
CandidacyBond::<T>::put(T::Currency::minimum_balance());
CandidacyBond::<T>::put(<T as pallet::Config>::Currency::minimum_balance());
DesiredCandidates::<T>::put(c + 1);

register_validators::<T>(c);
register_candidates::<T>(c);

let caller: T::AccountId = whitelisted_caller();
let bond: BalanceOf<T> = T::Currency::minimum_balance() * 2u32.into();
T::Currency::make_free_balance_be(&caller, bond);
let bond: BalanceOf<T> = <T as pallet::Config>::Currency::minimum_balance() * 2u32.into();
<T as pallet::Config>::Currency::make_free_balance_be(&caller, bond);

<session::Pallet<T>>::set_keys(
RawOrigin::Signed(caller.clone()).into(),
Expand All @@ -311,15 +315,15 @@ mod benchmarks {

#[benchmark]
fn take_candidate_slot(c: Linear<{ min_candidates::<T>() + 1 }, { T::MaxCandidates::get() }>) {
CandidacyBond::<T>::put(T::Currency::minimum_balance());
CandidacyBond::<T>::put(<T as pallet::Config>::Currency::minimum_balance());
DesiredCandidates::<T>::put(1);

register_validators::<T>(c);
register_candidates::<T>(c);

let caller: T::AccountId = whitelisted_caller();
let bond: BalanceOf<T> = T::Currency::minimum_balance() * 10u32.into();
T::Currency::make_free_balance_be(&caller, bond);
let bond: BalanceOf<T> = <T as pallet::Config>::Currency::minimum_balance() * 10u32.into();
<T as pallet::Config>::Currency::make_free_balance_be(&caller, bond);

<session::Pallet<T>>::set_keys(
RawOrigin::Signed(caller.clone()).into(),
Expand All @@ -342,7 +346,7 @@ mod benchmarks {
// worse case is the last candidate leaving.
#[benchmark]
fn leave_intent(c: Linear<{ min_candidates::<T>() + 1 }, { T::MaxCandidates::get() }>) {
CandidacyBond::<T>::put(T::Currency::minimum_balance());
CandidacyBond::<T>::put(<T as pallet::Config>::Currency::minimum_balance());
DesiredCandidates::<T>::put(c);

register_validators::<T>(c);
Expand All @@ -360,23 +364,23 @@ mod benchmarks {
// worse case is paying a non-existing candidate account.
#[benchmark]
fn note_author() {
CandidacyBond::<T>::put(T::Currency::minimum_balance());
T::Currency::make_free_balance_be(
CandidacyBond::<T>::put(<T as pallet::Config>::Currency::minimum_balance());
<T as pallet::Config>::Currency::make_free_balance_be(
&<CollatorSelection<T>>::account_id(),
T::Currency::minimum_balance() * 4u32.into(),
<T as pallet::Config>::Currency::minimum_balance() * 4u32.into(),
);
let author = account("author", 0, SEED);
let new_block: BlockNumberFor<T> = 10u32.into();

frame_system::Pallet::<T>::set_block_number(new_block);
assert!(T::Currency::free_balance(&author) == 0u32.into());
assert!(<T as pallet::Config>::Currency::free_balance(&author) == 0u32.into());

#[block]
{
<CollatorSelection<T> as EventHandler<_, _>>::note_author(author.clone())
}

assert!(T::Currency::free_balance(&author) > 0u32.into());
assert!(<T as pallet::Config>::Currency::free_balance(&author) > 0u32.into());
assert_eq!(frame_system::Pallet::<T>::block_number(), new_block);
}

Expand All @@ -386,7 +390,7 @@ mod benchmarks {
r: Linear<1, { T::MaxCandidates::get() }>,
c: Linear<1, { T::MaxCandidates::get() }>,
) {
CandidacyBond::<T>::put(T::Currency::minimum_balance());
CandidacyBond::<T>::put(<T as pallet::Config>::Currency::minimum_balance());
DesiredCandidates::<T>::put(c);
frame_system::Pallet::<T>::set_block_number(0u32.into());

Expand Down
2 changes: 2 additions & 0 deletions cumulus/pallets/collator-selection/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,8 @@ impl pallet_session::Config for Test {
type Keys = MockSessionKeys;
type DisablingStrategy = ();
type WeightInfo = ();
type Currency = Balances;
type KeyDeposit = ();
}

ord_parameter_types! {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -837,6 +837,8 @@ impl pallet_session::Config for Runtime {
type Keys = SessionKeys;
type DisablingStrategy = ();
type WeightInfo = weights::pallet_session::WeightInfo<Runtime>;
type Currency = Balances;
type KeyDeposit = ();
}

impl pallet_aura::Config for Runtime {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -890,6 +890,8 @@ impl pallet_session::Config for Runtime {
type Keys = SessionKeys;
type DisablingStrategy = ();
type WeightInfo = weights::pallet_session::WeightInfo<Runtime>;
type Currency = Balances;
type KeyDeposit = ();
}

impl pallet_aura::Config for Runtime {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -507,6 +507,8 @@ impl pallet_session::Config for Runtime {
type Keys = SessionKeys;
type DisablingStrategy = ();
type WeightInfo = weights::pallet_session::WeightInfo<Runtime>;
type Currency = Balances;
type KeyDeposit = ();
}

impl pallet_aura::Config for Runtime {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,8 @@ impl pallet_session::Config for Runtime {
type Keys = SessionKeys;
type DisablingStrategy = ();
type WeightInfo = weights::pallet_session::WeightInfo<Runtime>;
type Currency = Balances;
type KeyDeposit = ();
}

impl pallet_aura::Config for Runtime {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -506,6 +506,8 @@ impl pallet_session::Config for Runtime {
type Keys = SessionKeys;
type DisablingStrategy = ();
type WeightInfo = weights::pallet_session::WeightInfo<Runtime>;
type Currency = Balances;
type KeyDeposit = ();
}

impl pallet_aura::Config for Runtime {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,8 @@ impl pallet_session::Config for Runtime {
type Keys = SessionKeys;
type DisablingStrategy = ();
type WeightInfo = weights::pallet_session::WeightInfo<Runtime>;
type Currency = Balances;
type KeyDeposit = ();
}

impl pallet_aura::Config for Runtime {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,8 @@ impl pallet_session::Config for Runtime {
type Keys = SessionKeys;
type DisablingStrategy = ();
type WeightInfo = weights::pallet_session::WeightInfo<Runtime>;
type Currency = Balances;
type KeyDeposit = ();
}

impl pallet_aura::Config for Runtime {
Expand Down
2 changes: 2 additions & 0 deletions cumulus/parachains/runtimes/people/people-rococo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,8 @@ impl pallet_session::Config for Runtime {
type Keys = SessionKeys;
type DisablingStrategy = ();
type WeightInfo = weights::pallet_session::WeightInfo<Runtime>;
type Currency = Balances;
type KeyDeposit = ();
}

impl pallet_aura::Config for Runtime {
Expand Down
2 changes: 2 additions & 0 deletions cumulus/parachains/runtimes/people/people-westend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,8 @@ impl pallet_session::Config for Runtime {
type Keys = SessionKeys;
type DisablingStrategy = ();
type WeightInfo = weights::pallet_session::WeightInfo<Runtime>;
type Currency = Balances;
type KeyDeposit = ();
}

impl pallet_aura::Config for Runtime {
Expand Down
3 changes: 2 additions & 1 deletion cumulus/parachains/runtimes/testing/penpal/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -751,7 +751,6 @@ parameter_types! {
pub const Period: u32 = 6 * HOURS;
pub const Offset: u32 = 0;
}

impl pallet_session::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type ValidatorId = <Self as frame_system::Config>::AccountId;
Expand All @@ -765,6 +764,8 @@ impl pallet_session::Config for Runtime {
type Keys = SessionKeys;
type DisablingStrategy = ();
type WeightInfo = ();
type Currency = Balances;
type KeyDeposit = ();
}

impl pallet_aura::Config for Runtime {
Expand Down
2 changes: 2 additions & 0 deletions polkadot/runtime/rococo/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,8 @@ impl pallet_session::Config for Runtime {
type Keys = SessionKeys;
type DisablingStrategy = ();
type WeightInfo = weights::pallet_session::WeightInfo<Runtime>;
type Currency = Balances;
type KeyDeposit = ();
}

pub struct FullIdentificationOf;
Expand Down
5 changes: 3 additions & 2 deletions polkadot/runtime/test-runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ use frame_election_provider_support::{
use frame_support::{
construct_runtime, derive_impl,
genesis_builder_helper::{build_state, get_preset},
pallet_prelude::Get,
parameter_types,
traits::{KeyOwnerProofSystem, WithdrawReasons},
PalletId,
Expand Down Expand Up @@ -79,7 +78,7 @@ use polkadot_runtime_common::{
use polkadot_runtime_parachains::reward_points::RewardValidatorsWithEraPoints;
use sp_authority_discovery::AuthorityId as AuthorityDiscoveryId;
use sp_consensus_beefy::ecdsa_crypto::{AuthorityId as BeefyId, Signature as BeefySignature};
use sp_core::{ConstBool, ConstU32, ConstUint, OpaqueMetadata};
use sp_core::{ConstBool, ConstU32, ConstUint, Get, OpaqueMetadata};
use sp_mmr_primitives as mmr;
use sp_runtime::{
curve::PiecewiseLinear,
Expand Down Expand Up @@ -340,6 +339,8 @@ impl pallet_session::Config for Runtime {
type Keys = SessionKeys;
type DisablingStrategy = pallet_session::disabling::UpToLimitWithReEnablingDisablingStrategy;
type WeightInfo = ();
type Currency = Balances;
type KeyDeposit = ();
}

impl pallet_session::historical::Config for Runtime {
Expand Down
2 changes: 2 additions & 0 deletions polkadot/runtime/westend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -538,6 +538,8 @@ impl pallet_session::Config for Runtime {
type Keys = SessionKeys;
type DisablingStrategy = pallet_session::disabling::UpToLimitWithReEnablingDisablingStrategy;
type WeightInfo = weights::pallet_session::WeightInfo<Runtime>;
type Currency = Balances;
type KeyDeposit = ();
}

impl pallet_session::historical::Config for Runtime {
Expand Down
Loading
Loading