Skip to content

Commit f59706e

Browse files
authored
feat(fortuna): More logging on tx (#1648)
1 parent 5309b92 commit f59706e

File tree

3 files changed

+29
-10
lines changed

3 files changed

+29
-10
lines changed

apps/fortuna/Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apps/fortuna/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "fortuna"
3-
version = "6.2.0"
3+
version = "6.2.1"
44
edition = "2021"
55

66
[dependencies]

apps/fortuna/src/keeper.rs

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -414,19 +414,39 @@ pub async fn process_event(
414414
)
415415
.gas(gas_estimate);
416416

417-
418-
let pending_tx = contract_call.send().await.map_err(|e| {
419-
backoff::Error::transient(anyhow!("Error submitting the reveal transaction: {:?}", e))
420-
})?;
417+
let client = contract.client();
418+
let mut transaction = contract_call.tx.clone();
419+
// manually fill the tx with the gas info, so we can log the details in case of error
420+
client
421+
.fill_transaction(&mut transaction, None)
422+
.await
423+
.map_err(|e| {
424+
backoff::Error::transient(anyhow!("Error filling the reveal transaction: {:?}", e))
425+
})?;
426+
let pending_tx = client
427+
.send_transaction(transaction.clone(), None)
428+
.await
429+
.map_err(|e| {
430+
backoff::Error::transient(anyhow!(
431+
"Error submitting the reveal transaction. Tx:{:?}, Error:{:?}",
432+
transaction,
433+
e
434+
))
435+
})?;
421436

422437
let receipt = pending_tx
423438
.await
424439
.map_err(|e| {
425-
backoff::Error::transient(anyhow!("Error waiting for transaction receipt {:?}", e))
440+
backoff::Error::transient(anyhow!(
441+
"Error waiting for transaction receipt. Tx:{:?} Error:{:?}",
442+
transaction,
443+
e
444+
))
426445
})?
427446
.ok_or_else(|| {
428447
backoff::Error::transient(anyhow!(
429-
"Can't verify the reveal, probably dropped from mempool"
448+
"Can't verify the reveal, probably dropped from mempool Tx:{:?}",
449+
transaction
430450
))
431451
})?;
432452

@@ -444,8 +464,7 @@ pub async fn process_event(
444464
.total_gas_spent
445465
.get_or_create(&AccountLabel {
446466
chain_id: chain_config.id.clone(),
447-
address: contract
448-
.client()
467+
address: client
449468
.inner()
450469
.inner()
451470
.inner()

0 commit comments

Comments
 (0)