feat: generic session keys & session pallet migration of PR 1105#1802
feat: generic session keys & session pallet migration of PR 1105#1802Klapeyron wants to merge 20 commits into
Conversation
This comment has been minimized.
This comment has been minimized.
e23cb20 to
416fae4
Compare
0faf3d6 to
64e096b
Compare
416fae4 to
859dce2
Compare
6159020 to
bdfa554
Compare
5fd4ffe to
cea9145
Compare
a70b538 to
f8ddf13
Compare
ab415db to
09bae27
Compare
f8ddf13 to
c8769f1
Compare
09bae27 to
8d6f574
Compare
c8769f1 to
7e0ee9a
Compare
8d6f574 to
b2cdd43
Compare
7e0ee9a to
87b7696
Compare
b2cdd43 to
fdde417
Compare
87b7696 to
4c09ae9
Compare
fdde417 to
3a22652
Compare
4c09ae9 to
5c81892
Compare
|
|
||
| ## Added | ||
|
|
||
| * Added `partner-chains-node smart-contracts upsert-script` command for inserting and updating versioned scripts. |
3a22652 to
eb8cedb
Compare
5c81892 to
36e8f43
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 36e8f43bbc
ℹ️ 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".
| //! | ||
| //! impl From<LegacyAuthorityKeys> for SessionKeys { | ||
| //! fn from(old: LegacyAuthorityKeys) -> Self { | ||
| //! SessionKeys { aura: old.aura, grandpa: old.grandpa, beefy: ecdsa::Public::default().into() } |
There was a problem hiding this comment.
Use per-validator placeholders for added keys
When this example is followed for an upgrade that adds Beefy, every validator is assigned the same default Beefy key. pallet_session::upgrade_keys rewrites KeyOwner for each new key, so a shared added key leaves ownership pointing at whichever validator is processed last, and the migration's try-runtime checks currently skip newly added key types. Use a deterministic per-validator placeholder/derived key in the example, or explicitly require uniqueness, so chains do not copy a migration that corrupts new-key ownership.
Useful? React with 👍 / 👎.
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>
Signed-off-by: Tomasz Bartos <tomasz.bartos@shielded.io>
Signed-off-by: Tomasz Bartos <tomasz.bartos@shielded.io>
…ement pallet (#1105) Signed-off-by: Tomasz Bartos <tomasz.bartos@shielded.io>
…ith midnight-node's runtime Signed-off-by: Tomasz Bartos <tomasz.bartos@shielded.io>
…align with midnight-node's runtime Signed-off-by: Tomasz Bartos <tomasz.bartos@shielded.io>
36e8f43 to
7157802
Compare
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Overview
🗹 TODO before merging
📌 Submission Checklist
git commit -s) for the DCO🧪 Testing Evidence
Please describe any additional testing aside from CI:
🔱 Fork Strategy
Links