Skip to content

fix(flashblocks): correct receipts type in FlashBlock metadata#3795

Merged
mattsse merged 2 commits intoalloy-rs:mainfrom
0xSojol:fix-flashblock-receipts
Mar 13, 2026
Merged

fix(flashblocks): correct receipts type in FlashBlock metadata#3795
mattsse merged 2 commits intoalloy-rs:mainfrom
0xSojol:fix-flashblock-receipts

Conversation

@0xSojol
Copy link
Copy Markdown
Contributor

@0xSojol 0xSojol commented Mar 11, 2026

Motivation

The current FlashBlock type defines the receipts field as:

`BTreeMap<B256, BTreeMap<String, Receipt>>`

However, the actual FlashBlocks response from the Base FlashBlocks endpoint returns receipts in the following format:

    "receipts": {
        "0x...tx_hash": {
            "cumulativeGasUsed": "...",
            "logs": [...],
            "status": "0x1"
        }
    }

There is no transaction-type wrapper (e.g. "Legacy" or "Eip1559") around the
Receipt. Because of this mismatch, deserialization fails with errors such as:

invalid type: string "...", expected struct Receipt

when attempting to parse real FlashBlocks data.

Solution

Update the receipts field type in Metadata to match the actual FlashBlocks schema:

`BTreeMap<B256, Receipt>`

The FlashBlock roundtrip test JSON was also updated to remove the extra
Legacy / Eip1559 wrapper fields so that it reflects the real response
structure returned by the FlashBlocks API.

This change fixes deserialization when consuming live FlashBlocks data.

@0xSojol 0xSojol changed the title Fix FlashBlock receipts type fix(flashblocks): correct receipts type in FlashBlock metadata Mar 11, 2026
Copy link
Copy Markdown
Member

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@github-project-automation github-project-automation Bot moved this to Reviewed in Alloy Mar 12, 2026
@mattsse mattsse merged commit 0dbd969 into alloy-rs:main Mar 13, 2026
30 checks passed
@github-project-automation github-project-automation Bot moved this from Reviewed to Done in Alloy Mar 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants