Repository navigation
test(market-maker): rebalance after a trade or two, so the test swaps little - #787
Merged
Merged
Conversation
… little `a_market_maker_moves_a_skewed_core_node_toward_balance_and_gains` took 83 s in a passing CI run (13 s locally) and timed out at 120 s on several PRs under CI's load. Most of it was swapping about $20 through d1, hundreds of packets over both hubs, before the 2-point threshold called a rebalance. At half a point it rebalances after a trade or two: on one core, the trade phase falls from 7.5 s to 1.9 s and the test from 15 s to 11 s, with the same claims. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
vorstand-boris-bot
enabled auto-merge
November 4, 2026 17:47
vorstand-edna-bot
approved these changes
Nov 4, 2026
vorstand-edna-bot
left a comment
Collaborator
There was a problem hiding this comment.
Approve: a test-input change only; the test keeps every assertion, and still exercises a trade through d1 followed by a rebalance on the pool.
Blocking
None.
Non-blocking
crates/dassie-cli/tests/market_maker.rs:199: the reworded comment line runs past the file's usual width (rustfmt won't rewrap it); worth reflowing.- For the record:
thresholdPpmis a config input the test already set below the default (20 000 vs 50 000), not a production default, and 5 000 is a valid value (config.rsrefuses only 0 and aboveMAX_THRESHOLD_PPM), so this doesn't tune a production rule to suit the test. At the maker's ~$1000 starting even, oneCAP-sized trade already crosses the 0.5% limit inbeyond_threshold, as the description says. Trading several times before a rebalance is still covered by the two-target test, which runs at the default threshold.
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.
This makes the market maker's slowest daemon test cheaper, so it stops timing out under CI's load.
Why
a_market_maker_moves_a_skewed_core_node_toward_balance_and_gains(from #730) runs in about 13 s locally. In CI it took 83 s on a run that passed (#771's rerun). It hit nextest's 120 s limit on #771's first run, on #779, and onfix/hub-account-state-after-final, all around 17:25–17:35 UTC on 2026-11-04. The two-target test takes 17 s in CI.Timing its phases on one core (
taskset -c 0) showed where the time goes. Most of it was the market maker swapping about $20 through d1 before its 2-point threshold called for a rebalance. That's hundreds of packets over both hubs.Change
The threshold goes from 2 points to half a point (
5_000ppm). The market maker then rebalances on the pool after one or two trades. The test still asserts the same things:On one core, the trade phase falls from 7.5 s to 1.9 s, and the whole test from 15.4 s to 11.0 s. The rest is mostly the harness's
claimedandsettledwaits before and after the restart, which every hub test shares. I left those alone.Both daemon tests pass. Only the test file changes.
🤖 Generated with Claude Code