Currently my chain(solo-chain) is on production which is working on POA. Now I have integrated the staking pallet after then when i am going to upgrade that code in the old prod chain by runtime upgrade then its not working, mean the continue running in POA.

If i am starting the chain then its starting as expected and block selection is happening from staking as it should be.

Its happening because in chainspec we have updated the necessary changes like added the initial authorities to the staking instead of AURA and Grandpa.

Changes i did in chainspec.rs Previously we were giving initial authorities(aura and grandpa keys of validators) to Aura and grandpa. now we put aura and grandpa in default and giving authorities in staking and session.

            aura: Default::default(),
            grandpa: Default::default(),
            staking: node_runtime::StakingConfig {
                candidates: initial_authorities
                    .map(|(acc, _, _, _)| (acc, candidate_stake))
                    .collect(), //todo
                delegations: vec![],
                inflation_config: inflation_config(70, 5),
                blocks_per_round: 5,
                validator_commission: Perbill::from_percent(70),
                chain_bond_reserve_percent: Percent::from_percent(30),
                num_selected_candidates: NUM_SELECTED_CANDIDATES,
            session: node_runtime::SessionConfig {
                keys: initial_authorities
                    .map(|x| (x.0.clone(), x.0.clone(), session_keys(x.2.clone(), x.3.clone())))

How to make similar changes like we did in chainspec by runtime upgrade?

  • The chain spec is the chain specification for when you start your chain. In your case, your chain is already running and you want to add pallets. You could look at calling extrinsics (e.g. set_keys) to populate your storage and/or perform a migration as part of the runtime upgrade.
    – Bruno
    Nov 3, 2023 at 22:53

1 Answer 1


One very important thing to notice is that the values you specify in your chain spec are the genesis configuration. They are the initial conditions. They describe the world when the chain begins to run. They are never used again after that. Changing them after the chain launches not only "doesn't work", it actually specifies a brand new separate blockchain with its own genesis and history.

I'm not 100% clear what you are trying to migrate from and what you are trying to migrate to. But the way to do it is through a runtime migration, not by changing the genesis configuration in the chain spec.

Here is a jumping off point in the docs about storage migrations https://paritytech.github.io/polkadot-sdk/master/frame_support/storage/migration/index.html

  • 1
    In POA we were giving aura and grandpa keys in there pallet configuration. Now as we need to give those aura/grandpa keys with there account ids to sessions pallet. So we would need to migrate the that keys.
    – Pankaj
    Nov 6, 2023 at 6:00
  • @Pankaj can you share some example code to change aura/grandpa keys with session pallet? Jan 11 at 16:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.