Repository navigation
test(execution): Allow for the server-time read's own delay in the Binance balance-stamp tests - #814
Merged
Merged
Conversation
…nance balance-stamp tests The tests that check a balance read is stamped on Binance's clock bounded the stamp from below by one millisecond, for the server time's truncation. The estimate also dates that server time to the moment its answer is received, so any delay before then puts the stamp further behind; under load it exceeded the millisecond. A shared test constant now allows 1 ms plus 50 ms, explained where it is defined. The upper bound, which shows the stamp is not on this host's leading clock, is unchanged. Closes #811
…cond, and correct the allowance's rustdoc - The margin balance-stamp test widens its lower bound only for a request signed on a server time read; on this host's clock it keeps the 1 ms bound it had. - TRAILING_HOST_BEHIND's rustdoc names the delay as task scheduling and polling (not the read's timeout, which adds none), and mentions the clock's drift allowance.
…e to the earlier code
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.
Closes #811.
What
Three tests check that a Binance balance read is stamped on Binance's clock when this host's clock leads it by 60 s:
spot::tests::a_balance_read_is_stamped_on_binances_clock_when_the_host_clock_leadsmargin::tests::a_cross_balance_read_is_stamped_on_binances_clock_when_the_host_clock_leadsmargin::tests::an_isolated_balance_read_is_stamped_on_binances_clock_when_the_host_clock_leadsTheir lower bound allowed only the 1 ms truncation of the server time. The estimate dates that server time to when its answer is received, so the delay between the read and that moment also puts the stamp behind. Under load it went about 5 µs past the bound and failed once.
Change
ServerTime::TRAILING_HOST_BEHIND(test-only, next totrailing_host): 1 ms + 50 ms, with the reasons in its rustdoc.Test-only; the stamping code and the CHANGELOG are untouched.
Checks
cargo test -p rustrade-execution --all-features --lib --tests: 1903 passed, 0 failed.