ir: add BIP152 getblocktxn/getdata(cmpctblock) generators + probe feedback loop#150
ir: add BIP152 getblocktxn/getdata(cmpctblock) generators + probe feedback loop#150brunoerg wants to merge 1 commit into
Conversation
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 |
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.
|
Thanks, @dergoegge. I've changed it back to be just one scenario with an identical approach of the probing for |
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).