From ab675b0a28f6afc9ed4acbe24d26af276aaf0a3a Mon Sep 17 00:00:00 2001 From: NotPeopling2day <32708219+NotPeopling2day@users.noreply.github.com> Date: Wed, 4 Dec 2024 17:54:32 -0500 Subject: [PATCH 1/3] feat: upgrade web3 --- ape_tenderly/__init__.py | 16 +++++++--------- ape_tenderly/client.py | 2 +- ape_tenderly/provider.py | 12 ++++++++---- setup.py | 7 ++++--- 4 files changed, 20 insertions(+), 17 deletions(-) diff --git a/ape_tenderly/__init__.py b/ape_tenderly/__init__.py index c4f030b..9aafaeb 100644 --- a/ape_tenderly/__init__.py +++ b/ape_tenderly/__init__.py @@ -6,32 +6,30 @@ "ethereum": [ ("mainnet", TenderlyGatewayProvider), ("mainnet-fork", TenderlyForkProvider), - ("goerli", TenderlyGatewayProvider), - ("goerli-fork", TenderlyForkProvider), ("sepolia", TenderlyGatewayProvider), ("sepolia-fork", TenderlyForkProvider), ], "polygon": [ ("mainnet", TenderlyGatewayProvider), ("mainnet-fork", TenderlyForkProvider), - ("mumbai", TenderlyGatewayProvider), - ("mumbai-fork", TenderlyForkProvider), + ("amoy", TenderlyGatewayProvider), + ("amoy-fork", TenderlyForkProvider), ], "arbitrum": [ ("mainnet-fork", TenderlyForkProvider), - ("goerli-fork", TenderlyForkProvider), + ("sepolia-fork", TenderlyForkProvider), ], "optimism": [ ("mainnet", TenderlyGatewayProvider), ("mainnet-fork", TenderlyForkProvider), - ("goerli", TenderlyGatewayProvider), - ("goerli-fork", TenderlyForkProvider), + ("sepolia", TenderlyGatewayProvider), + ("sepolia-fork", TenderlyForkProvider), ], "base": [ ("mainnet", TenderlyGatewayProvider), ("mainnet-fork", TenderlyForkProvider), - ("goerli", TenderlyGatewayProvider), - ("goerli-fork", TenderlyForkProvider), + ("sepolia", TenderlyGatewayProvider), + ("sepolia-fork", TenderlyForkProvider), ], "avalance": [ ("mainnet-fork", TenderlyForkProvider), diff --git a/ape_tenderly/client.py b/ape_tenderly/client.py index 82d02d1..318cbcb 100644 --- a/ape_tenderly/client.py +++ b/ape_tenderly/client.py @@ -81,7 +81,7 @@ def remove_fork(self, fork_id: str): def get_gateway_rpc_uri(self, ecosystem_name: str, network_name: str) -> str: if ecosystem_name == "ethereum": - # e.g. Sepolia, Goerli, etc. + # e.g. Sepolia, etc. network_subdomain = network_name elif network_name == "mainnet": # e.g. Polygon mainnet, Optimism, etc. diff --git a/ape_tenderly/provider.py b/ape_tenderly/provider.py index 8373921..f0dcfee 100644 --- a/ape_tenderly/provider.py +++ b/ape_tenderly/provider.py @@ -7,7 +7,11 @@ from ape_ethereum.provider import Web3Provider from web3 import HTTPProvider, Web3 from web3.gas_strategies.rpc import rpc_gas_price_strategy -from web3.middleware import geth_poa_middleware + +try: + from web3.middleware import ExtraDataToPOAMiddleware # type: ignore +except ImportError: + from web3.middleware import geth_poa_middleware as ExtraDataToPOAMiddleware # type: ignore from .client import Fork, TenderlyClient @@ -91,12 +95,12 @@ def connect(self): raise ProviderError(f"Failed to connect to Tenderly Gateway.\n{repr(err)}") from err # Any chain that *began* as PoA needs the middleware for pre-merge blocks - ethereum_goerli = 5 + ethereum_sepolia = 11155111 optimism = (10, 420) polygon = (137, 80001) - if chain_id in (ethereum_goerli, *optimism, *polygon): - self._web3.middleware_onion.inject(geth_poa_middleware, layer=0) + if chain_id in (ethereum_sepolia, *optimism, *polygon): + self._web3.middleware_onion.inject(ExtraDataToPOAMiddleware, layer=0) self._web3.eth.set_gas_price_strategy(rpc_gas_price_strategy) diff --git a/setup.py b/setup.py index 1af58cc..ad0ee87 100644 --- a/setup.py +++ b/setup.py @@ -61,9 +61,10 @@ url="https://github.com/ApeWorX/ape-tenderly", include_package_data=True, install_requires=[ - "eth-ape>=0.7.0,<0.8", - "eth-pydantic-types", # Use same version as eth-ape - "requests", # Use same version as eth-ape + "eth-ape>=0.8.1,<0.9", + "eth-pydantic-types>=0.1.3,<0.2", + "web3>=6.20.3,<8", + "requests>=2.28.1,<3", ], python_requires=">=3.8,<4", extras_require=extras_require, From 7db520d04b4452f5de71ad237481390c94c4aedc Mon Sep 17 00:00:00 2001 From: NotPeopling2day <32708219+NotPeopling2day@users.noreply.github.com> Date: Thu, 5 Dec 2024 10:01:08 -0500 Subject: [PATCH 2/3] chore: pr feedback --- ape_tenderly/__init__.py | 2 +- ape_tenderly/provider.py | 3 +-- setup.py | 4 ++-- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/ape_tenderly/__init__.py b/ape_tenderly/__init__.py index 9aafaeb..60fd154 100644 --- a/ape_tenderly/__init__.py +++ b/ape_tenderly/__init__.py @@ -31,7 +31,7 @@ ("sepolia", TenderlyGatewayProvider), ("sepolia-fork", TenderlyForkProvider), ], - "avalance": [ + "avalanche": [ ("mainnet-fork", TenderlyForkProvider), ], "fantom": [ diff --git a/ape_tenderly/provider.py b/ape_tenderly/provider.py index f0dcfee..4ec996d 100644 --- a/ape_tenderly/provider.py +++ b/ape_tenderly/provider.py @@ -95,11 +95,10 @@ def connect(self): raise ProviderError(f"Failed to connect to Tenderly Gateway.\n{repr(err)}") from err # Any chain that *began* as PoA needs the middleware for pre-merge blocks - ethereum_sepolia = 11155111 optimism = (10, 420) polygon = (137, 80001) - if chain_id in (ethereum_sepolia, *optimism, *polygon): + if chain_id in (*optimism, *polygon): self._web3.middleware_onion.inject(ExtraDataToPOAMiddleware, layer=0) self._web3.eth.set_gas_price_strategy(rpc_gas_price_strategy) diff --git a/setup.py b/setup.py index ad0ee87..13ff269 100644 --- a/setup.py +++ b/setup.py @@ -61,9 +61,9 @@ url="https://github.com/ApeWorX/ape-tenderly", include_package_data=True, install_requires=[ - "eth-ape>=0.8.1,<0.9", + "eth-ape>=0.8.21,<0.9", "eth-pydantic-types>=0.1.3,<0.2", - "web3>=6.20.3,<8", + "web3>=6.20.1,<8", "requests>=2.28.1,<3", ], python_requires=">=3.8,<4", From d8512576027aa9fb0d5057bab1ac1bde6cebeec5 Mon Sep 17 00:00:00 2001 From: NotPeopling2day <32708219+NotPeopling2day@users.noreply.github.com> Date: Thu, 5 Dec 2024 11:33:37 -0500 Subject: [PATCH 3/3] chore: update python versions --- .github/workflows/commitlint.yaml | 4 ++-- .github/workflows/prtitle.yaml | 4 ++-- .github/workflows/publish.yaml | 6 +++--- .github/workflows/test.yaml | 14 +++++++------- .pre-commit-config.yaml | 14 +++++++------- README.md | 2 +- pyproject.toml | 2 +- setup.py | 19 +++++++++++-------- 8 files changed, 34 insertions(+), 31 deletions(-) diff --git a/.github/workflows/commitlint.yaml b/.github/workflows/commitlint.yaml index 021b990..3b8de5e 100644 --- a/.github/workflows/commitlint.yaml +++ b/.github/workflows/commitlint.yaml @@ -9,12 +9,12 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Setup Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: "3.10" diff --git a/.github/workflows/prtitle.yaml b/.github/workflows/prtitle.yaml index a6cd3b0..6e8999f 100644 --- a/.github/workflows/prtitle.yaml +++ b/.github/workflows/prtitle.yaml @@ -12,10 +12,10 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: "3.10" diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 88b2e64..081d138 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -10,10 +10,10 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: "3.10" @@ -21,7 +21,7 @@ jobs: run: | python -m pip install --upgrade pip pip install -e .[release] - + - name: Build run: python setup.py sdist bdist_wheel diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 96c0779..611f860 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -14,10 +14,10 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: "3.10" @@ -42,10 +42,10 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: "3.10" @@ -63,13 +63,13 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest] # eventually add `windows-latest` - python-version: [3.8, 3.9, "3.10", "3.11"] + python-version: [3.9, "3.10", "3.11", "3.12", "3.13"] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Setup Python - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3688199..b21d55a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,33 +1,33 @@ repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + rev: v5.0.0 hooks: - id: check-yaml -- repo: https://github.com/pre-commit/mirrors-isort - rev: v5.10.1 +- repo: https://github.com/PyCQA/isort + rev: 5.13.2 hooks: - id: isort - repo: https://github.com/psf/black - rev: 23.12.0 + rev: 24.10.0 hooks: - id: black name: black - repo: https://github.com/pycqa/flake8 - rev: 6.1.0 + rev: 7.1.1 hooks: - id: flake8 - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.7.1 + rev: v1.13.0 hooks: - id: mypy additional_dependencies: [types-requests, types-setuptools, pydantic] - repo: https://github.com/executablebooks/mdformat - rev: 0.7.17 + rev: 0.7.19 hooks: - id: mdformat additional_dependencies: [mdformat-gfm, mdformat-frontmatter] diff --git a/README.md b/README.md index ba248a8..65913ae 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ Ecosystem plugin for Tenderly support in Ape. ## Dependencies -- [python3](https://www.python.org/downloads) version 3.8 up to 3.11. +- [python3](https://www.python.org/downloads) version 3.9 up to 3.13. ## Installation diff --git a/pyproject.toml b/pyproject.toml index 1fda1f0..11b5011 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -15,7 +15,7 @@ write_to = "ape_tenderly/version.py" [tool.black] line-length = 100 -target-version = ['py38', 'py39', 'py310', 'py311'] +target-version = ['py39', 'py310', 'py311', 'py312', 'py313'] include = '\.pyi?$' [tool.pytest.ini_options] diff --git a/setup.py b/setup.py index 13ff269..fc93aba 100644 --- a/setup.py +++ b/setup.py @@ -10,18 +10,20 @@ "hypothesis>=6.2.0,<7.0", # Strategy-based fuzzer ], "lint": [ - "black>=23.12.0,<24", # Auto-formatter and linter - "mypy>=1.7.1,<2", # Static type analyzer + "black>=24.10.0,<25", # Auto-formatter and linter + "mypy>=1.13.0,<2", # Static type analyzer "types-setuptools", # Needed for mypy type shed "types-requests", # Needed for mypy type shed - "flake8>=6.1.0,<7", # Style linter + "flake8>=7.1.1,<8", # Style linter "flake8-breakpoint>=1.1.0,<2", # Detect breakpoints left in code "flake8-print>=5.0.0,<6", # Detect print statements left in code - "isort>=5.10.1,<6", # Import sorting linter - "mdformat>=0.7.17", # Auto-formatter for markdown + "flake8-pydantic", # For detecting issues with Pydantic models + "flake8-type-checking", # Detect imports to move in/out of type-checking blocks + "isort>=5.13.2,<6", # Import sorting linter + "mdformat>=0.7.19", # Auto-formatter for markdown "mdformat-gfm>=0.3.5", # Needed for formatting GitHub-flavored markdown "mdformat-frontmatter>=0.4.1", # Needed for frontmatters-style headers in issue templates - "mdformat-pyproject>=0.0.1", # Allows configuring in pyproject.toml + "mdformat-pyproject>=0.0.2", # Allows configuring in pyproject.toml ], "release": [ # `release` GitHub Action job uses this "setuptools", # Installation tool @@ -66,7 +68,7 @@ "web3>=6.20.1,<8", "requests>=2.28.1,<3", ], - python_requires=">=3.8,<4", + python_requires=">=3.9,<4", extras_require=extras_require, py_modules=["ape_tenderly"], license="Apache-2.0", @@ -82,9 +84,10 @@ "Operating System :: MacOS", "Operating System :: POSIX", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", ], )