From 2152cccd2850f6be8dc6ee3e7c13c0bcd4dc332f Mon Sep 17 00:00:00 2001 From: Daniel Chew Date: Mon, 10 Mar 2025 17:17:46 +0700 Subject: [PATCH 1/2] fix: update fortuna version to 7.4.5 and enhance transaction submission logging --- apps/fortuna/Cargo.lock | 2 +- apps/fortuna/Cargo.toml | 2 +- apps/fortuna/src/eth_utils/utils.rs | 26 +++++++++++++++++++----- apps/fortuna/src/keeper/process_event.rs | 2 ++ 4 files changed, 25 insertions(+), 7 deletions(-) diff --git a/apps/fortuna/Cargo.lock b/apps/fortuna/Cargo.lock index c4efa96e46..e044108d97 100644 --- a/apps/fortuna/Cargo.lock +++ b/apps/fortuna/Cargo.lock @@ -1554,7 +1554,7 @@ dependencies = [ [[package]] name = "fortuna" -version = "7.4.4" +version = "7.4.5" dependencies = [ "anyhow", "axum", diff --git a/apps/fortuna/Cargo.toml b/apps/fortuna/Cargo.toml index 1ec59fd8ff..8bc51a7ead 100644 --- a/apps/fortuna/Cargo.toml +++ b/apps/fortuna/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "fortuna" -version = "7.4.4" +version = "7.4.5" edition = "2021" [lib] diff --git a/apps/fortuna/src/eth_utils/utils.rs b/apps/fortuna/src/eth_utils/utils.rs index 5934e64239..c062ed7854 100644 --- a/apps/fortuna/src/eth_utils/utils.rs +++ b/apps/fortuna/src/eth_utils/utils.rs @@ -2,15 +2,18 @@ use { crate::eth_utils::nonce_manager::NonceManaged, anyhow::{anyhow, Result}, backoff::ExponentialBackoff, - ethers::types::TransactionReceipt, - ethers::types::U256, - ethers::{contract::ContractCall, middleware::Middleware}, - std::sync::atomic::AtomicU64, - std::sync::Arc, + ethers::{ + contract::ContractCall, + middleware::Middleware, + types::{TransactionReceipt, U256}, + }, + std::sync::{atomic::AtomicU64, Arc}, tokio::time::{timeout, Duration}, tracing, }; +pub type ChainId = String; + const TX_CONFIRMATION_TIMEOUT_SECS: u64 = 30; #[derive(Debug)] @@ -154,6 +157,8 @@ pub async fn submit_tx_with_backoff( call: ContractCall, gas_limit: U256, escalation_policy: EscalationPolicy, + chain_id: ChainId, + sequence_number: u64, ) -> Result { let start_time = std::time::Instant::now(); @@ -178,6 +183,8 @@ pub async fn submit_tx_with_backoff( gas_limit, gas_multiplier_pct, fee_multiplier_pct, + chain_id.clone(), + sequence_number, ) .await }, @@ -217,6 +224,8 @@ pub async fn submit_tx( // A value of 100 submits the tx with the same gas/fee as the estimate. gas_estimate_multiplier_pct: u64, fee_estimate_multiplier_pct: u64, + chain_id: ChainId, + sequence_number: u64, ) -> Result> { let gas_estimate_res = call.estimate_gas().await; @@ -261,6 +270,13 @@ pub async fn submit_tx( / 100, ); + tracing::info!( + "Chain ID: {}, Sequence Number: {}, Tx: {:?}", + chain_id, + sequence_number, + transaction + ); + let pending_tx = client .send_transaction(transaction.clone(), None) .await diff --git a/apps/fortuna/src/keeper/process_event.rs b/apps/fortuna/src/keeper/process_event.rs index 79459365df..8c8a0877d5 100644 --- a/apps/fortuna/src/keeper/process_event.rs +++ b/apps/fortuna/src/keeper/process_event.rs @@ -53,6 +53,8 @@ pub async fn process_event_with_backoff( contract_call, gas_limit, escalation_policy, + chain_state.id, + event.sequence_number, ) .await; From ab850e521f319cb2c426eb0755de6929c7c444ec Mon Sep 17 00:00:00 2001 From: Daniel Chew Date: Mon, 10 Mar 2025 17:24:18 +0700 Subject: [PATCH 2/2] refactor: remove unused chain_id and sequence_number parameters from transaction submission functions --- apps/fortuna/src/eth_utils/utils.rs | 15 +-------------- apps/fortuna/src/keeper/process_event.rs | 2 -- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/apps/fortuna/src/eth_utils/utils.rs b/apps/fortuna/src/eth_utils/utils.rs index c062ed7854..e0d70a5d3a 100644 --- a/apps/fortuna/src/eth_utils/utils.rs +++ b/apps/fortuna/src/eth_utils/utils.rs @@ -12,8 +12,6 @@ use { tracing, }; -pub type ChainId = String; - const TX_CONFIRMATION_TIMEOUT_SECS: u64 = 30; #[derive(Debug)] @@ -157,8 +155,6 @@ pub async fn submit_tx_with_backoff( call: ContractCall, gas_limit: U256, escalation_policy: EscalationPolicy, - chain_id: ChainId, - sequence_number: u64, ) -> Result { let start_time = std::time::Instant::now(); @@ -183,8 +179,6 @@ pub async fn submit_tx_with_backoff( gas_limit, gas_multiplier_pct, fee_multiplier_pct, - chain_id.clone(), - sequence_number, ) .await }, @@ -224,8 +218,6 @@ pub async fn submit_tx( // A value of 100 submits the tx with the same gas/fee as the estimate. gas_estimate_multiplier_pct: u64, fee_estimate_multiplier_pct: u64, - chain_id: ChainId, - sequence_number: u64, ) -> Result> { let gas_estimate_res = call.estimate_gas().await; @@ -270,12 +262,7 @@ pub async fn submit_tx( / 100, ); - tracing::info!( - "Chain ID: {}, Sequence Number: {}, Tx: {:?}", - chain_id, - sequence_number, - transaction - ); + tracing::info!("Submitting transaction: {:?}", transaction); let pending_tx = client .send_transaction(transaction.clone(), None) diff --git a/apps/fortuna/src/keeper/process_event.rs b/apps/fortuna/src/keeper/process_event.rs index 8c8a0877d5..79459365df 100644 --- a/apps/fortuna/src/keeper/process_event.rs +++ b/apps/fortuna/src/keeper/process_event.rs @@ -53,8 +53,6 @@ pub async fn process_event_with_backoff( contract_call, gas_limit, escalation_policy, - chain_state.id, - event.sequence_number, ) .await;