Skip to content

Commit

Permalink
add tx status ABCI query, prevent sequencer client from looping indef…
Browse files Browse the repository at this point in the history
…initely
  • Loading branch information
ethanoroshiba committed Feb 6, 2025
1 parent 397b32d commit 21fa040
Show file tree
Hide file tree
Showing 20 changed files with 1,399 additions and 95 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -296,13 +296,10 @@ async fn submit_tx(

ensure!(check_tx.code.is_ok(), "check_tx failed: {}", check_tx.log);

let tx_response = client.wait_for_tx_inclusion(check_tx.hash).await;

ensure!(
tx_response.tx_result.code.is_ok(),
"deliver_tx failed: {}",
tx_response.tx_result.log
);
let tx_response = client
.confirm_tx_inclusion(check_tx.hash)
.await
.wrap_err("failed to confirm transaction inclusion")?;

Ok((check_tx, tx_response))
}
Expand Down
12 changes: 5 additions & 7 deletions crates/astria-cli/src/bridge/submit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,11 @@ async fn submit_transaction(
.await
.wrap_err("failed to submit transaction")?;

let tx_response = client.wait_for_tx_inclusion(res.hash).await;

ensure!(res.code.is_ok(), "failed to check tx: {}", res.log);
ensure!(
tx_response.tx_result.code.is_ok(),
"failed to execute tx: {}",
tx_response.tx_result.log
);

let tx_response = client
.confirm_tx_inclusion(res.hash)
.await
.wrap_err("failed to confirm transaction inclusion")?;
Ok(tx_response)
}
11 changes: 4 additions & 7 deletions crates/astria-cli/src/sequencer/submit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,10 @@ impl Command {

ensure!(res.code.is_ok(), "failed to check tx: {}", res.log);

let tx_response = sequencer_client.wait_for_tx_inclusion(res.hash).await;

ensure!(
tx_response.tx_result.code.is_ok(),
"failed to execute tx: {}",
tx_response.tx_result.log
);
let tx_response = sequencer_client
.confirm_tx_inclusion(res.hash)
.await
.wrap_err("failed to confirm transaction inclusion")?;

println!("Submission completed!");
println!("Included in block: {}", tx_response.height);
Expand Down
2 changes: 1 addition & 1 deletion crates/astria-cli/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ pub(crate) async fn submit_transaction(

ensure!(res.code.is_ok(), "failed to check tx: {}", res.log);

let tx_response = sequencer_client.wait_for_tx_inclusion(res.hash).await;
let tx_response = sequencer_client.confirm_tx_inclusion(res.hash).await?;

ensure!(
tx_response.tx_result.code.is_ok(),
Expand Down
49 changes: 49 additions & 0 deletions crates/astria-core/src/generated/astria.protocol.transaction.v1.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 21fa040

Please sign in to comment.