Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Improve pallet-session/pallet-staking for computation of initial era #8911

Open
gui1117 opened this issue May 26, 2021 · 2 comments
Open

Improve pallet-session/pallet-staking for computation of initial era #8911

gui1117 opened this issue May 26, 2021 · 2 comments

Comments

@gui1117
Copy link
Contributor

gui1117 commented May 26, 2021

At genesis this is how the initial validator set and its exposures are computed:

  • if the election succeed but gives 0 validators, or if the election fail then a new era is planned with no exposures, and pallet session will use all the validator who have session keys for the validator set of the initial era.
  • if the election succeed and gives more than minimum validators, then pallet session will use those validators.

If we want to implement #2494 (comment) the first way doesn't work anymore. Instead the initial era wouldn't be created.

To solve this we can:

  • allow 0 validators and no exposure for the initial era only. (easy but dirty solution IMHO).
  • add a new genesis config field to optionally give the initial era validator set and exposures. This initial era validator set and exposures will be used for the initial era instead of computing the election. And pallet session will always use the validator set returned by new_session for its initial session.
    Note: allow to add the initial era validator set and exposures is mandatory if the election pallet is configured with no on chain fallback. Indeed, if the election pallet needs offchain submission then it can't compute any solution during genesis build.
@stale
Copy link

stale bot commented Jul 7, 2021

Hey, is anyone still working on this? Due to the inactivity this issue has been automatically marked as stale. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the A5-stale Pull request did not receive any updates in a long time. No review needed at this stage. Close it. label Jul 7, 2021
@gui1117
Copy link
Contributor Author

gui1117 commented Jul 8, 2021

should be fixed by #8984 I should finish the PR

@stale stale bot removed the A5-stale Pull request did not receive any updates in a long time. No review needed at this stage. Close it. label Jul 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant