Skip to content

Commit

Permalink
feat(fortuna): More logging on tx (#1648)
Browse files Browse the repository at this point in the history
  • Loading branch information
m30m authored Jun 2, 2024
1 parent 5309b92 commit f59706e
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 10 deletions.
2 changes: 1 addition & 1 deletion apps/fortuna/Cargo.lock

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

2 changes: 1 addition & 1 deletion apps/fortuna/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "fortuna"
version = "6.2.0"
version = "6.2.1"
edition = "2021"

[dependencies]
Expand Down
35 changes: 27 additions & 8 deletions apps/fortuna/src/keeper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -414,19 +414,39 @@ pub async fn process_event(
)
.gas(gas_estimate);


let pending_tx = contract_call.send().await.map_err(|e| {
backoff::Error::transient(anyhow!("Error submitting the reveal transaction: {:?}", e))
})?;
let client = contract.client();
let mut transaction = contract_call.tx.clone();
// manually fill the tx with the gas info, so we can log the details in case of error
client
.fill_transaction(&mut transaction, None)
.await
.map_err(|e| {
backoff::Error::transient(anyhow!("Error filling the reveal transaction: {:?}", e))
})?;
let pending_tx = client
.send_transaction(transaction.clone(), None)
.await
.map_err(|e| {
backoff::Error::transient(anyhow!(
"Error submitting the reveal transaction. Tx:{:?}, Error:{:?}",
transaction,
e
))
})?;

let receipt = pending_tx
.await
.map_err(|e| {
backoff::Error::transient(anyhow!("Error waiting for transaction receipt {:?}", e))
backoff::Error::transient(anyhow!(
"Error waiting for transaction receipt. Tx:{:?} Error:{:?}",
transaction,
e
))
})?
.ok_or_else(|| {
backoff::Error::transient(anyhow!(
"Can't verify the reveal, probably dropped from mempool"
"Can't verify the reveal, probably dropped from mempool Tx:{:?}",
transaction
))
})?;

Expand All @@ -444,8 +464,7 @@ pub async fn process_event(
.total_gas_spent
.get_or_create(&AccountLabel {
chain_id: chain_config.id.clone(),
address: contract
.client()
address: client
.inner()
.inner()
.inner()
Expand Down

0 comments on commit f59706e

Please sign in to comment.