Merge bda20447a1286b38d1db763fd75ea0769cdea867 into 26aa190b03cfff865382818a641a125d2118b92f

This commit is contained in:
can 2023-06-01 00:58:20 -07:00 committed by GitHub
commit 4d40f7ee41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 0 deletions

View File

@ -35,6 +35,19 @@ async def create_from_block_number(
_find_or_fetch_base_fee_per_gas(w3, block_number, trace_db_session),
)
# filter out failed transactions
failed_transactions = set(
receipt.transaction_hash for receipt in receipts if receipt.status == 0
)
receipts = [
receipt
for receipt in receipts
if receipt.transaction_hash not in failed_transactions
]
traces = [
trace for trace in traces if trace.transaction_hash not in failed_transactions
]
miner_address = _get_miner_address_from_traces(traces)
return Block(

View File

@ -15,6 +15,7 @@ class Receipt(CamelModel):
effective_gas_price: int
cumulative_gas_used: int
to: Optional[str]
status: int
@validator(
"block_number",
@ -22,6 +23,7 @@ class Receipt(CamelModel):
"gas_used",
"effective_gas_price",
"cumulative_gas_used",
"status",
pre=True,
)
def maybe_hex_to_int(v):

View File

@ -23,6 +23,9 @@ def load_test_block(block_number: int) -> Block:
with open(block_path, "r") as block_file:
block_json = json.load(block_file)
for item in block_json["receipts"]:
if "status" not in item:
item["status"] = "0x1"
return Block(
**{
**defaults,