AI-generated analysisPublished automatically and not human-verified. Validated context appears in community notes below.
← Watch feed
Informational 20 Bitcoin

Merge bitcoin/bitcoin#36998: fuzz: DisableNextWrite in mempool targets

Public commit record

What the developer wrote

Authored by merge-script

100/100 · Strong
Merge bitcoin/bitcoin#36998: fuzz: DisableNextWrite in mempool targets

2d8410dd633aadd9bb2d8ca4476fd1543317b766 fuzz: DisableNextWrite in mempool targets (Erick Cestari)

Pull request description:

`AcceptToMemoryPool` and `ProcessNewPackage` end with `FlushStateToDisk(PERIODIC)`. Whether that flush writes depends on `m_next_write`, which lives in the static chainstate and is re-armed after each write. So the following targets leak the next write time from one input to the next:
- `tx_pool`
- `tx_pool_standard`
- `tx_package_eval`
- `ephemeral_package_eval`
- `validation_load_mempool`

Whether an input hits the write path (leveldb, block index, coins sync) then depends on the inputs that ran before it.
This matters because the fuzzer can then save an input for coverage that the input does not reproduce on its own, and a crash in that path may not reproduce from the single input that triggered it.

Fix it the same way `process_message(s)` and `cmpctblock` already do (#32822): call `DisableNextWrite()` at the start of each input.

Measured with `contrib/devtools/deterministic-fuzz-coverage --mode=combined` on qa-assets, comparing hits of the periodic-write branch (`validation.cpp:2839`, `nNow >= m_next_write`) between two shuffled replays:

| target | before (run A / run B) | after |
|--------|------------------------|-------|
| validation_load_mempool | 4 / 8 | 0 / 0 |
| tx_pool_standard | 9 / 5 | 0 / 0 |
| tx_pool | 4 / 17 | 0 / 0 |
| tx_package_eval | 6 / 7 | 0 / 0 |
| ephemeral_package_eval | 7 / 4 | 0 / 0 |

`validation_load_mempool` now passes the combined check. The other four still show unrelated nondeterminism, which this PR does not address:
- the script execution/signature cache shared across inputs;
- the `CoinsTip` cache state, which changes the number of `CCoinsViewDB` reads.

The input format is unchanged, so the qa-assets corpora stay valid.

ACKs for top commit:
maflcko:
lgtm ACK 2d8410dd633aadd9bb2d8ca4476fd1543317b766
Crypt-iQ:
crACK 2d8410dd633aadd9bb2d8ca4476fd1543317b766
brunoerg:
ACK 2d8410dd633aadd9bb2d8ca4476fd1543317b766 - built and verified it.

Tree-SHA512: 1fef3825912155da04e9ee1a53b44c008718f7bddfe024a9f727a724d1d4f4fa338017679ccd0296f114393b69ca8a2e5211ff584312494051e1d6f8dbc6548b
✓ Specific, descriptive subject✓ Names a concrete action or component✓ Provides detailed explanatory context✓ Explains rationale or failure mode✓ Mentions testing or verification✓ Links an issue, advisory, or supporting reference✓ Names security-relevant behavior explicitly
The short version

What changed, and why it matters

This change only affects Bitcoin Core's internal fuzz testing programs. It makes fuzz test runs more reproducible by preventing hidden leftover state from one test input from influencing the next. It does not change normal node behavior, consensus rules, or network code, so it is not a security vulnerability in the live Bitcoin software.

Recommended action

No action needed for production deployments. This is a quality-of-life improvement for fuzzing infrastructure; ensure CI fuzz builds include it so coverage and crash reproduction remain reliable.

Security signals we found

01

test-only fuzz harness change

02

determinism/reproducibility fix, not a runtime bug fix

03

no change to consensus, networking, wallet, or mempool acceptance logic

04

no input validation or boundary changes

Risk score

Why this scored 20/100

Our methodology →
Potential impact 2/30
Exploitability 0/25
Stealth signal 2/15
Affected reach 2/15
Confidence 9/10
Evidence quality 5/5
Human-validated context

Community notes

Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.

No validated notes yet.

The AI analysis stands alone for now. Submit a note if you can add evidence or important context.