1

Is is possible to add/delete session keys directly to the raw chain specs instead of plain chain specs?

1 Answer 1

3

Yep. That's possible.

For example:

QueuedKeys

/// The queued keys for the next session. When the next session begins, these keys
/// will be used to determine the validator's session keys.
#[pallet::storage]
#[pallet::getter(fn queued_keys)]
pub type QueuedKeys<T: Config> = StorageValue<_, Vec<(T::ValidatorId, T::Keys)>, ValueQuery>;

T::ValidatorId is the AccountId which you configured in the runtime. T::Keys is the SessionKeys which you configured in the runtime.

let validator_id = H256::default();
let session_keys = SessionKeys { ..Default::default() };
let queued_keys = vec![(validator_id, session_keys)].encode();
let hex = array_bytes::bytes2hex("0x", queued_keys);

println!("{hex}");

Use Subalfred, PolkadotJS or any other tools to get the storage key.

λ subalfred storage-key --pallet Session --item QueuedKeys
0xcec5070d609dd3497f72bde07fc96ba0e0cdd062e6eaf24295ad4ccfc41d4609

Open the raw JSON file, and search 0xcec5070d609dd3497f72bde07fc96ba0e0cdd062e6eaf24295ad4ccfc41d4609. Change its value to println!("{hex}");'s output.

And you need to do this for the other necessary storage as well.

Your Answer

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

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