Skip to content

Commit

Permalink
fix: deprecate goerli (#65)
Browse files Browse the repository at this point in the history
Co-authored-by: NotPeopling2day <[email protected]>
  • Loading branch information
fubuloubu and NotPeopling2day authored Apr 25, 2024
1 parent 6ce67d6 commit 14630db
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 24 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,19 +87,15 @@ jobs:
run: pytest -m "not fuzzing" -s --cov=src -n auto
env:
WEB3_ETHEREUM_MAINNET_ALCHEMY_API_KEY: ${{ secrets.WEB3_ETHEREUM_MAINNET_ALCHEMY_API_KEY }}
WEB3_ETHEREUM_GOERLI_ALCHEMY_API_KEY: ${{ secrets.WEB3_ETHEREUM_GOERLI_ALCHEMY_API_KEY }}
WEB3_ETHEREUM_SEPOLIA_ALCHEMY_API_KEY: ${{ secrets.WEB3_ETHEREUM_SEPOLIA_ALCHEMY_API_KEY }}
WEB3_ARBITRUM_MAINNET_ALCHEMY_API_KEY: ${{ secrets.WEB3_ARBITRUM_MAINNET_ALCHEMY_API_KEY }}
WEB3_ARBITRUM_GOERLI_ALCHEMY_API_KEY: ${{ secrets.WEB3_ARBITRUM_GOERLI_ALCHEMY_API_KEY }}
WEB3_ARBITRUM_SEPOLIA_ALCHEMY_API_KEY: ${{ secrets.WEB3_ARBITRUM_SEPOLIA_ALCHEMY_API_KEY }}
WEB3_BASE_MAINNET_ALCHEMY_API_KEY: ${{ secrets.WEB3_BASE_MAINNET_ALCHEMY_API_KEY }}
WEB3_BASE_GOERLI_ALCHEMY_API_KEY: ${{ secrets.WEB3_BASE_GOERLI_ALCHEMY_API_KEY }}
WEB3_BASE_SEPOLIA_ALCHEMY_API_KEY: ${{ secrets.WEB3_BASE_SEPOLIA_ALCHEMY_API_KEY }}
WEB3_OPTIMISM_MAINNET_ALCHEMY_API_KEY: ${{ secrets.WEB3_OPTIMISM_MAINNET_ALCHEMY_API_KEY }}
WEB3_OPTIMISM_GOERLI_ALCHEMY_API_KEY: ${{ secrets.WEB3_OPTIMISM_GOERLI_ALCHEMY_API_KEY }}
WEB3_OPTIMISM_SEPOLIA_ALCHEMY_API_KEY: ${{ secrets.WEB3_OPTIMISM_SEPOLIA_ALCHEMY_API_KEY }}
WEB3_POLYGON_MAINNET_ALCHEMY_API_KEY: ${{ secrets.WEB3_POLYGON_MAINNET_ALCHEMY_API_KEY }}
WEB3_POLYGON_MUMBAI_ALCHEMY_API_KEY: ${{ secrets.WEB3_POLYGON_MUMBAI_ALCHEMY_API_KEY }}
WEB3_POLYGON_AMOY_ALCHEMY_API_KEY: ${{ secrets.WEB3_POLYGON_AMOY_ALCHEMY_API_KEY }}

# NOTE: uncomment this block after you've marked tests with @pytest.mark.fuzzing
# fuzzing:
Expand Down
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.6.0
hooks:
- id: check-yaml

Expand All @@ -10,18 +10,18 @@ repos:
- id: isort

- repo: https://github.com/psf/black
rev: 23.12.0
rev: 24.3.0
hooks:
- id: black
name: black

- repo: https://github.com/pycqa/flake8
rev: 6.1.0
rev: 7.0.0
hooks:
- id: flake8

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.7.1
rev: v1.9.0
hooks:
- id: mypy
additional_dependencies: [types-PyYAML, types-requests, pydantic, types-setuptools]
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export WEB3_ALCHEMY_PROJECT_ID=MY_API_TOKEN=<value-of-secret-key>
To use the Alchemy provider plugin in most commands, set it via the `--network` option:

```bash
ape console --network ethereum:goerli:alchemy
ape console --network ethereum:sepolia:alchemy
```

To connect to Alchemy from a Python script, use the `networks` top-level manager:
Expand Down
6 changes: 1 addition & 5 deletions ape_alchemy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,27 +5,23 @@
NETWORKS = {
"ethereum": [
"mainnet",
"goerli",
"sepolia",
],
"arbitrum": [
"mainnet",
"goerli",
"sepolia",
],
"base": [
"mainnet",
"goerli",
"sepolia",
],
"optimism": [
"mainnet",
"goerli",
"sepolia",
],
"polygon": [
"mainnet",
"mumbai",
"amoy",
],
}

Expand Down
4 changes: 2 additions & 2 deletions ape_alchemy/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,12 @@ def connect(self):
self._web3 = Web3(HTTPProvider(self.uri))
try:
# Any chain that *began* as PoA needs the middleware for pre-merge blocks
ethereum_goerli = 5
ethereum_sepolia = 11155111
base = (8453, 84531)
optimism = (10, 420)
polygon = (137, 80001)

if self._web3.eth.chain_id in (ethereum_goerli, *base, *optimism, *polygon):
if self._web3.eth.chain_id in (ethereum_sepolia, *base, *optimism, *polygon):
self._web3.middleware_onion.inject(geth_poa_middleware, layer=0)

self._web3.eth.set_gas_price_strategy(rpc_gas_price_strategy)
Expand Down
6 changes: 3 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
"websocket-client", # Used for web socket integration testing
],
"lint": [
"black>=23.12.0,<24", # Auto-formatter and linter
"mypy>=1.7.1,<2", # Static type analyzer
"black>=24.3.0,<25", # Auto-formatter and linter
"mypy>=1.9.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.0.0,<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
Expand Down
4 changes: 2 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"https://docs.alchemy.com/alchemy/documentation/apis"
)
FEATURE_NOT_AVAILABLE_BECAUSE_OF_NETWORK_RESPONSE = (
"trace_transaction is not available on the ETH_GOERLI. "
"trace_transaction is not available on the ETH_SEPOLIA. "
"For more information see our docs: "
"https://docs.alchemy.com/alchemy/documentation/apis/ethereum"
)
Expand Down Expand Up @@ -92,4 +92,4 @@ def feature_not_available_http_error(mocker, request):

@pytest.fixture
def alchemy_provider(networks) -> Alchemy:
return networks.ethereum.goerli.get_provider("alchemy")
return networks.ethereum.sepolia.get_provider("alchemy")
4 changes: 2 additions & 2 deletions tests/test_providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ def test_when_no_api_key_raises_error(missing_token, alchemy_provider):
"Must set one of "
"$WEB3_ALCHEMY_PROJECT_ID, "
"$WEB3_ALCHEMY_API_KEY, "
"$WEB3_ETHEREUM_GOERLI_ALCHEMY_PROJECT_ID, "
"$WEB3_ETHEREUM_GOERLI_ALCHEMY_API_KEY."
"$WEB3_ETHEREUM_SEPOLIA_ALCHEMY_PROJECT_ID, "
"$WEB3_ETHEREUM_SEPOLIA_ALCHEMY_API_KEY."
),
):
alchemy_provider.connect()
Expand Down

0 comments on commit 14630db

Please sign in to comment.