-
Notifications
You must be signed in to change notification settings - Fork 36
Updating Nimbus SessionKey is ignored. Client continues proposing new blocks with the old key on runtime upgrade #75
Comments
The client will author with the first eligible session key it finds. If a single client has two eligible session keys in its keystore, there is no guarantee which one it will try first. I've bolded the word elegible in the previous paragraph, because the client calls a runtime api to ask the runtime whether a particular session key is eligible before authoring with it. You could, and probably should, make your runtime logic such that when you insert a new session key, it removes the old one, so they are not both eligible. For example, moonbeam's pallet author mapping has this extrinsic. |
This should not happen in normal operation. If you are using |
Oh, I see the code you mentioned. It's The Now the trouble we're running into is that we have the During testing with a In the special case of well-known keys, there is no way to remove the alice key from the keystore ( because it's not stored in the I expect the same problem to happen with the live chain, if community members run During normal operation (i.e. not right after a RT upgrade) i can actually see it working correctly, trying AccountLookup with both keys
but on the first block following the runtime upgrade it's just
=> RT panics with |
@Garandor the solution is to add a new configuration field |
Thanks, I'll do that. However, in the short term we'd like to release (our node with) a workaround. Are there any drawbacks to consider if we just remove the |
I think it will solve your problem in the short term, I don't see any contraindication, but you have to test it of course |
As I wrote in #4, I think a better approach would be pub enum SkipPrediction {
Always,
Never,
AfterRuntimeUpgade,
} |
I'm seeing that after calling
setKeys
to update the node's Nimbus key, the node continues proposing with the old SessionKey.Our implementation of
AccountLookup
usespallet_session::key_owner
to map NimbusId -> AccountId, so the Nimbus key must match what's set inpallet_session::queuedKeys
for the node to produce valid blocks.Because of this, our
polkadot-launch --chain parachain-local
nodes can not start block production after a chain upgrade that enables nimbus on a chain that didn't use it beforeExpected Results
The node queries the
current
nimbus key from the runtime and uses that to authorAnalysis
The fn the client uses to build the digest is
nimbus_consensus::seal_header
nimbus-consensus/src/lib.rs which callsSyncCryptoStore::sign_with
Rustdocs of
sign_with
stateNow the problem is that the two ways to change your node's session keys -
author_rotateKeys
andauthor_insertKey
both internally callSessionKeys::generate_session_keys
which adds the new keys to the Crypto store, but does NOT remove the old keys.So after running one of the above, there will be multiple keys in store matching the
nmbs
session key type and Nimbus Consensus implicitly picks the first one to propose blocks, which then get rejected by the runtime as they don't match the key set inpallet_session::queuedKeys
, preventing the node from producing blocks.Workaround
keystore
folder and manually delete all old nimbus key that don't match what you have provided to the most recent call ofsetKeys
. Nimbus keys start with6e6d6273
( nmbs in hex ) and have the public key after that.This is extra problematic on
polkadot-launch --chain something-local
deployments with the--alice
etc. nodes as their well-known keys are not held in thekeystore
on the filesystem and thus can not be deleted.The text was updated successfully, but these errors were encountered: