Skip to content

fix: seed journal and fills registry in localnet fork#309

Merged
snormore merged 1 commit intomainfrom
snor/fix-validator-debt-fork-test
Mar 24, 2026
Merged

fix: seed journal and fills registry in localnet fork#309
snormore merged 1 commit intomainfrom
snor/fix-validator-debt-fork-test

Conversation

@snormore
Copy link
Copy Markdown
Collaborator

@snormore snormore commented Mar 24, 2026

Summary

The test-doublezero-solana-validator-debt-fork-current CI test has been failing and was also confirmed to fail on main locally.

The test forks mainnet-beta and runs two consecutive initialize-distribution calls (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_amount covers the total SOL debt, and calls DequeueFills on 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

  • 10x the journal's swapped_sol_amount in god mode so there's enough SOL headroom for multiple epoch sweeps
  • Fill the FillsRegistry with 20,000 synthetic fills (using the configured fixed_fill_quantity) so DequeueFills has enough data to cover the debt

Both changes only apply in god mode, so normal fork behavior is unchanged.

Testing

  • Confirmed the test fails on main with the same error
  • Ran test_validator_debt_fork.sh locally with the fix — both initialize-distribution calls succeed
  • Verified test_doublezero_solana_fork.sh (non-god-mode) still passes

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.
@snormore snormore marked this pull request as ready for review March 24, 2026 14:53
@snormore snormore merged commit d10e1aa into main Mar 24, 2026
5 of 6 checks passed
@snormore snormore deleted the snor/fix-validator-debt-fork-test branch March 24, 2026 15:40
karl-dz added a commit that referenced this pull request Mar 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants