Skip to content

Commit b200d2d

Browse files
authored
Merge branch 'main' into main
2 parents af3a138 + 858132d commit b200d2d

File tree

14 files changed

+43
-39
lines changed

14 files changed

+43
-39
lines changed

.github/workflows/test.yaml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,8 @@ jobs:
7979
with:
8080
python-version: ${{ matrix.python-version }}
8181

82-
- name: Setup Go
83-
uses: actions/setup-go@v5
84-
with:
85-
go-version: '^1.20.7'
86-
8782
- name: Install Geth
88-
uses: gacts/install-geth-tools@v1
89-
with:
90-
version: 1.15.6
83+
uses: ApeWorX/geth-action@v1
9184

9285
- name: Setup Ape
9386
uses: ApeWorX/github-action@v3

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[![Pypi.org][pypi-badge]][pypi-url]
2-
[![Apache licensed][licence-badge]][licence-url]
2+
[![Apache licensed][license-badge]][license-url]
33
[![Build Status][actions-badge]][actions-url]
4+
[![Contributing][contributing-badge]][contributing-url]
45
[![Discord chat][discord-badge]][discord-url]
56
[![Twitter][twitter-badge]][twitter-url]
67

@@ -133,10 +134,12 @@ Install 3rd party plugins at your own risk.
133134
[actions-url]: https://github.com/ApeWorX/ape/actions?query=branch%3Amain+event%3Apush
134135
[compile-guide]: https://docs.apeworx.io/ape/stable/userguides/compile.html
135136
[console-guide]: https://docs.apeworx.io/ape/stable/userguides/console.html
137+
[contributing-badge]: https://img.shields.io/badge/CONTRIBUTING-guidelines-brightgreen?style=flat-square
138+
[contributing-url]: https://github.com/ApeWorX/ape?tab=contributing-ov-file
136139
[discord-badge]: https://img.shields.io/discord/922917176040640612.svg?logo=discord&style=flat-square
137140
[discord-url]: https://discord.gg/apeworx
138-
[licence-badge]: https://img.shields.io/github/license/ApeWorX/ape?color=blue
139-
[licence-url]: https://github.com/ApeWorX/ape/blob/main/LICENSE
141+
[license-badge]: https://img.shields.io/github/license/ApeWorX/ape?color=blue
142+
[license-url]: https://github.com/ApeWorX/ape?tab=License-1-ov-file
140143
[logging-guide]: https://docs.apeworx.io/ape/stable/userguides/logging.html
141144
[networks-guide]: https://docs.apeworx.io/ape/stable/userguides/networks.html
142145
[projects-guide]: https://docs.apeworx.io/ape/stable/userguides/projects.html

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@
119119
"eth-typing>=3.5.2,<6",
120120
"eth-utils>=2.1.0,<6",
121121
"hexbytes>=1.2.0,<2",
122-
"py-geth>=5.4.0,<6",
122+
"py-geth>=6.2.0,<7",
123123
"trie>=3.0.1,<4", # Peer: stricter pin needed for uv support.
124124
"web3[tester]>=7.12.1,<8",
125125
# ** Dependencies maintained by ApeWorX **

