Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add possibility to inject non-authorities session-keys in genesis #5078

Merged
merged 23 commits into from
Jul 29, 2024

Conversation

girazoki
Copy link
Contributor

Add the possibility of injecting session-keys in genesis for non-validators. Currently all keys injected in genesis were considered as part of the initial validators set, this PR allows to inject a new vector with non-authority keys

@girazoki girazoki requested a review from a team as a code owner July 19, 2024 12:54
substrate/frame/session/src/lib.rs Show resolved Hide resolved
substrate/frame/session/src/lib.rs Outdated Show resolved Hide resolved
@bkchr bkchr added T1-FRAME This PR/Issue is related to core FRAME, the framework. T2-pallets This PR/Issue is related to a particular pallet. and removed T1-FRAME This PR/Issue is related to core FRAME, the framework. labels Jul 19, 2024
Copy link
Member

@davxy davxy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically looks good

Comment on lines 428 to 429
/// List of (AccountId, ValidatorId, Keys) that will be registered at genesis, but not as active validators.
pub non_authority_keys: Vec<(T::AccountId, T::ValidatorId, T::Keys)>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO is worth being explicit that these keys (together with keys) will end up in the NextKeys set. I.e. keys that are registered as candidates for session after next session (session # 2).

And technically these are still authorities (well, authority candidates). So maybe a more appropriate name? Don't know registered_candidates? But naming is hard so I may be biased :-D

Copy link
Contributor Author

@girazoki girazoki Jul 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I disagree, non_authority_keys are not necessarily authorities, whether they will be authorities it will be decided by SessionManager (even in the session # 2). Just for having keys registered they will not be authorities, unless they SessionManager decides to select them.

As for the naming, I am fine with anything as I am not too biased around it.

Copy link
Member

@davxy davxy Jul 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well.

  1. I agree that these are not necessarily actual authorities, indeed I put in bold that are candidates.
  2. This is not my opinion, if I've not overlooked something, this is just a fact. The inner_set_keys is called, which calls put_keys, which stores your non_authority_keys in NextKeys set, which are the candidates registered

So I still think is worth being explicit about what is the usage of this non_authority_keys list. Otherwise as a user the doc is not super clear.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah got it. Yeah I can add more clarity on that for sure!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright so I added a comment saying that these keys are valid at least until session 2 (maybe valid is not the best word here?), but basically my intention is to say that if there is a session-key change, the first session that would pick these new keys is session number 3

prdoc/pr_5078.prdoc Outdated Show resolved Hide resolved
@bkchr bkchr enabled auto-merge July 22, 2024 19:53
@bkchr
Copy link
Member

bkchr commented Jul 22, 2024

@girazoki CI is not happy.

@girazoki
Copy link
Contributor Author

@girazoki CI is not happy.

will check

auto-merge was automatically disabled July 23, 2024 07:41

Head branch was pushed to by a user without write access

@bkchr
Copy link
Member

bkchr commented Jul 23, 2024

@bkchr
Copy link
Member

bkchr commented Jul 24, 2024

@girazoki CI is still not happy :D

@girazoki
Copy link
Contributor Author

@girazoki CI is still not happy :D

I am really trying xD. Let's see this time

@girazoki girazoki requested a review from acatangiu as a code owner July 26, 2024 07:21
@bkchr bkchr enabled auto-merge July 26, 2024 09:54
auto-merge was automatically disabled July 26, 2024 12:59

Head branch was pushed to by a user without write access

@girazoki
Copy link
Contributor Author

@bkchr I think I fixed everything but I am not sure about what the process is here, let me know if there is anything else I can do for the CI to be happy

@bkchr bkchr enabled auto-merge July 28, 2024 20:49
@paritytech-cicd-pr
Copy link

The CI pipeline was cancelled due to failure one of the required jobs.
Job name: test-linux-stable 2/3
Logs: https://gitlab.parity.io/parity/mirrors/polkadot-sdk/-/jobs/6834875

auto-merge was automatically disabled July 29, 2024 08:46

Head branch was pushed to by a user without write access

@bkchr
Copy link
Member

bkchr commented Jul 29, 2024

Also check-semver is still failing 🙈

@girazoki
Copy link
Contributor Author

Also check-semver is still failing 🙈

That should be easy I think 😄

@girazoki
Copy link
Contributor Author

Also check-semver is still failing 🙈

Or maybe not 🙈, why is semver telling me the crates are not listed in the pr-doc when they are?

@bkchr
Copy link
Member

bkchr commented Jul 29, 2024

Also check-semver is still failing 🙈

Or maybe not 🙈, why is semver telling me the crates are not listed in the pr-doc when they are?

Ahh yeah there was a bug with none. It got fixed, not sure it is already in CI.

@bkchr bkchr added this pull request to the merge queue Jul 29, 2024
Merged via the queue into paritytech:master with commit d6f5987 Jul 29, 2024
158 of 161 checks passed
TarekkMA pushed a commit to moonbeam-foundation/polkadot-sdk that referenced this pull request Aug 2, 2024
…ritytech#5078)

Add the possibility of injecting session-keys in genesis for
non-validators. Currently all keys injected in genesis were considered
as part of the initial validators set, this PR allows to inject a new
vector with non-authority keys

---------

Co-authored-by: Bastian Köcher <[email protected]>
tmpolaczyk pushed a commit to moondance-labs/polkadot-sdk that referenced this pull request Aug 26, 2024
…ritytech#5078)

Add the possibility of injecting session-keys in genesis for
non-validators. Currently all keys injected in genesis were considered
as part of the initial validators set, this PR allows to inject a new
vector with non-authority keys

---------

Co-authored-by: Bastian Köcher <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T2-pallets This PR/Issue is related to a particular pallet.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants