This repository has been archived by the owner on Nov 15, 2023. It is now read-only.
move session handler traits to frame-support #8649
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Will help with paritytech/statemint#43.
Context
For a simple parachain like statemint, we are not going to use staking or session, as they are too complicated. But we still need to use
pallet-aura
. The only easy and sensible way to communicate withpallet-aura
is to register it in the list ofSessionHandler
somewhere. This is exactly how relay chains work.Now, I want a new pallet like
parachain-selection
to act like the combination of staking and session for a parachain, and select some collators in some simple way everyN
block and report them topallet-aura
.All of this works, but it has two flaws:
SessionHandler
trait was defined inpallet-session
and in order to reuse it I had to import it, which was not good.SessionHandler
was defined inpallet-session
: its API is exposingqueued_validators
which is specific topallet-session
. And what I have done now is breaking this. I am not happy with this but in short term I think it is okay and I will make a follow up issue with further details. Essentially, we need to convertSessionHandler
trait to something more generic, so that other chains can write their own custompallet-session
, but still be able to use ouraura
(andgrandpa
,babe
,authority-discovery
pallets). This will need to also change theOneSessionHandler
.If it makes anyone happier, I can think of something like this, we could make the
queued_validator
anOption
and that's already a good step, but tbh I felt like it doesn't make a big difference at this point and a big revamp is needed.I also removed a bunch of useless
TestSessionHandler
s here and there.