diff --git a/src/ape/api/providers.py b/src/ape/api/providers.py index 9a453fb561..76176f5aa6 100644 --- a/src/ape/api/providers.py +++ b/src/ape/api/providers.py @@ -855,7 +855,8 @@ def chain_id(self) -> int: @property def gas_price(self) -> int: - return self._web3.eth.generate_gas_price() # type: ignore + price = self._web3.eth.generate_gas_price() or 0 + return int(price, 16) if isinstance(price, str) and is_0x_prefixed(price) else int(price) @property def priority_fee(self) -> int: diff --git a/tests/functional/test_geth.py b/tests/functional/test_geth.py index 241714d3d1..4eff9dd3ff 100644 --- a/tests/functional/test_geth.py +++ b/tests/functional/test_geth.py @@ -504,3 +504,9 @@ def test_out_of_gas_error(geth_contract, geth_account, geth_provider): geth_account.call(txn) assert err.value.txn is not None + + +@geth_process_test +def test_gas_price(geth_provider): + actual = geth_provider.gas_price + assert isinstance(actual, int) diff --git a/tests/functional/test_provider.py b/tests/functional/test_provider.py index 149c566f75..1586630265 100644 --- a/tests/functional/test_provider.py +++ b/tests/functional/test_provider.py @@ -232,3 +232,8 @@ def test_get_virtual_machine_error_panic(eth_tester_provider, mocker): assert enrich_spy.call_count == 1 enrich_spy.assert_called_once_with(actual) assert isinstance(actual, ContractLogicError) + + +def test_gas_price(eth_tester_provider): + actual = eth_tester_provider.gas_price + assert isinstance(actual, int)