Skip to content

Conversation

ladamesny
Copy link
Contributor

@ladamesny ladamesny commented Jul 23, 2025

Description

Overview

Added a new automatic-generate-keys command that automatically generates session keys by connecting to a running Partner Chain node via RPC, eliminating the need for manual key generation and parsing. Jira Ticket ETCM-11971

Implementation Details

Command Structure:

  • New command: partner-chains-cli automatic-generate-keys --url <NODE_URL>
  • Default URL: http://localhost:9933
  • Outputs session keys with correct type identifiers to session_keys.json
  • Technical Approach:

Uses a clean two-RPC-call approach:

  1. author_rotateKeys - Generates new session keys on the node
  2. sessionKeys_decodeSessionKeys - Decodes the keys to get exact key types and public keys

Key Benefits:

✅ No assumptions - Node provides actual key types (e.g., "gran", "imon", "aura")
✅ Runtime-agnostic - Works with any SessionKeys configuration
✅ No manual parsing - Node handles all SCALE decoding internally
✅ Always accurate - Impossible to get key order wrong

Checklist

  • Commit sequence broadly makes sense and commits have useful messages.
  • The size limit of 400 LOC isn't needlessly exceeded
  • The PR refers to a JIRA ticket (if one exists)
  • New tests are added if needed and existing tests are updated.
  • New code is documented and existing documentation is updated.
  • Relevant logging and metrics added
  • Any changes are noted in the changelog.md for affected crate
  • Self-reviewed the diff

@ladamesny ladamesny changed the title feat(cli): add automatic-generate-keys command and improve key genera… feat: add automatic-generate-keys command to partner-chains CLI Jul 23, 2025
@ladamesny
Copy link
Contributor Author

Replaces this PR: #867

@ladamesny ladamesny requested a review from Klapeyron July 23, 2025 14:54
@ladamesny ladamesny self-assigned this Jul 23, 2025
@ladamesny ladamesny marked this pull request as ready for review July 23, 2025 15:10
@AmbientTea AmbientTea self-requested a review July 28, 2025 09:23
@ladamesny ladamesny force-pushed the feat/automatic-generate-keys-final branch 2 times, most recently from 8658932 to 2b654ab Compare July 30, 2025 12:04
@ladamesny ladamesny force-pushed the feat/automatic-generate-keys-final branch from 2b654ab to 1acab37 Compare August 11, 2025 14:14
…tion UX

- Introduced  command to partner-chains-cli:
  - Generates and saves session keys by connecting to a running node via RPC ()
  - Decodes session keys using the runtime API, supports modern and legacy formats, and saves to keystore and JSON
  - Provides fallback and error handling for various runtime formats
- Integrated the new command into the CLI as an alternative to  for all roles (Governance Authority, Registered Validator, Permissioned Validator)
- Updated CLI help message and workflow documentation to clearly present both key generation methods and when to use each
- Added comprehensive test suite for SCALE decoding and key handling logic
- Updated changelog with details of the new feature and related improvements
- Updated Cargo.toml and workspace dependencies for ,  (with serde), and related requirements
@ladamesny ladamesny force-pushed the feat/automatic-generate-keys-final branch from ea6e0dc to b518140 Compare August 13, 2025 15:14
@ladamesny ladamesny force-pushed the feat/automatic-generate-keys-final branch from b518140 to 1fccb55 Compare August 13, 2025 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant