1

I am wondering if it is possible to set a value to an arbitrary storage key at genesis.

Let's say I want to populate the key 0x3fba98689ebed1138735e0e7a5a790abee99a84ccbfb4b82e714617e5e06f6f7 at genesis, but this key is not part of any GenesisConfig of any pallet I have installed in my runtime.

Is there a way to work around this ?

3
  • The key I have chosen for the question is not the concrete key I am trying to mutate, is just an example. Sep 28, 2022 at 9:04
  • I think you can edit the genesis spec file. What is your use-case? When do you need the insertion to happen? Sep 28, 2022 at 9:08
  • Indeed, editing the spec file was my first idea. Sep 29, 2022 at 9:19

1 Answer 1

2

Just insert the key/value into chain_spec["genesis"]["raw"]["top"].

This is what Subalfred does to fork off the chain https://github.com/hack-ink/subalfred/blob/3994cfe31dd13d3aaf757503da3e73afd186c319/src/subalfred/core/state/fork_off.rs#L142.

3

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.