feat: generic session keys & session pallet migration of PR 1026#1800
Merged
Conversation
This comment has been minimized.
This comment has been minimized.
LGLO
reviewed
Jul 2, 2026
LGLO
reviewed
Jul 2, 2026
LGLO
reviewed
Jul 2, 2026
LGLO
reviewed
Jul 2, 2026
Signed-off-by: Tomasz Bartos <tomasz.bartos@shielded.io>
Two gaps between upstream's partner-chains pallet-session version and the polkadot-stable2603 one pinned in midnight-node's workspace: - pallet_session::Config requires Currency/KeyDeposit associated types under stable2603; upstream's version at the time of this PR didn't need them yet. Added to committee-selection/pallet's own mock.rs (demo/runtime's mock and the pallet itself already had this fixed by the squash commit; this pallet mock.rs still needed it). - pretty_assertions dev-dependency missing from demo/runtime/Cargo.toml. Assisted-by: Claude:claude-sonnet-4-6 Signed-off-by: Tomasz Bartos <tomasz.bartos@shielded.io>
Signed-off-by: Tomasz Bartos <tomasz.bartos@shielded.io>
Signed-off-by: Tomasz Bartos <tomasz.bartos@shielded.io>
…n; wire pallet_session historical bypass for automatic key registration PR #1025 deletes the pallet-partner-chains-session crate from partner-chains/, which midnight-node's own runtime and node depend on directly (outside the partner-chains/ subtree). Migrate to the same approach used within partner-chains/demo/runtime: wire pallet_session::Config directly, with ShouldEndSession/SessionManager delegated to SessionCommitteeManagement (pallet_session_validator_management), which implements them via pallet_session_support.rs. - runtime/src/lib.rs, mock.rs: replace impl_pallet_session_config! macro and the old dual PalletSession(stub)+Session(real) pallet setup with a single pallet_session::Config impl wired to SessionCommitteeManagement. Removes the now-dead session_manager module (ValidatorManagementSessionManager), whose role is filled directly by the committee-selection pallet. - node/src/chain_spec/mod.rs: update genesis construction for pallet_session's real GenesisConfig{keys, non_authority_keys} shape; drop the leftover PalletSessionConfig field for the removed stub pallet. - Cargo.toml, runtime/Cargo.toml: drop the pallet-partner-chains-session dependency. Separately, PR #1026's automatic key registration (pallet_session_support.rs's register_committee_keys) dispatches pallet_session::set_keys with an empty ownership proof. That's a no-op against upstream's pinned polkadot-stable2509, where OpaqueKeys::ownership_proof_is_valid defaults to true, but our workspace pins polkadot-stable2603, where impl_opaque_keys! generates a real proof-of-possession check, so every automatic registration silently failed (the error is logged, not propagated). polkadot-stable2603 added pallet_session::SessionInterface specifically for this: privileged/internal callers can set keys without an ownership proof, since the caller (not the extrinsic sender) already vouches for the keys. Wire it up: - pallet_session_support.rs: require T: pallet_session::historical::Config (SessionInterface is implemented for Pallet<T> only when historical::Config is also satisfied) and call SessionInterface::set_keys directly instead of dispatching the set_keys extrinsic with an empty proof. - Root Cargo.toml: enable pallet-session's historical feature. - runtime/src/lib.rs, mock.rs, demo/runtime/src/lib.rs, mock.rs, and the committee-selection pallet's own mock.rs: add the Historical pallet to construct_runtime! and implement historical::Config with a trivial FullIdentification = () (we don't use its NPoS/slashing features, only the SessionInterface bypass). - runtime/src/lib.rs tests (check_aura_authorities_rotation, check_grandpa_authorities_rotation): update to the corrected 2-epoch committee-application delay, mirroring partner-chains/demo/runtime's already-updated tests. Real pallet_session's queue-then-apply model adds one full epoch of lag versus the old pallet-partner-chains-session behavior (PR #1038 later reduces this back down). Assisted-by: Claude:claude-sonnet-4-6 Signed-off-by: Tomasz Bartos <tomasz.bartos@shielded.io>
Session set_keys/purge_keys must not be dispatchable; committee keys are registered automatically from Cardano registrations via the session manager. Signed-off-by: Tomasz Bartos <tomasz.bartos@shielded.io>
Signed-off-by: Tomasz Bartos <tomasz.bartos@shielded.io>
Signed-off-by: Tomasz Bartos <tomasz.bartos@shielded.io>
Signed-off-by: Tomasz Bartos <tomasz.bartos@shielded.io>
Signed-off-by: Tomasz Bartos <tomasz.bartos@shielded.io>
Signed-off-by: Tomasz Bartos <tomasz.bartos@shielded.io>
…1038) Signed-off-by: Tomasz Bartos <tomasz.bartos@shielded.io>
…mittee rotation PR #1038 adds an additional session immediately after an epoch-triggered rotation, collapsing the 1-extra-epoch lag from real pallet_session's queue-then-apply model down to roughly 1 extra block. Update check_aura_authorities_rotation and check_grandpa_authorities_rotation in runtime/src/lib.rs to the corrected timing, mirroring the pattern already present in partner-chains/demo/runtime/src/lib.rs's own (upstream-updated) tests for the same PR. Signed-off-by: Tomasz Bartos <tomasz.bartos@shielded.io>
Signed-off-by: Tomasz Bartos <tomasz.bartos@shielded.io>
Signed-off-by: Tomasz Bartos <tomasz.bartos@shielded.io>
Klapeyron
force-pushed
the
feat/pc-pr-1026
branch
from
July 8, 2026 06:37
441bf9c to
1a06f14
Compare
feat: generic session keys & session pallet migration of PR 1025
feat: generic session keys & session pallet migration of PR 1038
Klapeyron
marked this pull request as ready for review
July 8, 2026 07:39
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2b149eff2f
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
LGLO
reviewed
Jul 8, 2026
LGLO
reviewed
Jul 8, 2026
LGLO
approved these changes
Jul 16, 2026
Klapeyron
enabled auto-merge
July 16, 2026 10:43
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Overview
Integrates upstream Partner Chains changes for automatic session key registration (#1026) and removal of
pallet-partner-chains-session(#1025), adapted for midnight-node'spolkadot-stable2603workspace.Partner Chains runtimes now use stock Substrate
pallet_sessiondirectly.pallet_session_validator_management(SessionCommitteeManagement) implementsSessionManagerandShouldEndSessioninline (the oldPalletSessionSupportwrapper andpallet-partner-chains-sessioncrate are removed). Committee members' session keys are registered automatically at genesis and on each committee rotation viapallet_session::SessionInterface::set_keys, so block producers no longer need to callset_keysmanually.Midnight-node-specific wiring:
pallet-partner-chains-sessionto a directpallet_session::Configimpl delegated toSessionCommitteeManagement.pallet_session::historicalis enabled and wired (Historicalpallet +historical::Config) so privilegedSessionInterface::set_keysworks underpolkadot-stable2603's ownership-proof checks (dispatching theset_keysextrinsic with an empty proof silently fails).pallet_sessionextrinsics are disabled via#[runtime::disable_call]; key registration is internal only.session_managermodule (ValidatorManagementSessionManager) is removed.spec_versionbumped to002_001_000; metadata regenerated.🗹 TODO before merging
📌 Submission Checklist
git commit -s) for the DCO🧪 Testing Evidence
Please describe any additional testing aside from CI:
🔱 Fork Strategy
Links