Skip to content

ir: add BIP152 getblocktxn/getdata(cmpctblock) generators + probe feedback loop#150

Draft
brunoerg wants to merge 1 commit into
oss-garage:masterfrom
brunoerg:compact-blocks
Draft

ir: add BIP152 getblocktxn/getdata(cmpctblock) generators + probe feedback loop#150
brunoerg wants to merge 1 commit into
oss-garage:masterfrom
brunoerg:compact-blocks

Conversation

@brunoerg

@brunoerg brunoerg commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Add GetCompactBlockGenerator and GetBlockTxnGenerator so the IR can drive the pull side of compact block relay: request a compact block via getdata(MSG_CMPCT_BLOCK) for a block the node announced, and follow up with a getblocktxn for a cmpctblock the node sent us.

Neither flow can be synthesized in a single program (a getblocktxn is only meaningful after the node itself sends a cmpctblock, which the IR cannot fabricate). Instead, extend the probe mechanism to record headers/inv and cmpctblock messages, decode them into BlockAnnouncement/ CompactBlockAnnouncement metadata, and let generators insert the matching follow-up request right after the instruction that triggered the announcement on a later mutation pass.

Refactor bin/ir.rs into fuzzamoto-scenarios/src/lib.rs as a generic IrScenario<TX, T, const CMPCT: bool> so the existing scenario and the new compact-block variant (scenario-ir-cmpctblock, bin/ir_cmpctblock.rs) share one implementation, differing only in which messages get recorded/drained (is there a better way to do it? I ended up creating this lib.rs to avoid duplicating code).

@dergoegge

Copy link
Copy Markdown
Member

Neither flow can be synthesized in a single program (a getblocktxn is only meaningful after the node itself sends a cmpctblock, which the IR cannot fabricate). Instead, extend the probe mechanism to record headers/inv and cmpctblock messages, decode them into BlockAnnouncement/ CompactBlockAnnouncement metadata, and let generators insert the matching follow-up request right after the instruction that triggered the announcement on a later mutation pass.

Any block a node announces will have been generated by the IR, so I'm not sure if we need to split into two separate scenarios. If the scenario receives an inv or cmpctblock etc., the probing should result in testcase metadata, that tells a generator/mutator details about what mutations would be useful (similar to how the probing for blocktxn already works).

@brunoerg

brunoerg commented Jul 2, 2026

Copy link
Copy Markdown
Contributor Author

Any block a node announces will have been generated by the IR, so I'm not sure if we need to split into two separate scenarios. If the scenario receives an inv or cmpctblock etc., the probing should result in testcase metadata, that tells a generator/mutator details about what mutations would be useful (similar to how the probing for blocktxn already works).

I was in doubt about this part, will see it better.

…dback loop

Add GetCompactBlockGenerator and GetBlockTxnGenerator so the IR can drive
the pull side of compact block relay: request a compact block via
getdata(MSG_CMPCT_BLOCK) for a block the node announced, and follow up
with a getblocktxn for a cmpctblock the node sent us.

Neither flow can be synthesized in a single program (a getblocktxn is only
meaningful after the node itself sends a cmpctblock, which the IR cannot
fabricate). Instead, extend the probe mechanism to record headers/inv and
cmpctblock messages, decode them into BlockAnnouncement/
CompactBlockAnnouncement metadata, and let generators insert the matching
follow-up request right after the instruction that triggered the
announcement on a later mutation pass.

IrScenario now always records getblocktxn/cmpctblock/headers/inv and always
drains connections with recording enabled while probing; any block the node
announces was built by the IR itself on another connection, so there is
nothing to gate behind a separate mode.
@brunoerg

brunoerg commented Jul 2, 2026

Copy link
Copy Markdown
Contributor Author

Thanks, @dergoegge. I've changed it back to be just one scenario with an identical approach of the probing for blocktxn. I will leave it running overnight and generate a coverage report.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants