From 60c09ab5c9249493a5d92ae783960f9a2eb83bdc Mon Sep 17 00:00:00 2001 From: "Andres D. Molins" Date: Tue, 15 Apr 2025 13:23:22 +0200 Subject: [PATCH 1/4] Feature: Update web3 dependency --- pyproject.toml | 14 +++++++------- src/aleph/sdk/chains/ethereum.py | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 691596fd..e3a4cb95 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -31,19 +31,19 @@ dependencies = [ "aiohttp>=3.8.3", "aioresponses>=0.7.6", "aleph-message>=1", - "aleph-superfluid>=0.2.1", - "base58==2.1.1", # Needed now as default with _load_account changement - "coincurve; python_version<'3.11'", + "aleph-superfluid @ git+https://github.com/aleph-im/superfluid.py@andres-feature-update_dependencies", + "base58==2.1.1", # Needed now as default with _load_account changement + "coincurve; python_version>='3.11'", "coincurve>=19; python_version>='3.11'", - "eth-abi>=4; python_version>='3.11'", - "eth-typing==4.3.1", + "eth-abi>=5.0.1; python_version>='3.11'", + "eth-typing>=5.0.1", "jwcrypto==1.5.6", "pydantic>=2,<3", "pydantic-settings>=2", - "pynacl==1.5", # Needed now as default with _load_account changement + "pynacl==1.5", # Needed now as default with _load_account changement "python-magic", "typing-extensions", - "web3==6.3", + "web3>=7.10", ] optional-dependencies.all = [ diff --git a/src/aleph/sdk/chains/ethereum.py b/src/aleph/sdk/chains/ethereum.py index 863e2bbf..53ec3dcf 100644 --- a/src/aleph/sdk/chains/ethereum.py +++ b/src/aleph/sdk/chains/ethereum.py @@ -11,7 +11,7 @@ from eth_keys.exceptions import BadSignature as EthBadSignatureError from superfluid import Web3FlowInfo from web3 import Web3 -from web3.middleware import geth_poa_middleware +from web3.middleware import ExtraDataToPOAMiddleware from web3.types import TxParams, TxReceipt from aleph.sdk.exceptions import InsufficientFundsError @@ -104,7 +104,7 @@ def connect_chain(self, chain: Optional[Chain] = None): self._provider = Web3(Web3.HTTPProvider(self.rpc)) if chain == Chain.BSC: self._provider.middleware_onion.inject( - geth_poa_middleware, "geth_poa", layer=0 + ExtraDataToPOAMiddleware, "geth_poa", layer=0 ) else: self.chain_id = None From 0a588f0cbb9ec15f3dab539e9b8bfa395beab22f Mon Sep 17 00:00:00 2001 From: "Andres D. Molins" Date: Tue, 15 Apr 2025 13:46:32 +0200 Subject: [PATCH 2/4] Fix: Reduce minimal ETH balance to 0.001 instead 0.005 --- src/aleph/sdk/evm_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/aleph/sdk/evm_utils.py b/src/aleph/sdk/evm_utils.py index a425d580..62cb902b 100644 --- a/src/aleph/sdk/evm_utils.py +++ b/src/aleph/sdk/evm_utils.py @@ -9,7 +9,7 @@ from .conf import settings -MIN_ETH_BALANCE: float = 0.005 +MIN_ETH_BALANCE: float = 0.001 MIN_ETH_BALANCE_WEI = Decimal(to_wei(MIN_ETH_BALANCE, "ether")) BALANCEOF_ABI = """[{ "name": "balanceOf", From 85ac27ddfeb8b5d17cc960f76417f4bba7721fd9 Mon Sep 17 00:00:00 2001 From: "Andres D. Molins" Date: Tue, 15 Apr 2025 14:10:59 +0200 Subject: [PATCH 3/4] Fix: Change `rawTransaction` method to the new `raw_transaction` --- src/aleph/sdk/chains/ethereum.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/aleph/sdk/chains/ethereum.py b/src/aleph/sdk/chains/ethereum.py index 53ec3dcf..8815825e 100644 --- a/src/aleph/sdk/chains/ethereum.py +++ b/src/aleph/sdk/chains/ethereum.py @@ -144,7 +144,7 @@ def sign_and_send() -> TxReceipt: signed_tx = self._provider.eth.account.sign_transaction( tx_params, self._account.key ) - tx_hash = self._provider.eth.send_raw_transaction(signed_tx.rawTransaction) + tx_hash = self._provider.eth.send_raw_transaction(signed_tx.raw_transaction) tx_receipt = self._provider.eth.wait_for_transaction_receipt( tx_hash, settings.TX_TIMEOUT ) From e29cd351fecec3f959af3588b072f60872cf6d91 Mon Sep 17 00:00:00 2001 From: "Andres D. Molins" Date: Wed, 16 Apr 2025 15:35:47 +0200 Subject: [PATCH 4/4] Fix: Solve python 3.9 dependencies for coincurve --- pyproject.toml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index e3a4cb95..8b839052 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -31,16 +31,16 @@ dependencies = [ "aiohttp>=3.8.3", "aioresponses>=0.7.6", "aleph-message>=1", - "aleph-superfluid @ git+https://github.com/aleph-im/superfluid.py@andres-feature-update_dependencies", - "base58==2.1.1", # Needed now as default with _load_account changement - "coincurve; python_version>='3.11'", - "coincurve>=19; python_version>='3.11'", - "eth-abi>=5.0.1; python_version>='3.11'", + "aleph-superfluid @ git+https://github.com/aleph-im/superfluid.py", + "base58==2.1.1", # Needed now as default with _load_account changement + "coincurve; python_version>='3.9'", + "coincurve>=19; python_version>='3.9'", + "eth-abi>=5.0.1; python_version>='3.9'", "eth-typing>=5.0.1", "jwcrypto==1.5.6", "pydantic>=2,<3", "pydantic-settings>=2", - "pynacl==1.5", # Needed now as default with _load_account changement + "pynacl==1.5", # Needed now as default with _load_account changement "python-magic", "typing-extensions", "web3>=7.10",