git.delta.rocks / unique-network / refs/commits / 0602b8017b0f

difftreelog

refactor(collator-selection) session config

Fahrrader2022-08-26parent: #06a95fc.patch.diff
in: master

4 files changed

modifiedruntime/common/config/substrate.rsdiffbeforeafterboth
35 runtime_common::DealWithFees, Runtime, Event, Call, Origin, PalletInfo, System, Balances,35 runtime_common::DealWithFees, Runtime, Event, Call, Origin, PalletInfo, System, Balances,
36 Treasury, SS58Prefix, Aura, Session, SessionKeys, CollatorSelection, Version,36 Treasury, SS58Prefix, Aura, Session, SessionKeys, CollatorSelection, Version,
37};37};
38use xcm::v1::BodyId;
39use up_common::{types::*, constants::*};38use up_common::{types::*, constants::*};
4039
41parameter_types! {40parameter_types! {
218}217}
219218
220parameter_types! {219parameter_types! {
221 pub const Period: u32 = 6 * HOURS;220 pub const SessionPeriod: BlockNumber = 6 * HOURS;
222 pub const Offset: u32 = 0;221 pub const SessionOffset: BlockNumber = 0;
223 //pub const MaxAuthorities: u32 = 100_000;
224}222}
225223
226impl pallet_session::Config for Runtime {224impl pallet_session::Config for Runtime {
227 type Event = Event;225 type Event = Event;
228 type ValidatorId = <Self as frame_system::Config>::AccountId;226 type ValidatorId = <Self as frame_system::Config>::AccountId;
229 // we don't have stash and controller, thus we don't need the convert as well.227 // we don't have stash and controller, thus we don't need the convert as well.
230 type ValidatorIdOf = pallet_collator_selection::IdentityCollator;228 type ValidatorIdOf = pallet_collator_selection::IdentityCollator;
231 type ShouldEndSession = pallet_session::PeriodicSessions<Period, Offset>;229 type ShouldEndSession = pallet_session::PeriodicSessions<SessionPeriod, SessionOffset>;
232 type NextSessionRotation = pallet_session::PeriodicSessions<Period, Offset>;230 type NextSessionRotation = pallet_session::PeriodicSessions<SessionPeriod, SessionOffset>;
233 type SessionManager = CollatorSelection;231 type SessionManager = CollatorSelection;
234 // Essentially just Aura, but lets be pedantic.232 // Essentially just Aura, but lets be pedantic.
235 type SessionHandler = <SessionKeys as sp_runtime::traits::OpaqueKeys>::KeyTypeIdProviders;233 type SessionHandler = <SessionKeys as sp_runtime::traits::OpaqueKeys>::KeyTypeIdProviders;
252 pub const PotId: PalletId = PalletId(*b"PotStake");250 pub const PotId: PalletId = PalletId(*b"PotStake");
253 pub const MaxCandidates: u32 = 1000;251 pub const MaxCandidates: u32 = 1000;
254 pub const MinCandidates: u32 = 5;252 pub const MinCandidates: u32 = 5;
255 pub const SessionLength: BlockNumber = 6 * HOURS;
256 pub const MaxInvulnerables: u32 = 100;253 pub const MaxInvulnerables: u32 = 100;
257 pub const ExecutiveBody: BodyId = BodyId::Executive;
258}254}
259
260// We allow root only to execute privileged collator selection operations.
261pub type CollatorSelectionUpdateOrigin = EnsureRoot<AccountId>;
262255
263impl pallet_collator_selection::Config for Runtime {256impl pallet_collator_selection::Config for Runtime {
264 type Event = Event;257 type Event = Event;
265 type Currency = Balances;258 type Currency = Balances;
259 // We allow root only to execute privileged collator selection operations.
266 type UpdateOrigin = CollatorSelectionUpdateOrigin;260 type UpdateOrigin = EnsureRoot<AccountId>;
267 type PotId = PotId;261 type PotId = PotId;
268 type MaxCandidates = MaxCandidates;262 type MaxCandidates = MaxCandidates;
269 type MinCandidates = MinCandidates;263 type MinCandidates = MinCandidates;
270 type MaxInvulnerables = MaxInvulnerables;264 type MaxInvulnerables = MaxInvulnerables;
271 // should be a multiple of session or things will get inconsistent265 // Should be a multiple of session or things will get inconsistent.
272 type KickThreshold = Period;266 type KickThreshold = SessionPeriod;
273 type ValidatorId = <Self as frame_system::Config>::AccountId;267 type ValidatorId = <Self as frame_system::Config>::AccountId;
274 type ValidatorIdOf = pallet_collator_selection::IdentityCollator;268 type ValidatorIdOf = pallet_collator_selection::IdentityCollator;
275 type ValidatorRegistration = Session;269 type ValidatorRegistration = Session;
modifiedtests/package.jsondiffbeforeafterboth
75 "testScheduler": "mocha --timeout 9999999 -r ts-node/register ./**/scheduler.test.ts",75 "testScheduler": "mocha --timeout 9999999 -r ts-node/register ./**/scheduler.test.ts",
76 "testSchedulingEVM": "mocha --timeout 9999999 -r ts-node/register ./**/eth/scheduling.test.ts",76 "testSchedulingEVM": "mocha --timeout 9999999 -r ts-node/register ./**/eth/scheduling.test.ts",
77 "testXcmTransfer": "mocha --timeout 9999999 -r ts-node/register ./**/xcmTransfer.test.ts",77 "testXcmTransfer": "mocha --timeout 9999999 -r ts-node/register ./**/xcmTransfer.test.ts",
78 "testShuffleCollators": "mocha --timeout 9999999 -r ts-node/register ./**/shuffleCollators.test.ts",78 "testCollatorSelection": "mocha --timeout 9999999 -r ts-node/register ./**/collatorSelection.test.ts",
79 "testPalletPresence": "mocha --timeout 9999999 -r ts-node/register ./**/pallet-presence.test.ts",79 "testPalletPresence": "mocha --timeout 9999999 -r ts-node/register ./**/pallet-presence.test.ts",
80 "testBlockProduction": "mocha --timeout 9999999 -r ts-node/register ./**/block-production.test.ts",80 "testBlockProduction": "mocha --timeout 9999999 -r ts-node/register ./**/block-production.test.ts",
81 "testEnableDisableTransfers": "mocha --timeout 9999999 -r ts-node/register ./**/enableDisableTransfer.test.ts",81 "testEnableDisableTransfers": "mocha --timeout 9999999 -r ts-node/register ./**/enableDisableTransfer.test.ts",
addedtests/src/collatorSelection.test.tsdiffbeforeafterboth

no changes

deletedtests/src/shuffleCollators.test.tsdiffbeforeafterboth

no changes