From 15883d340a6c3a766e0412ba0d7ab4bf77b0dfcc Mon Sep 17 00:00:00 2001 From: elizabeth Date: Thu, 26 Jun 2025 12:37:18 -0400 Subject: [PATCH 1/6] increase pending transaction timeout --- crates/shared/src/web3/contracts/helpers/utils.rs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/crates/shared/src/web3/contracts/helpers/utils.rs b/crates/shared/src/web3/contracts/helpers/utils.rs index 8dcbca1e..b09a6d82 100644 --- a/crates/shared/src/web3/contracts/helpers/utils.rs +++ b/crates/shared/src/web3/contracts/helpers/utils.rs @@ -30,6 +30,8 @@ where N: Network, D: CallDecoder + Clone, { + const PENDING_TRANSACTION_TIMEOUT: Duration = Duration::from_secs(60); + let mut tries = 0; let retry_delay = retry_delay.unwrap_or(2); @@ -54,7 +56,7 @@ where call = call .clone() .max_fee_per_gas(new_gas_price) - .max_priority_fee_per_gas(new_priority_fee); + .max_priority_fee_per_gas(new_priority_fee) } else { warn!("Could not get new gas fees, retrying with old settings."); } @@ -63,10 +65,13 @@ where match call.clone().send().await { Ok(result) => { debug!("Transaction sent, waiting for confirmation..."); - match timeout(Duration::from_secs(30), result.watch()).await { - Ok(Ok(hash)) => return Ok(hash), - Ok(Err(err)) => warn!("Transaction watch failed: {err:?}"), - Err(_) => warn!("Watch timed out, retrying transaction..."), + match result + .with_timeout(Some(PENDING_TRANSACTION_TIMEOUT)) + .watch() + .await + { + Ok(hash) => return Ok(hash), + Err(err) => warn!("Transaction watch failed: {err:?}"), } } Err(err) => { From af26a1b5b8eb9b8916b2f03f5c0a7911a5729452 Mon Sep 17 00:00:00 2001 From: elizabeth Date: Thu, 26 Jun 2025 12:41:43 -0400 Subject: [PATCH 2/6] also recheck if tx was included after sleep --- crates/shared/src/web3/contracts/helpers/utils.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/crates/shared/src/web3/contracts/helpers/utils.rs b/crates/shared/src/web3/contracts/helpers/utils.rs index b09a6d82..e630600f 100644 --- a/crates/shared/src/web3/contracts/helpers/utils.rs +++ b/crates/shared/src/web3/contracts/helpers/utils.rs @@ -34,11 +34,19 @@ where let mut tries = 0; let retry_delay = retry_delay.unwrap_or(2); + let mut tx_hash = None; while tries < max_tries { if tries > 0 { tokio::time::sleep(Duration::from_secs(retry_delay)).await; + if let Some(tx_hash) = tx_hash { + let receipt = provider.get_transaction_receipt(tx_hash).await?; + if receipt.is_some() { + return Ok(tx_hash); + } + } + // On retry, always fetch fresh fee estimates from the provider. let priority_fee_res = provider.get_max_priority_fee_per_gas().await; let gas_price_res = provider.get_gas_price().await; @@ -65,6 +73,8 @@ where match call.clone().send().await { Ok(result) => { debug!("Transaction sent, waiting for confirmation..."); + tx_hash = Some(result.tx_hash()); + match result .with_timeout(Some(PENDING_TRANSACTION_TIMEOUT)) .watch() From 2398fea4ca064e5c7409c83b396ecfe15de41d59 Mon Sep 17 00:00:00 2001 From: elizabeth Date: Thu, 26 Jun 2025 13:46:32 -0400 Subject: [PATCH 3/6] fix --- crates/shared/src/web3/contracts/helpers/utils.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/shared/src/web3/contracts/helpers/utils.rs b/crates/shared/src/web3/contracts/helpers/utils.rs index e630600f..07a71089 100644 --- a/crates/shared/src/web3/contracts/helpers/utils.rs +++ b/crates/shared/src/web3/contracts/helpers/utils.rs @@ -9,7 +9,7 @@ use alloy::{ }; use anyhow::Result; use log::{debug, info, warn}; -use tokio::time::{timeout, Duration}; +use tokio::time::Duration; use crate::web3::wallet::WalletProvider; @@ -73,7 +73,7 @@ where match call.clone().send().await { Ok(result) => { debug!("Transaction sent, waiting for confirmation..."); - tx_hash = Some(result.tx_hash()); + tx_hash = Some(result.tx_hash().clone()); match result .with_timeout(Some(PENDING_TRANSACTION_TIMEOUT)) From d6e996bb700e5288667ab81f9981009938afd2f9 Mon Sep 17 00:00:00 2001 From: elizabeth Date: Thu, 26 Jun 2025 15:52:40 -0400 Subject: [PATCH 4/6] clippy --- crates/shared/src/web3/contracts/helpers/utils.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/shared/src/web3/contracts/helpers/utils.rs b/crates/shared/src/web3/contracts/helpers/utils.rs index 07a71089..b6501ff9 100644 --- a/crates/shared/src/web3/contracts/helpers/utils.rs +++ b/crates/shared/src/web3/contracts/helpers/utils.rs @@ -73,7 +73,7 @@ where match call.clone().send().await { Ok(result) => { debug!("Transaction sent, waiting for confirmation..."); - tx_hash = Some(result.tx_hash().clone()); + tx_hash = Some(*result.tx_hash()); match result .with_timeout(Some(PENDING_TRANSACTION_TIMEOUT)) From 929cb82aa03d58f05799682b79e84f917a3953cb Mon Sep 17 00:00:00 2001 From: Jannik Straube Date: Fri, 27 Jun 2025 16:43:38 +1000 Subject: [PATCH 5/6] temp disable orchestrator active check --- crates/orchestrator/src/main.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/crates/orchestrator/src/main.rs b/crates/orchestrator/src/main.rs index 8ecab2b4..af64891f 100644 --- a/crates/orchestrator/src/main.rs +++ b/crates/orchestrator/src/main.rs @@ -19,7 +19,6 @@ use crate::status_update::NodeStatusUpdater; use crate::store::core::RedisStore; use crate::store::core::StoreContext; use crate::utils::loop_heartbeats::LoopHeartbeats; -use alloy::primitives::U256; use anyhow::Result; use clap::Parser; use clap::ValueEnum; @@ -38,7 +37,6 @@ use plugins::SchedulerPlugin; use plugins::StatusUpdatePlugin; use shared::utils::google_cloud::GcsStorageProvider; use shared::web3::contracts::core::builder::ContractBuilder; -use shared::web3::contracts::structs::compute_pool::PoolStatus; use shared::web3::wallet::Wallet; use std::sync::Arc; use tokio::task::JoinSet; @@ -186,7 +184,7 @@ async fn main() -> Result<()> { .build() .unwrap(); - match contracts + /* match contracts .compute_pool .get_pool_info(U256::from(compute_pool_id)) .await @@ -200,7 +198,7 @@ async fn main() -> Result<()> { error!("Failed to get pool info: {e}"); return Ok(()); } - }; + }; */ let group_store_context = store_context.clone(); let mut scheduler_plugins: Vec> = Vec::new(); let mut status_update_plugins: Vec> = vec![]; From d76b5f29779eb05120af9ccbe38bf509f8715e1f Mon Sep 17 00:00:00 2001 From: Jannik Straube Date: Fri, 27 Jun 2025 16:54:42 +1000 Subject: [PATCH 6/6] bump version --- Cargo.lock | 8 ++++---- Cargo.toml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index cf744647..c2b8b23d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2376,7 +2376,7 @@ dependencies = [ [[package]] name = "discovery" -version = "0.3.9" +version = "0.3.10" dependencies = [ "actix-web", "alloy", @@ -4882,7 +4882,7 @@ checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" [[package]] name = "orchestrator" -version = "0.3.9" +version = "0.3.10" dependencies = [ "actix-web", "actix-web-prometheus", @@ -7679,7 +7679,7 @@ dependencies = [ [[package]] name = "validator" -version = "0.3.9" +version = "0.3.10" dependencies = [ "actix-web", "alloy", @@ -8496,7 +8496,7 @@ dependencies = [ [[package]] name = "worker" -version = "0.3.9" +version = "0.3.10" dependencies = [ "actix-web", "alloy", diff --git a/Cargo.toml b/Cargo.toml index 57c39c12..0fac7f79 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -40,7 +40,7 @@ iroh = "0.34.1" rand_v8 = { package = "rand", version = "0.8.5", features = ["std"] } rand_core_v6 = { package = "rand_core", version = "0.6.4", features = ["std"] } [workspace.package] -version = "0.3.9" +version = "0.3.10" edition = "2021" [workspace.features]