diff --git a/atxm/exceptions.py b/atxm/exceptions.py index 9786d59..05dfa17 100644 --- a/atxm/exceptions.py +++ b/atxm/exceptions.py @@ -1,6 +1,6 @@ from enum import Enum -from web3.types import PendingTx, RPCError, TxReceipt +from web3.types import PendingTx, TxReceipt class Fault(Enum): @@ -13,9 +13,6 @@ class Fault(Enum): # Strategy has been running for too long TIMEOUT = "timeout" - # Transaction has been capped and subsequently timed out - PAUSE = "pause" - # Transaction reverted REVERT = "revert" @@ -26,7 +23,7 @@ class Fault(Enum): INSUFFICIENT_FUNDS = "insufficient_funds" -class InsufficientFunds(RPCError): +class InsufficientFunds(Exception): """raised when a transaction exceeds the spending cap""" diff --git a/atxm/machine.py b/atxm/machine.py index 64e2a09..820f44f 100644 --- a/atxm/machine.py +++ b/atxm/machine.py @@ -20,7 +20,6 @@ from atxm.strategies import ( AsyncTxStrategy, ExponentialSpeedupStrategy, - InsufficientFundsPause, TimeoutStrategy, ) from atxm.tracker import _TxTracker @@ -97,7 +96,6 @@ class _Machine(StateMachine): _BLOCK_SAMPLE_SIZE = 10_000 # blocks STRATEGIES: List[Type[AsyncTxStrategy]] = [ - InsufficientFundsPause, TimeoutStrategy, ExponentialSpeedupStrategy, ] diff --git a/atxm/strategies.py b/atxm/strategies.py index 1bf7089..9ac5b33 100644 --- a/atxm/strategies.py +++ b/atxm/strategies.py @@ -64,26 +64,6 @@ def execute(self, pending: PendingTx) -> Optional[TxParams]: raise NotImplementedError -class InsufficientFundsPause(AsyncTxStrategy): - """Pause strategy for pending transactions.""" - - _NAME = "insufficient-funds" - - def execute(self, pending: PendingTx) -> Optional[TxParams]: - balance = self.w3.eth.get_balance(pending.params["from"]) - if balance == 0: - self.log.warn( - f"Insufficient funds for transaction #{pending.params['nonce']}" - ) - raise TransactionFaulted( - tx=pending, - fault=Fault.INSUFFICIENT_FUNDS, - message="Insufficient funds", - ) - # log.warn(f"Insufficient funds for transaction #{pending.params['nonce']}") - return None - - class TimeoutStrategy(AsyncTxStrategy): """Timeout strategy for pending transactions."""