Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "fix(evmlib): add timeout to pending tx builder" #2615

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions evmlib/src/contract/network_token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();

Expand Down Expand Up @@ -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!(
Expand Down
16 changes: 4 additions & 12 deletions evmlib/src/contract/payment_vault/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
}
Expand Down
3 changes: 0 additions & 3 deletions evmlib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<reqwest::Url> = LazyLock::new(|| {
"https://arb1.arbitrum.io/rpc"
.parse()
Expand Down
17 changes: 2 additions & 15 deletions evmlib/src/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand Down Expand Up @@ -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)
}
Expand Down
Loading