I am running a solo chain with Genesis authorities set up for AURA and GRANPA. Now I have to add new validators and for that, I am planning to add substrate_validator_set and pallet_session.
During OnRuntimeUpgrade what is the correct way to set Keys
storage item in pallet_session
?
Add a comment
|
1 Answer
You can follow this code to set up the session keys during a runtime upgrade.
- https://github.com/polkadot-fellows/runtimes/blob/6334588c9db0115f6b3445ce11d02a457275b34b/relay/polkadot/src/lib.rs#L1697
- https://github.com/polkadot-fellows/runtimes/blob/6334588c9db0115f6b3445ce11d02a457275b34b/relay/polkadot/src/lib.rs#L455-L479
However, there is a distinction.
BEEFY is an optional feature that allows the use of a placeholder key for genesis.
In contrast, AURA is mandatory. You must pre-generate the keys, put them into code and the validator nodes. Otherwise, your chain will probably be bricked after the runtime upgrade.
-
The shared example describes the change in session_keys but i am adding pallet_session first time. can you please share such example. Commented Jan 17 at 10:07
-
should i need to set Aura authorities again during migration ? Commented Jan 17 at 14:52
-
Follow that example. Replace
storage::translate
withstorage::put
orstorage::insert
, depending on your needs.– aurexav ♦Commented Jan 17 at 16:25 -
Based on my current understanding, you don't need to reset the AURA authorities. However, you should always test these on your testnet first.– aurexav ♦Commented Jan 17 at 20:24