fix: seed journal and fills registry in localnet fork#309
Merged
Conversation
The validator debt fork test was failing because the mainnet-beta fork's journal swapped SOL balance and fills registry were insufficient to cover sweeps across multiple epochs. In god mode, set the journal's swapped_sol_amount to u64::MAX and fill the fills registry with synthetic fills so that sweeps succeed regardless of mainnet state.
bgm-malbeclabs
approved these changes
Mar 24, 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.
Summary
The
test-doublezero-solana-validator-debt-fork-currentCI test has been failing and was also confirmed to fail on main locally.The test forks mainnet-beta and runs two consecutive
initialize-distributioncalls (separated by a 60s sleep to advance the epoch in god mode). The first initializes a distribution and sweeps tokens for the rewards epoch, and the second does the same for the next epoch — this time with debt write-offs enabled.The sweep instruction checks that the journal's
swapped_sol_amountcovers the total SOL debt, and callsDequeueFillson the SOL conversion program to dequeue fills matching that debt. Both the journal's swapped SOL balance and the fills registry are finite mainnet state that gets consumed by each sweep. As mainnet's per-epoch debt has grown over time, the forked state no longer has enough of either to cover two consecutive sweeps.Changes
swapped_sol_amountin god mode so there's enough SOL headroom for multiple epoch sweepsFillsRegistrywith 20,000 synthetic fills (using the configuredfixed_fill_quantity) soDequeueFillshas enough data to cover the debtBoth changes only apply in god mode, so normal fork behavior is unchanged.
Testing
test_validator_debt_fork.shlocally with the fix — bothinitialize-distributioncalls succeedtest_doublezero_solana_fork.sh(non-god-mode) still passes