Skip to content

session_keys: offline author_insertKey path for pre-#1739 node binaries - #153

Merged
iulianbarbu merged 1 commit into
mainfrom
fix-session-key-gen-for-v2-only
Jul 30, 2026
Merged

session_keys: offline author_insertKey path for pre-#1739 node binaries#153
iulianbarbu merged 1 commit into
mainfrom
fix-session-key-gen-for-v2-only

Conversation

@iulianbarbu

Copy link
Copy Markdown
Contributor

A stable2512 node cannot generate session keys against versi's post-#1739 runtime: the SessionKeys API changed v1->v2, so the node's v1 generate_session_keys call decodes wrong and traps (wasm unreachable), which TM's rotate RPC cannot work around.

Add an offline path that bypasses that runtime API: derive the six SessionKeys from deterministic raw seeds, insert each into the node keystore via author_insertKey, and build the ownership proof offline - per-key signatures over the POP_-tagged stash account id, concatenated in SessionKeys order. sr25519/ed25519 sign the raw statement; the ecdsa/beefy key signs blake2_256(statement) via eth_keys (substrateinterface's ecdsa sign uses keccak). Raw seeds avoid substrateinterface's ecdsa derivation only accepting BIP44 paths, and the node derives the same key from the same 0x-seed SURI.

Both registration flows fall back to this path when RPC rotation fails. Validated end-to-end: a post-#1739 runtime's set_keys accepts the offline proof (new test).

A stable2512 node cannot generate session keys against versi's post-#1739
runtime: the SessionKeys API changed v1->v2, so the node's v1
generate_session_keys call decodes wrong and traps (wasm unreachable),
which TM's rotate RPC cannot work around.

Add an offline path that bypasses that runtime API: derive the six
SessionKeys from deterministic raw seeds, insert each into the node
keystore via author_insertKey, and build the ownership proof offline -
per-key signatures over the POP_-tagged stash account id, concatenated in
SessionKeys order. sr25519/ed25519 sign the raw statement; the ecdsa/beefy
key signs blake2_256(statement) via eth_keys (substrateinterface's ecdsa
sign uses keccak). Raw seeds avoid substrateinterface's ecdsa derivation
only accepting BIP44 paths, and the node derives the same key from the
same 0x-seed SURI.

Both registration flows fall back to this path when RPC rotation fails.
Validated end-to-end: a post-#1739 runtime's set_keys accepts the
offline proof (new test).
@iulianbarbu
iulianbarbu merged commit be16c16 into main Jul 30, 2026
6 of 7 checks passed
@iulianbarbu
iulianbarbu deleted the fix-session-key-gen-for-v2-only branch July 30, 2026 15:53
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.

2 participants