Description
The GenesisConfig
is currently one of the only things for that we still require the native runtime. It isn't compiled for wasm right now. We also require the native runtime to load a GenesisConfig
from a JSON file and as the GenesisConfig
can change with newer native runtimes we got the raw chain spec that only contains the key/value storage pairs of the genesis block. When we remove the native runtime we need a new way to handle the GenesisConfig
.
I propose that we put the GenesisConfig
into the genesis wasm. This means that we start compiling the GenesisConfig
for wasm, but I would put this behind some rust feature. So, the normal production builds should not include the GenesisConfig
anymore. This is done to reduce the size of the wasm binary. I would also keep supporting the serialization of the GenesisConfig
into JSON. If the GenesisConfig
is part of the genesis wasm, we have some nice advantages. The first one being that we could keep the JSON serialized GenesisConfig
in the chain spec and even distribute this chain spec as we would call into the genesis wasm to parse and generate the genesis block. This would require that we move out the genesis wasm from the actual genesis field in the chain spec to some dedicated field from where we can load the wasm binary. Another advantage would be that we could finally make the chain-spec-builder
work properly. Currently this binary isn't really working for chain specs that aren't build from the kitchensink-runtime
. The chain-spec-builder
could be passed some crate name that belongs to some runtime and then it would generate the chain spec for this runtime. We could also enable certain features in the runtime etc.
To build what I outlined above, we would need the following:
- Make
GensisConfig
build in wasm. This will require supportingserde
in the wasm build to serialize/deserialize theGenesisConfig
to/from JSON. - Add a new runtime api
GenesisBuilder
(better name should be found) that can be used to build the genesis config, load it etc. - Change the chain spec to have a dedicated field for the
code
. - Conditionally compile
GenesisConfig
into the wasm binary. By default theGenesisConfig
should probably be compiled into the wasm binary. When doing a on-chain build there should exist a feature to disable theGenesisConfig
.
Part of: #62
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Status