From 31cc7dfec5dd305b2b7385f79e4400603ce87e81 Mon Sep 17 00:00:00 2001 From: brentstone Date: Thu, 5 Sep 2024 16:16:54 +0200 Subject: [PATCH 1/2] improve custom tx error and help msg --- crates/apps_lib/src/cli.rs | 6 +++++- crates/sdk/src/tx.rs | 7 ++++++- 2 files changed, 11 insertions(+), 2 deletions(-) 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 From 03c9cbf7f52c8cca9b146d4dce02c1d2bc2145f1 Mon Sep 17 00:00:00 2001 From: brentstone Date: Thu, 5 Sep 2024 16:19:15 +0200 Subject: [PATCH 2/2] changelog: add #3757 --- .../unreleased/improvements/3757-better-custom-tx-error.md | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .changelog/unreleased/improvements/3757-better-custom-tx-error.md 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