diff --git a/.changelog/unreleased/improvements/3757-better-custom-tx-error.md b/.changelog/unreleased/improvements/3757-better-custom-tx-error.md new file mode 100644 index 0000000000..3346e7238e --- /dev/null +++ b/.changelog/unreleased/improvements/3757-better-custom-tx-error.md @@ -0,0 +1,3 @@ +- Improve error and help messages to clarify that a .tx + file is expected as input to --tx-path for a custom tx. + ([\#3757](https://github.com/anoma/namada/pull/3757)) \ No newline at end of file diff --git a/crates/apps_lib/src/cli.rs b/crates/apps_lib/src/cli.rs index 7124945d0f..9955a52797 100644 --- a/crates/apps_lib/src/cli.rs +++ b/crates/apps_lib/src/cli.rs @@ -4483,7 +4483,11 @@ pub mod args { .arg( TX_PATH_OPT .def() - .help(wrap!("The path to a serialized transaction.")) + .help(wrap!( + "The path to a serialized transaction. It is \ + expected that this transaction is contained in a \ + .tx file, typically produced from a tx dump." + )) .conflicts_with_all([ CODE_PATH_OPT.name, DATA_PATH_OPT.name, diff --git a/crates/sdk/src/tx.rs b/crates/sdk/src/tx.rs index ce5758d959..62368278aa 100644 --- a/crates/sdk/src/tx.rs +++ b/crates/sdk/src/tx.rs @@ -3708,7 +3708,12 @@ pub async fn build_custom( let mut tx = if let Some(serialized_tx) = serialized_tx { Tx::deserialize(serialized_tx.as_ref()).map_err(|_| { - Error::Other("Invalid tx deserialization.".to_string()) + Error::Other( + "Invalid tx deserialization. Please make sure you are passing \ + a file in .tx format, typically produced from using the \ + `--dump-tx` flag." + .to_string(), + ) })? } else { let code_path = code_path