src/ape/api/address.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ def prepare_transaction(self, txn: "TransactionAPI", **kwargs) -> "TransactionAP
251251
):
252252
raise AccountsError(
253253
f"Transfer value meets or exceeds account balance "
254-
f"for account '{self.address}' on chain '{self.provider.chain_id}' "
254+
f"for account '{self.address}' on chain '{self.chain_manager.chain_id}' "
255255
f"using provider '{self.provider.name}'.\n"
256256
"Are you using the correct account / chain / provider combination?\n"
257257
f"(transfer_value={txn.total_transfer_value}, balance={self.balance})."

src/ape/api/networks.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,11 @@ class EcosystemAPI(ExtraAttributesMixin, BaseInterfaceModel):
123123
"""The default network of the ecosystem, such as ``local``."""
124124

125125
@model_validator(mode="after")
126-
@classmethod
127-
def _validate_ecosystem(cls, model):
128-
headers = RPCHeaders(**model.request_header)
129-
headers["User-Agent"] = f"ape-{model.name}"
130-
model.request_header = dict(**headers)
131-
return model
126+
def _validate_ecosystem(self):
127+
headers = RPCHeaders(**self.request_header)
128+
headers["User-Agent"] = f"ape-{self.name}"
129+
self.request_header = dict(**headers)
130+
return self
132131

133132
@log_instead_of_fail(default="<EcosystemAPI>")
134133
def __repr__(self) -> str:
@@ -1042,7 +1041,9 @@ def explorer(self) -> Optional["ExplorerAPI"]:
10421041
Returns:
10431042
:class:`ape.api.explorers.ExplorerAPI`, optional
10441043
"""
1045-
chain_id = None if self.network_manager.active_provider is None else self.provider.chain_id
1044+
chain_id = (
1045+
None if self.network_manager.active_provider is None else self.chain_manager.chain_id
1046+
)
10461047
for plugin_name, plugin_tuple in self._plugin_explorers:
10471048
ecosystem_name, network_name, explorer_class = plugin_tuple
10481049

src/ape/managers/_contractscache.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ def _get_errors(
421421
self, address: AddressType, chain_id: Optional[int] = None
422422
) -> set[type[CustomError]]:
423423
if chain_id is None and self.network_manager.active_provider is not None:
424-
chain_id = self.provider.chain_id
424+
chain_id = self.chain_manager.chain_id
425425
elif chain_id is None:
426426
return set()
427427

@@ -438,7 +438,7 @@ def _cache_error(
438438
self, address: AddressType, error: type[CustomError], chain_id: Optional[int] = None
439439
):
440440
if chain_id is None and self.network_manager.active_provider is not None:
441-
chain_id = self.provider.chain_id
441+
chain_id = self.chain_manager.chain_id
442442
elif chain_id is None:
443443
return
444444

src/ape/managers/chain.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,6 @@ def revert_to_block(self, block_number: int):
605605
Args:
606606
block_number (int): The block number to revert to.
607607
"""
608-
609608
self._hash_to_receipt_map = {
610609
h: r for h, r in self._hash_to_receipt_map.items() if r.block_number <= block_number
611610
}
@@ -821,7 +820,7 @@ def snapshot(self) -> "SnapshotID":
821820
Returns:
822821
:class:`~ape.types.SnapshotID`: The snapshot ID.
823822
"""
824-
chain_id = self.provider.chain_id
823+
chain_id = self.chain_manager.chain_id
825824
snapshot_id = self.provider.snapshot()
826825
if snapshot_id not in self._snapshots[chain_id]:
827826
self._snapshots[chain_id].append(snapshot_id)
@@ -843,7 +842,7 @@ def restore(self, snapshot_id: Optional["SnapshotID"] = None):
843842
snapshot_id (Optional[:class:`~ape.types.SnapshotID`]): The snapshot ID. Defaults
844843
to the most recent snapshot ID.
845844
"""
846-
chain_id = self.provider.chain_id
845+
chain_id = self.chain_manager.chain_id
847846
if snapshot_id is None and not self._snapshots[chain_id]:
848847
raise ChainError("There are no snapshots to revert to.")
849848
elif snapshot_id is None:

src/ape/pytest/fixtures.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -648,7 +648,7 @@ def restore_snapshot(self, scope: Scope):
648648
if snapshot_id is None:
649649
return
650650

651-
elif snapshot_id not in self.chain_snapshots[self.provider.chain_id]:
651+
elif snapshot_id not in self.chain_snapshots[self.chain_manager.chain_id]:
652652
# Still clear out.
653653
self.snapshots.clear_snapshot_id(scope)
654654
return
@@ -662,6 +662,8 @@ def restore_snapshot(self, scope: Scope):
662662
)
663663
# To avoid trying again
664664
self.supported = False
665+
except Exception as err:
666+
logger.error(f"Unhandled error with restoring snapshot: {err}")
665667

666668
self.snapshots.clear_snapshot_id(scope)
667669

src/ape_accounts/accounts.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ def sign_authorization(
8888
nonce: Optional[int] = None,
8989
) -> Optional[MessageSignature]:
9090
if chain_id is None:
91-
chain_id = self.provider.chain_id
91+
chain_id = self.chain_manager.chain_id
9292

9393
signed_authorization = EthAccount.sign_authorization(
9494
dict(
@@ -172,7 +172,7 @@ def set_delegate(self, contract: Union[BaseAddress, AddressType, str], **txn_kwa
172172
sig = self.sign_authorization(contract_address, nonce=self.nonce + 1)
173173
auth = Authorization.from_signature(
174174
address=contract_address,
175-
chain_id=self.provider.chain_id,
175+
chain_id=self.chain_manager.chain_id,
176176
# NOTE: `tx` uses `self.nonce`
177177
nonce=self.nonce + 1,
178178
signature=sig,
@@ -190,7 +190,7 @@ def set_delegate(self, contract: Union[BaseAddress, AddressType, str], **txn_kwa
190190
def remove_delegate(self, **txn_kwargs):
191191
sig = self.sign_authorization(ZERO_ADDRESS, nonce=self.nonce + 1)
192192
auth = Authorization.from_signature(
193-
chain_id=self.provider.chain_id,
193+
chain_id=self.chain_manager.chain_id,
194194
address=ZERO_ADDRESS,
195195
# NOTE: `tx` uses `self.nonce`
196196
nonce=self.nonce + 1,

src/ape_ethereum/ecosystem.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -963,7 +963,7 @@ def create_transaction(self, **kwargs) -> "TransactionAPI":
963963
tx_data["chainId"] = int(chain_id, 16)
964964

965965
elif chain_id is None and self.network_manager.active_provider is not None:
966-
tx_data["chainId"] = self.provider.chain_id
966+
tx_data["chainId"] = self.chain_manager.chain_id
967967

968968
if "input" in tx_data:
969969
tx_data["data"] = tx_data.pop("input")

0 commit comments

Comments
 (0)