From 100cb9a160d9380576fcff13001151f27dac0457 Mon Sep 17 00:00:00 2001 From: Juliya Smith Date: Mon, 19 Aug 2024 12:59:58 -0500 Subject: [PATCH] chore: downgrade --- setup.py | 3 +-- src/ape_accounts/accounts.py | 4 ++-- src/ape_ethereum/provider.py | 8 ++++---- src/ape_test/accounts.py | 2 +- tests/functional/geth/test_provider.py | 2 +- 5 files changed, 9 insertions(+), 10 deletions(-) diff --git a/setup.py b/setup.py index 86708b6450..30eaeebff6 100644 --- a/setup.py +++ b/setup.py @@ -126,13 +126,12 @@ # All version pins dependent on web3[tester] "eth-abi", "eth-account", - "eth-tester", "eth-typing", "eth-utils", "hexbytes", "py-geth", "trie", # Peer: stricter pin needed for uv support. - "web3>=7.0.0b9,<8", + "web3[tester]>=6.20.2,<7", # ** Dependencies maintained by ApeWorX ** # Missing pins are dependent on ETH-prefixed dependencies. "eip712", diff --git a/src/ape_accounts/accounts.py b/src/ape_accounts/accounts.py index ff539a9d12..b07ff301a3 100644 --- a/src/ape_accounts/accounts.py +++ b/src/ape_accounts/accounts.py @@ -241,14 +241,14 @@ def sign_raw_msghash(self, msghash: HexBytes) -> Optional[MessageSignature]: ) # NOTE: Signing a raw hash is so dangerous, we don't want to allow autosigning it - if not click.confirm("Please confirm you wish to sign using `EthAccount.unsafe_sign_hash`"): + if not click.confirm("Please confirm you wish to sign using `EthAccount.signHash`"): return None # Ignoring misleading deprecated warning from web3.py. # Also, we have already warned the user about the safety. with warnings.catch_warnings(): warnings.simplefilter("ignore") - signed_msg = EthAccount.unsafe_sign_hash(msghash, self.__key) + signed_msg = EthAccount.signHash(msghash, self.__key) return MessageSignature( v=signed_msg.v, diff --git a/src/ape_ethereum/provider.py b/src/ape_ethereum/provider.py index 1740a69f6d..29c792bbfc 100644 --- a/src/ape_ethereum/provider.py +++ b/src/ape_ethereum/provider.py @@ -20,17 +20,17 @@ from evmchains import get_random_rpc from pydantic.dataclasses import dataclass from requests import HTTPError -from web3 import HTTPProvider, IPCProvider, Web3, WebSocketProvider +from web3 import HTTPProvider, IPCProvider, Web3, WebsocketProvider +from web3 import WebsocketProvider as WebSocketProvider # Matching newer API name from web3.exceptions import ContractLogicError as Web3ContractLogicError from web3.exceptions import ( ExtraDataLengthError, MethodUnavailable, TimeExhausted, TransactionNotFound, - Web3RPCError, ) from web3.gas_strategies.rpc import rpc_gas_price_strategy -from web3.middleware import ExtraDataToPOAMiddleware +from web3.middleware import geth_poa_middleware as ExtraDataToPOAMiddleware from web3.middleware.validation import MAX_EXTRADATA_LENGTH from web3.providers import AutoProvider from web3.providers.auto import load_provider_from_environment @@ -1009,7 +1009,7 @@ def send_transaction(self, txn: TransactionAPI) -> ReceiptAPI: if txn_hash is None: txn_hash = to_hex(self.web3.eth.send_raw_transaction(txn.serialize_transaction())) - except (ValueError, Web3ContractLogicError, Web3RPCError) as err: + except (ValueError, Web3ContractLogicError) as err: vm_err = self.get_virtual_machine_error( err, txn=txn, set_ape_traceback=txn.raise_on_revert ) diff --git a/src/ape_test/accounts.py b/src/ape_test/accounts.py index 0029aaa972..690fb4f1b7 100644 --- a/src/ape_test/accounts.py +++ b/src/ape_test/accounts.py @@ -158,7 +158,7 @@ def sign_transaction(self, txn: TransactionAPI, **signer_options) -> Optional[Tr def sign_raw_msghash(self, msghash: HexBytes) -> MessageSignature: with warnings.catch_warnings(): warnings.simplefilter("ignore") - signed_msg = EthAccount.unsafe_sign_hash(msghash, self.private_key) + signed_msg = EthAccount.signHash(msghash, self.private_key) return MessageSignature( v=signed_msg.v, diff --git a/tests/functional/geth/test_provider.py b/tests/functional/geth/test_provider.py index 0daa812081..be7028757f 100644 --- a/tests/functional/geth/test_provider.py +++ b/tests/functional/geth/test_provider.py @@ -9,7 +9,7 @@ from hexbytes import HexBytes from web3.exceptions import ContractLogicError as Web3ContractLogicError from web3.exceptions import ExtraDataLengthError -from web3.middleware import ExtraDataToPOAMiddleware +from web3.middleware import geth_poa_middleware as ExtraDataToPOAMiddleware from ape.exceptions import ( APINotImplementedError,