Fix incorrect-reset bug in tx fuzz target (broken with bucketlistDB)#5292
Open
graydon wants to merge 1 commit into
Open
Fix incorrect-reset bug in tx fuzz target (broken with bucketlistDB)#5292graydon wants to merge 1 commit into
graydon wants to merge 1 commit into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes the tx fuzz target’s ledger-reset behavior after the BucketListDB migration by keeping fuzz iterations scoped to a long-lived, in-memory LedgerTxn (rolling back a nested txn per iteration) rather than relying on SQL reloading of ledger state.
Changes:
- Introduces a persistent setup
LedgerTxn(mSetupLedgerTxn) that serves as an in-memory baseline for all fuzz iterations. - Refactors setup logic into
applySetupLedgerState(...)to apply the deterministic ledger setup to different txn parents. - Adds a Catch2 regression test to ensure a known input runs without triggering internal errors.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/test/fuzz/targets/TxFuzzTarget.h | Adds an out-of-line destructor and stores a long-lived LedgerTxn used as the fuzz baseline. |
| src/test/fuzz/targets/TxFuzzTarget.cpp | Refactors setup into a helper, switches per-run txn parent to mSetupLedgerTxn, and adds a regression test. |
| } | ||
| resetTxInternalState(*mApp); | ||
|
|
||
| mSetupLedgerTxn = std::make_unique<LedgerTxn>(mApp->getLedgerTxnRoot()); |
leighmcculloch
approved these changes
May 26, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The fuzz_tx target was broken a while ago when we moved most LEs to the BucketlistDB: it sets up some state, and commits it (at the ltx level), and then resets the state assuming that the committed state will be reloaded/recovered from SQL. but it won't -- because only offers land in SQL anymore.
This bug was causing fairly early and constant internal errors when running the tx fuzz target, because the ledger state it was seeing was corrupt: offers made by nonexistent accounts mainly. This isn't a bug in the tx subsystem or anything, just in the fuzz target.
There are a few ways to fix this (including making a miniature copy of the BucketlistDB ledger-close / commit path just for the fuzz target) but the simplest is just to not write anything to disk and fuzz against an in-memory ltx: add 1 more level of nested ltx that we keep open in the fuzz target, and roll back to its state on each fuzzed tx. Works fine, actually runs faster, and is totally sufficient for fuzzing the tx subsystem.