From 62b71c48a2452c1962aef7a159b83725b92b3e25 Mon Sep 17 00:00:00 2001 From: Warm Beer Date: Thu, 9 Jan 2025 12:46:11 +0100 Subject: [PATCH] Revert "fix(evmlib): add timeout to pending tx builder" This reverts commit e2379238 --- evmlib/src/contract/network_token.rs | 11 ++++------- evmlib/src/contract/payment_vault/handler.rs | 16 ++++------------ evmlib/src/lib.rs | 3 --- evmlib/src/wallet.rs | 17 ++--------------- 4 files changed, 10 insertions(+), 37 deletions(-) diff --git a/evmlib/src/contract/network_token.rs b/evmlib/src/contract/network_token.rs index df18b37a1d..10903c9fd2 100644 --- a/evmlib/src/contract/network_token.rs +++ b/evmlib/src/contract/network_token.rs @@ -8,7 +8,6 @@ use crate::common::{Address, Calldata, TxHash, U256}; use crate::contract::network_token::NetworkTokenContract::NetworkTokenContractInstance; -use crate::TX_TIMEOUT; use alloy::network::TransactionBuilder; use alloy::providers::{Network, Provider}; use alloy::sol; @@ -109,10 +108,9 @@ where .await .inspect_err(|err| { error!( - "Error to send_transaction while approving spender {spender:?} to spend raw amt of tokens {value}: {err:?}" + "Error approving spender {spender:?} to spend raw amt of tokens {value}: {err:?}" ) - })? - .with_timeout(Some(TX_TIMEOUT)); + })?; let pending_tx_hash = *pending_tx_builder.tx_hash(); @@ -152,9 +150,8 @@ where .send_transaction(transaction_request) .await .inspect_err(|err| { - error!("Error to send_transaction during transfer raw amt of tokens to {receiver:?}: {err:?}") - })? - .with_timeout(Some(TX_TIMEOUT)); + error!("Error transferring raw amt of tokens to {receiver:?}: {err:?}") + })?; let pending_tx_hash = *pending_tx_builder.tx_hash(); debug!( diff --git a/evmlib/src/contract/payment_vault/handler.rs b/evmlib/src/contract/payment_vault/handler.rs index 4330f31fbe..1000d7d108 100644 --- a/evmlib/src/contract/payment_vault/handler.rs +++ b/evmlib/src/contract/payment_vault/handler.rs @@ -2,7 +2,6 @@ use crate::common::{Address, Amount, Calldata, TxHash}; use crate::contract::payment_vault::error::Error; use crate::contract::payment_vault::interface::IPaymentVault; use crate::contract::payment_vault::interface::IPaymentVault::IPaymentVaultInstance; -use crate::TX_TIMEOUT; use alloy::network::{Network, TransactionBuilder}; use alloy::providers::Provider; use alloy::transports::Transport; @@ -60,20 +59,13 @@ where .with_to(to) .with_input(calldata); - let pending_tx_builder = self + let tx_hash = self .contract .provider() .send_transaction(transaction_request) - .await - .inspect_err(|err| error!("Error to send_transaction during pay_for_quotes: {err:?}"))? - .with_timeout(Some(TX_TIMEOUT)); - - let pending_tx_hash = pending_tx_builder.tx_hash(); - debug!("pay_for_quotes is pending with tx hash: {pending_tx_hash}"); - - let tx_hash = pending_tx_builder.watch().await.inspect_err(|err| { - error!("Error to watch transaction during pay_for_quotes: {err:?}") - })?; + .await? + .watch() + .await?; Ok(tx_hash) } diff --git a/evmlib/src/lib.rs b/evmlib/src/lib.rs index 866f8fc47d..2439682c93 100644 --- a/evmlib/src/lib.rs +++ b/evmlib/src/lib.rs @@ -27,9 +27,6 @@ pub mod testnet; pub mod utils; pub mod wallet; -/// Timeout for transactions -const TX_TIMEOUT: std::time::Duration = std::time::Duration::from_secs(60); - static PUBLIC_ARBITRUM_ONE_HTTP_RPC_URL: LazyLock = LazyLock::new(|| { "https://arb1.arbitrum.io/rpc" .parse() diff --git a/evmlib/src/wallet.rs b/evmlib/src/wallet.rs index 40b302ccad..0f6ba3acea 100644 --- a/evmlib/src/wallet.rs +++ b/evmlib/src/wallet.rs @@ -12,7 +12,7 @@ use crate::contract::payment_vault::handler::PaymentVaultHandler; use crate::contract::payment_vault::MAX_TRANSFERS_PER_TRANSACTION; use crate::contract::{network_token, payment_vault}; use crate::utils::http_provider; -use crate::{Network, TX_TIMEOUT}; +use crate::Network; use alloy::hex::ToHexExt; use alloy::network::{Ethereum, EthereumWallet, NetworkWallet, TransactionBuilder}; use alloy::providers::fillers::{ @@ -262,20 +262,7 @@ pub async fn transfer_gas_tokens( .with_to(receiver) .with_value(amount); - let pending_tx_builder = provider - .send_transaction(tx) - .await - .inspect_err(|err| { - error!("Error to send_transaction during transfer_gas_tokens: {err}"); - })? - .with_timeout(Some(TX_TIMEOUT)); - let pending_tx_hash = *pending_tx_builder.tx_hash(); - debug!("The transfer of gas tokens is pending with tx_hash: {pending_tx_hash}"); - - let tx_hash = pending_tx_builder.watch().await.inspect_err(|err| { - error!("Error watching transfer_gas_tokens tx with hash {pending_tx_hash}: {err}") - })?; - debug!("Transfer of gas tokens with tx_hash: {tx_hash} is successful"); + let tx_hash = provider.send_transaction(tx).await?.watch().await?; Ok(tx_hash) }