Skip to content

Remove raw chainspecs from master branch

Title was changed from

Refac network features and embeded runtimes

to

Remove raw chainspecs from master branch

After the comments below.


Currently the feature gdev has two meanings:

  • the runtime to build is gdev
  • the node should embed hexadecimal-text-encoded chainspecs defined in a gdev-raw.json file
// Hardcoded raw chainspecs with previously generated values, resulting in a needlessly heavy binary due to hexadecimal-text-encoded values.
#[cfg(feature = "gdev")]
"gdev" => Box::new(chain_spec::gdev::ChainSpec::from_json_bytes(
    &include_bytes!("../specs/gdev-raw.json")[..],
)?),

This would be convenient to split this into two features as suggested for gtest:

// Return hardcoded live chainspecs, only with the embed feature enabled.
// Embed client spec and genesis to avoid embedding hexadecimal runtime
// and having hexadecimal runtime in the git history.
// This will only build on a branch that has a file named ./node/specs/gtest-raw.json.
#[cfg(all(feature = "gtest", feature = "embed"))]
"gtest" => Box::new(chain_spec::gtest::ChainSpec::from_json_bytes(
    &include_bytes!("../specs/gtest-raw.json")[..],
)?),

Advantages would be:

  • no need to commit raw chainspecs on master to be able to build with gdev feature
  • embed feature reserved for network branches which is the only place where raw chainspecs are relevant, and only for a given network

Additionally, the cbor format could be used instead of json to decrease size (TODO measurements). Doing this would require a tool to edit client spec part of chainspecs because it would not be possible to edit manually anymore.

Edited by Hugo Trentesaux
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information