diff --git a/src/ape_ethereum/ecosystem.py b/src/ape_ethereum/ecosystem.py index 5371441c29..54c391b681 100644 --- a/src/ape_ethereum/ecosystem.py +++ b/src/ape_ethereum/ecosystem.py @@ -573,13 +573,18 @@ def decode_receipt(self, data: dict) -> ReceiptAPI: receipt_cls: type[Receipt] if any( x in data - for x in ("blobGasPrice", "blobGasUsed", "blobVersionedHashes", "maxFeePerBlobGas") + for x in ( + "blobGasPrice", + "blobGasUsed", + "blobVersionedHashes", + "maxFeePerBlobGas", + "blob_gas_price", + "blob_gas_used", + ) ): receipt_cls = SharedBlobReceipt - receipt_kwargs["blob_gas_price"] = data.get("blob_gas_price", data.get("blobGasPrice")) - receipt_kwargs["blob_gas_used"] = ( - data.get("blob_gas_used", data.get("blobGasUsed")) or 0 - ) + receipt_kwargs["blobGasPrice"] = data.get("blob_gas_price", data.get("blobGasPrice")) + receipt_kwargs["blobGasUsed"] = data.get("blob_gas_used", data.get("blobGasUsed")) or 0 else: receipt_cls = Receipt diff --git a/src/ape_ethereum/transactions.py b/src/ape_ethereum/transactions.py index b51a9d9f55..843d4a93ae 100644 --- a/src/ape_ethereum/transactions.py +++ b/src/ape_ethereum/transactions.py @@ -412,12 +412,12 @@ class SharedBlobReceipt(Receipt): blob transaction. """ - blob_gas_used: HexInt + blob_gas_used: Optional[HexInt] = Field(default=None, alias="blobGasUsed") """ The total amount of blob gas consumed by the transactions within the block. """ - blob_gas_price: HexInt + blob_gas_price: HexInt = Field(alias="blobGasPrice") """ The blob-gas price, independent from regular gas price. """ diff --git a/tests/functional/test_ecosystem.py b/tests/functional/test_ecosystem.py index 08b7ffa2fb..fdaf5b2626 100644 --- a/tests/functional/test_ecosystem.py +++ b/tests/functional/test_ecosystem.py @@ -551,8 +551,16 @@ def test_decode_receipt_from_etherscan(eth_tester_provider, ethereum): assert receipt.gas_price == 1499999989 -@pytest.mark.parametrize("blob_gas_used", ("0x20000", 131072, 0, None)) -def test_decode_receipt_shared_blob(ethereum, blob_gas_used): +@pytest.mark.parametrize( + "blob_gas_used,blob_gas_key", + [ + ("0x20000", "blobGasUsed"), + (131072, "blob_gas_used"), + (0, "blobGasUsed"), + (None, "blobGasUsed"), + ], +) +def test_decode_receipt_shared_blob(ethereum, blob_gas_used, blob_gas_key): blob_gas_price = "0x4d137e31b" data = { @@ -582,7 +590,7 @@ def test_decode_receipt_shared_blob(ethereum, blob_gas_used): "s": HexBytes("0x31c98ea044c97225d83b9a3f0fa719e2299b9fbc6436e4b3eb096ea528de03ff"), "yParity": 0, "blobGasPrice": blob_gas_price, - "blobGasUsed": blob_gas_used, + blob_gas_key: blob_gas_used, "contractAddress": None, "cumulativeGasUsed": 23085827, "effectiveGasPrice": 1000000008,