diff --git a/src/ape_ethereum/ecosystem.py b/src/ape_ethereum/ecosystem.py index 6324fb240e..32c08ecb83 100644 --- a/src/ape_ethereum/ecosystem.py +++ b/src/ape_ethereum/ecosystem.py @@ -357,9 +357,9 @@ def decode_receipt(self, data: dict) -> ReceiptAPI: receipt = Receipt( block_number=data.get("block_number") or data.get("blockNumber"), contract_address=data.get("contract_address") or data.get("contractAddress"), - gas_limit=data.get("gas") or data.get("gas_limit") or data.get("gasLimit"), - gas_price=data.get("gas_price") or data.get("gasPrice"), - gas_used=data.get("gas_used") or data.get("gasUsed"), + gas_limit=data.get("gas", data.get("gas_limit", data.get("gasLimit"))) or 0, + gas_price=data.get("gas_price", data.get("gasPrice")) or 0, + gas_used=data.get("gas_used", data.get("gasUsed")) or 0, logs=data.get("logs", []), status=status, txn_hash=txn_hash, diff --git a/tests/functional/test_ecosystem.py b/tests/functional/test_ecosystem.py index 6f45c3dba7..30804e9ec9 100644 --- a/tests/functional/test_ecosystem.py +++ b/tests/functional/test_ecosystem.py @@ -165,7 +165,7 @@ def test_decode_block_when_hash_is_none(ethereum): "totalDifficulty": 131073, "extraData": HexBytes("0x"), "size": 513, - "gasLimit": 30000000, + "gasLimit": 0, "gasUsed": 0, "timestamp": 1660932629, "transactions": [], @@ -174,6 +174,7 @@ def test_decode_block_when_hash_is_none(ethereum): } actual = ethereum.decode_block(block_data_with_none_hash) assert actual.hash is None + assert actual.gas_limit == 0 def test_decode_block_with_hex_values(ethereum):