Skip to content

Commit

Permalink
fix: issue where could not have gas limit of 0 [APE-1307] (ApeWorX#1616)
Browse files Browse the repository at this point in the history
  • Loading branch information
antazoey authored Aug 23, 2023
1 parent 8ebbf51 commit bc52af9
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/ape_ethereum/ecosystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion tests/functional/test_ecosystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -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": [],
Expand All @@ -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):
Expand Down

0 comments on commit bc52af9

Please sign in to comment.