Skip to content

add --seedprogram feature - #140

Open
brunoerg wants to merge 1 commit into
oss-garage:masterfrom
brunoerg:2026-05-seed-file
Open

add --seedprogram feature#140
brunoerg wants to merge 1 commit into
oss-garage:masterfrom
brunoerg:2026-05-seed-file

Conversation

@brunoerg

@brunoerg brunoerg commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

This PR implements the --seedprogram feature which allows an IR program to be executed against the target node before the snapshot is taken, so the fuzzer starts from a richer initial state. I've mostly implemented the idea from #131 (comment).

@brunoerg
brunoerg marked this pull request as ready for review June 3, 2026 22:06
@brunoerg
brunoerg force-pushed the 2026-05-seed-file branch from e1fbe4b to 44b1117 Compare June 5, 2026 17:06

@Crypt-iQ Crypt-iQ left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Have not tested yet, plan to run a benchmark. I am not hopeful about the txos here providing a larger mempool even with this patch since there seems to be a fundamental limitation(s) somewhere in how fuzzamoto handles utxos. I expect this patch will do better for growing the block index.

Comment thread fuzzamoto-ir/src/compiler.rs Outdated
Comment thread fuzzamoto-scenarios/bin/ir.rs Outdated
Comment thread fuzzamoto-scenarios/bin/ir.rs
Comment thread fuzzamoto-scenarios/bin/ir.rs
@brunoerg
brunoerg force-pushed the 2026-05-seed-file branch from 44b1117 to 1711c76 Compare June 19, 2026 00:54
@brunoerg
brunoerg force-pushed the 2026-05-seed-file branch from 1711c76 to b19f885 Compare June 19, 2026 00:58

@Crypt-iQ Crypt-iQ left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good, thanks for doing this. I'm currently benchmarking another PR, so I'll be able to run this after that's done next week.


accumulate_context: bool,
accumulated_txos: Vec<IrTxo>,
/// Coinbase outputs paired with the height of the block that created them. Coinbase outputs are

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: I think these comments (here and below) are a bit verbose and probably unnecessary, just my personal preference though

let tip_height = self
.accumulated_headers
.iter()
.map(|header| header.height)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This assumes that the highest header is on the same chain as the block creating the coinbase, which may not always be true. To fix this though, the code would have to track pprev like CBlockIndex* does which could be annoying and probably not worth it just for this feature.

@Crypt-iQ

Crypt-iQ commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

I hit a taproot error in the compiler after generating a huge seed program:

match &mut txo.scripts.requires_signing {
Some(SigningRequest::Taproot {
annex_var: target, ..
}) => {
*target = Some(annex_var);
}
_ => {
return Err(CompilerError::MiscError(
"TaprootTxoUseAnnex requires a taproot script".to_string(),
));
}
}

Pretty sure it's a bug and the same one I've hit before when running on master with compile_in_vm where certain programs with taproot IR operations are invalid. Also I'll note that I had to bump the memory limit in fuzzamoto-cli/src/utils/nyx.rs with huge seed programs.

Was able to test and verify with logging that with a seed file, the bitcoind started with 4 mempool txns.

@Crypt-iQ

Crypt-iQ commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

More thoughts:

When running this, I noticed with large seed programs that fuzzamoto would start with higher coverage (~8%) compared to fresh (~2% after the first iterations) and IIRC smaller corpus growth initially (which may be a good thing if my memory isn't failing me). I didn't seriously benchmark this at all, just some observations. Fuzzamoto runs do tend to have corpus bloat after a while so maybe this could counter that bloat; there's just no way that all 100K+ corpus entries are useful.

It might be useful to have a side program that's not merged that can call the generators in a specific order (or write some slightly modified generators) that always produce valid blocks that build on the tip and always produce mempool transactions based on coinbase UTXOs. Like basically remove all of the randomness and invalidity from the current generators so we can easily get 1000+ mempool transactions to test with.

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