Skip to content

Commit

Permalink
test: fix other test
Browse files Browse the repository at this point in the history
  • Loading branch information
antazoey committed Jan 10, 2025
1 parent fd6c37f commit ffb6339
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
5 changes: 1 addition & 4 deletions src/ape_ethereum/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -616,10 +616,7 @@ def priority_fee(self) -> int:

def _get_chain_id(self) -> int:
result = self.make_request("eth_chainId", [])
if isinstance(result, int):
return result

return int(result, 16)
return result if isinstance(result, int) else int(result, 16)

def get_block(self, block_id: "BlockID") -> BlockAPI:
if isinstance(block_id, str) and block_id.isnumeric():
Expand Down
9 changes: 8 additions & 1 deletion tests/functional/geth/test_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,14 @@ def test_connect_to_chain_that_started_poa(mock_web3, web3_factory, ethereum):
to fetch blocks during the PoA portion of the chain.
"""
mock_web3.eth.get_block.side_effect = ExtraDataLengthError
mock_web3.eth.chain_id = ethereum.sepolia.chain_id

def make_request(rpc, arguments):
if rpc == "eth_chainId":
return {"result": ethereum.sepolia.chain_id}

return None

mock_web3.provider.make_request.side_effect = make_request
web3_factory.return_value = mock_web3
provider = ethereum.sepolia.get_provider("node")
provider.provider_settings = {"uri": "http://node.example.com"} # fake
Expand Down

0 comments on commit ffb6339

Please sign in to comment.