Adder Parachain: Accept output file argument to export-genesis-* subcommands (#2370)

This PR makes a small change the the adder parachain's CLI. It allows
the user to specify an output file explicitly when generating the
genesis wasm and head data.

Now we no longer have to rely on redirecting the output to a file at the
shell level. This change is nice because if you have any debugging lines
enabled, shell redirection does not work.

More to the point, this makes the adder parachain's CLI match the
cumulus collator's CLI. And that will allow tools like Zombienet (that
support both cumulus and the adder) to use the positional argument.

cc @pepoviola

---------

Co-authored-by: Joshy Orndorff <git-user-email.h0ly5@simplelogin.com>
Co-authored-by: Bastian Köcher <git@kchr.de>
This commit is contained in:
Joshy Orndorff
2024-01-21 06:51:04 +08:00
committed by GitHub
parent a5370fb187
commit caa987d26d
3 changed files with 35 additions and 8 deletions
@@ -54,9 +54,9 @@ fn main() -> Result<()> {
Some(cli::Subcommand::ExportGenesisWasm(params)) => {
// We pass some dummy values for `pov_size` and `pvf_complexity` as these don't
// matter for `wasm` export.
let collator = Collator::default();
let output_buf =
format!("0x{:?}", HexDisplay::from(&Collator::default().validation_code()))
.into_bytes();
format!("0x{:?}", HexDisplay::from(&collator.validation_code())).into_bytes();
if let Some(output) = params.output {
fs::write(output, output_buf)?;