Skip to content

Commit

Permalink
Fix failing tests due to inter node delay change (#219)
Browse files Browse the repository at this point in the history
  • Loading branch information
hieuh25 authored Jul 24, 2024
1 parent 2334ec5 commit f28157d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 17 deletions.
21 changes: 9 additions & 12 deletions eth_defi/confirmation.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,24 @@
import datetime
import logging
import time
from _decimal import Decimal
from typing import Dict, List, Set, Union, cast, Collection, TypeAlias
from typing import Collection, Dict, List, Set, TypeAlias, Union, cast

from _decimal import Decimal
from eth_account.datastructures import SignedTransaction
from eth_typing import HexStr, Address

from eth_defi.provider.anvil import mine
from eth_defi.provider.named import get_provider_name
from eth_typing import Address, HexStr
from hexbytes import HexBytes
from web3 import Web3
from web3.exceptions import TransactionNotFound
from web3.providers import BaseProvider

from eth_defi.hotwallet import SignedTransactionWithNonce
from eth_defi.provider.anvil import mine
from eth_defi.provider.fallback import FallbackProvider, get_fallback_provider
from eth_defi.provider.named import get_provider_name
from eth_defi.timestamp import get_latest_block_timestamp
from eth_defi.tx import decode_signed_transaction
from eth_defi.provider.fallback import FallbackProvider, get_fallback_provider
from web3.providers import BaseProvider

from eth_defi.utils import to_unix_timestamp


logger = logging.getLogger(__name__)


Expand Down Expand Up @@ -196,7 +193,7 @@ def wait_transactions_to_complete(
logger.warning(
"Timeout warning threshold %s reached when trying to confirm txs, still trying:\n%s",
node_switch_timeout,
unconfirmed_txs
unconfirmed_txs,
)
provider.switch_provider()
next_node_switch = datetime.datetime.utcnow() + node_switch_timeout
Expand Down Expand Up @@ -600,7 +597,7 @@ def wait_and_broadcast_multiple_nodes(
# Initial broadcast of txs
for tx in txs:
try:
_broadcast_multiple_nodes(providers, tx, inter_node_delay=inter_node_delay,)
_broadcast_multiple_nodes(providers, tx)
last_exception = None
except NonRetryableBroadcastException:
# Don't try to handle
Expand Down
10 changes: 5 additions & 5 deletions tests/rpc/test_out_of_gas.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
"""Out of gas tests."""

import os

import pytest

from eth_account import Account
from web3 import Web3, HTTPProvider
from web3 import HTTPProvider, Web3

from eth_defi.confirmation import wait_and_broadcast_multiple_nodes, OutOfGasFunds
from eth_defi.gas import estimate_gas_fees, apply_gas
from eth_defi.confirmation import OutOfGasFunds, wait_and_broadcast_multiple_nodes
from eth_defi.gas import apply_gas, estimate_gas_fees
from eth_defi.hotwallet import HotWallet
from eth_defi.provider.multi_provider import create_multi_provider_web3
from eth_defi.token import fetch_erc20_details, TokenDetails
from eth_defi.token import TokenDetails, fetch_erc20_details
from eth_defi.uniswap_v2.deployment import UniswapV2Deployment, fetch_deployment

JSON_RPC_POLYGON = os.environ.get("JSON_RPC_POLYGON", "https://polygon-rpc.com")
Expand Down

0 comments on commit f28157d

Please sign in to comment.