Skip to content

Commit

Permalink
fix: adhoc network connection fix (#2468)
Browse files Browse the repository at this point in the history
Co-authored-by: antazoey <antyzoa@gmail.com>
  • Loading branch information
antazoey and antazoey authored Jan 13, 2025
1 parent 7f20fde commit a1eed98
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/ape_ethereum/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -572,8 +572,7 @@ def estimate_gas_cost(self, txn: TransactionAPI, block_id: Optional["BlockID"] =
@cached_property
def chain_id(self) -> int:
default_chain_id = None

if self.network.is_custom or not self.network.is_dev:
if (not self.network.is_adhoc and self.network.is_custom) or not self.network.is_dev:
# If using a live network, the chain ID is hardcoded.
default_chain_id = self.network.chain_id

Expand Down
5 changes: 5 additions & 0 deletions tests/functional/test_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,11 @@ def test_chain_id_when_disconnected(eth_tester_provider):
eth_tester_provider.connect()


def test_chain_id_adhoc(networks):
with networks.parse_network_choice("https://www.shibrpc.com") as bor:
assert bor.chain_id == 109


def test_get_receipt_not_exists_with_timeout(eth_tester_provider):
unknown_txn = "0x053cba5c12172654d894f66d5670bab6215517a94189a9ffc09bc40a589ec04d"
expected = (
Expand Down

0 comments on commit a1eed98

Please sign in to comment.