When we generate two two runtime wasm blobs using two above approaches, and then we use chain-spec-builder display-preset util to get the json preset representation, and we display the diff, we will get following:
So the preset constructed from the full RuntimeGenesisConfig struct contains some fields that are just defaults and were not actually customized.
In practice, in most cases that should not matter, but it potentially may lead to some strange behavior - e.g. imagine fetching the preset to the file, then using it to against different runtime version (e.g. newer version with transactionPayment::multiplier updated) where defaults are changed may lead to some strange situation.
On the other hand - using JSON approach may lead to invalid JSON (and we would addition coverage in tests).
Probably not super important, but wanted to know your opinion on that, so I am leaving it here for your consideration.
This is about how to provide preset's JSON and what is potential outcome.
There are two approaches.
JSON blob, containing only overridden fields
``` fn preset() -> serde_json::Value { serde_json::json!({ "balances": BalancesConfig { balances: endowed_accounts.iter().cloned().map(|k| (k, 1u128 << 60)).collect::and second:
full `RuntimeGenesisConfig` blob, containing defaults and overwritten fields:
``` fn preset() -> serde_json::Value { let config = RuntimeGenesisConfig { balances: BalancesConfig { balances: endowed_accounts .iter() .cloned() .map(|k| (k, 1u128 << 60)) .collect::When we generate two two runtime wasm blobs using two above approaches, and then we use
chain-spec-builder display-preset
util to get the json preset representation, and we display the diff, we will get following:So the preset constructed from the full
RuntimeGenesisConfig
struct contains some fields that are just defaults and were not actually customized.In practice, in most cases that should not matter, but it potentially may lead to some strange behavior - e.g. imagine fetching the preset to the file, then using it to against different runtime version (e.g. newer version with
transactionPayment::multiplier
updated) where defaults are changed may lead to some strange situation.On the other hand - using JSON approach may lead to invalid JSON (and we would addition coverage in tests).
tagging @kianenigma , @bkchr.
Originally posted by @michalkucharczyk in https://github.com/paritytech/polkadot-sdk/issues/5327#issuecomment-2343335131