Skip to content

Commit

Permalink
fix: wip
Browse files Browse the repository at this point in the history
  • Loading branch information
antazoey committed Oct 26, 2024
1 parent fee84bb commit c064b47
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/ape_ethereum/ecosystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -598,9 +598,18 @@ def decode_receipt(self, data: dict) -> ReceiptAPI:
"blob_gas_used",
)
):
receipt_cls = SharedBlobReceipt
receipt_kwargs["blobGasPrice"] = data.get("blob_gas_price", data.get("blobGasPrice"))
receipt_kwargs["blobGasUsed"] = data.get("blob_gas_used", data.get("blobGasUsed")) or 0

blob_gas_price = data.get("blob_gas_price", data.get("blobGasPrice"))
if blob_gas_price is None:
# Not actually a blob-receipt? Some providers may give you
# empty values here when meaning the other types of receipts.
receipt_cls = Receipt

else:
receipt_cls = SharedBlobReceipt
receipt_kwargs["blobGasPrice"] = blob_gas_price
receipt_kwargs["blobGasUsed"] = data.get("blob_gas_used", data.get("blobGasUsed")) or 0

else:
receipt_cls = Receipt

Expand Down
8 changes: 8 additions & 0 deletions tests/functional/test_ecosystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -631,6 +631,14 @@ def test_decode_receipt_shared_blob(ethereum, blob_gas_used, blob_gas_key):
assert actual.blob_gas_used == 0


def test_decode_receipt_blob_gas_price_none():
"""
Tests a strange situation where the blob-related keys are in the
data but a required key is None. In this case, the provider is returning
empty data for these values and we should use the regular receipt.
"""


def test_default_transaction_type_not_connected_used_default_network(project, ethereum, networks):
value = TransactionType.STATIC.value
config_dict = {"ethereum": {"mainnet_fork": {"default_transaction_type": value}}}
Expand Down

0 comments on commit c064b47

Please sign in to comment.