1

I have written a command that exports the metadata at the CLI which /should/ duplicate the results of state_getMetadata.

Full Source Code: https://github.com/LibertyDSNP/frequency/blob/main/node/cli/src/export_metadata_cmd.rs

However the output does not match the state_getMetadata. For example, frequency does not currently use or import the XCM pallets. state_getMetadata does NOT have any of the events from those pallets as expected. However, the metadata from the CLI DOES have those events.

This is because the command is can pull from the chain state.

How can I make sure that the export_metadata_cmd.rs never creates or uses the data from prior state?

In effect I always want to run this cli command with --tmp.

1 Answer 1

2

Found one fix: https://github.com/LibertyDSNP/frequency/pull/987

This uses impl CliConfiguration to force the base_path to a temp directory. Feels like it shouldn't need this, but it works.

impl CliConfiguration for ExportMetadataCmd {
  // We never want to use any stored data. Always just use fresh.
  fn base_path(&self) -> Result<Option<sc_service::BasePath>, sc_cli::Error> {
    Ok(Some(sc_service::BasePath::new_temp_dir()?))
  }
}

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.