Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve custom tx error and help msg #3757

Merged
merged 2 commits into from
Sep 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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))
6 changes: 5 additions & 1 deletion crates/apps_lib/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
7 changes: 6 additions & 1 deletion crates/sdk/src/tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading