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

Wrong tx response output #4020

Closed
grarco opened this issue Nov 13, 2024 · 0 comments · Fixed by #4039
Closed

Wrong tx response output #4020

grarco opened this issue Nov 13, 2024 · 0 comments · Fixed by #4039

Comments

@grarco
Copy link
Collaborator

grarco commented Nov 13, 2024

It seems like the display_batch_resp function is producing a slightly misleading output.

namada/crates/sdk/src/tx.rs

Lines 435 to 483 in cb1e963

pub fn display_batch_resp(context: &impl Namada, resp: &TxResponse) {
for (inner_hash, result) in resp.batch_result() {
match result {
InnerTxResult::Success(_) => {
display_line!(
context.io(),
"Transaction {} was successfully applied at height {}, \
consuming {} gas units.",
inner_hash,
resp.height,
resp.gas_used
);
}
InnerTxResult::VpsRejected(inner) => {
let changed_keys: Vec<_> = inner
.changed_keys
.iter()
.map(storage::Key::to_string)
.collect();
edisplay_line!(
context.io(),
"Transaction {} was rejected by VPs: {}\nErrors: \
{}\nChanged keys: {}",
inner_hash,
serde_json::to_string_pretty(
&inner.vps_result.rejected_vps
)
.unwrap(),
serde_json::to_string_pretty(&inner.vps_result.errors)
.unwrap(),
serde_json::to_string_pretty(&changed_keys).unwrap(),
);
}
InnerTxResult::OtherFailure => {
edisplay_line!(
context.io(),
"Transaction {} failed.\nDetails: {}",
inner_hash,
serde_json::to_string_pretty(&resp).unwrap()
);
}
}
}
tracing::debug!(
"Full result: {}",
serde_json::to_string_pretty(&resp).unwrap()
);
}

More specifically:

  • The gas units displayed actually refer to the entire batch and not the single inner tx, we should move this log to the batch level
  • In case of InnerTxResult::OtherFailure we display the entire result. In case of multiple failures we could end up spamming the error stream of the user
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant