I've updated the ChainSpec type from:

pub type ChainSpec = sc_service::GenericChainSpec<GenesisConfig, Extensions>;


pub type ChainSpec = sc_service::GenericChainSpec<Result<GenesisConfig, String>, Extensions>;

But, I'm getting this error in the command.rs:

error[E0277]: the trait bound `Result<node_template_runtime::GenesisConfig, std::string::String>: BuildStorage` is not satisfied
  --> node/src/command.rs:49:12
49 |         Ok(Box::new(spec))
   |            ^^^^^^^^^^^^^^ the trait `BuildStorage` is not implemented for `Result<node_template_runtime::GenesisConfig, std::string::String>`
   = help: the following other types implement trait `BuildStorage`:
             GenericChainSpec<G, E>
   = note: required for `Result<node_template_runtime::GenesisConfig, std::string::String>` to implement `RuntimeGenesis`
   = note: required for `GenericChainSpec<Result<node_template_runtime::GenesisConfig, std::string::String>, Extensions>` to implement `sc_chain_spec::ChainSpec`
   = note: required for the cast from `GenericChainSpec<Result<node_template_runtime::GenesisConfig, std::string::String>, Extensions>` to the object type `dyn sc_chain_spec::ChainSpec`

For more information about this error, try `rustc --explain E0277`.

Is there a way to unwrap the ChainSpec in the load_spec() method?

  • Please show your code. sc_service::GenericChainSpec<Result<GenesisConfig, String> this makes no real sense. The underlying issue is that Result<GenesisConfig> doesn't implement the BuildStorage trait.
    – bkchr
    Jun 13, 2023 at 14:37


Your Answer

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

Browse other questions tagged or ask your own question.