fix(log): clamp the unfiltered pending legs to match the filtered ones (#4310) - #4338
Merged
Merged
Conversation
#4310) The filtered pending legs (fromKraken/toKraken/fromScrypt/toScrypt) are each clamped to 0 when negative, but their unfiltered counterparts were not. When useUnfilteredTx is true, an unclamped negative unfiltered leg (observed: asset 405 approx -5.0M) drove totalPlusPending negative and fired the 'totalPlusPending < 0' verbose log every minute. Clamp the four unfiltered legs symmetrically, placed after the filtered/unfiltered discrepancy comparisons so those still compare raw values. The root cause of a persistently-negative unfiltered leg is a separate follow-up.
…eredTx path (#4310) pr-ready review: the four new unfiltered-leg <0 verbose logs now include their constituent pending-amount breakdown (matching the filtered siblings), which the separate follow-up into the persistently-negative unfiltered leg will need; and add a test exercising the useUnfilteredTx=true clamp path (previously entirely untested).
ℹ️ New TODOs/FIXMEs (1)+ address: yapealCHF.bic.padEnd(11, 'XXX'), |
…regate clamp (#4310) pr-ready round 2: the negative-leg clamp test was vacuous — the downstream aggregate totalPlusPending<0 clamp floors the same scenario, so reverting the per-leg clamp still left it green. Assert (via the verbose log) that the per-leg 'toKrakenUnfiltered balance < 0' path fires and the aggregate 'totalPlusPending < 0' path does NOT, so the test now fails if the per-leg clamp is removed.
Collaborator
Author
|
Review complete: 3 review passes to reach 0 defects (conformance-vs-CONTRIBUTING and logic/context lenses, run in parallel with CI).
|
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.
Finding J of #4310 (separate, minor). The filtered pending legs are each individually clamped to 0 when negative; their unfiltered counterparts (
fromKrakenUnfiltered/toKrakenUnfiltered/fromScryptUnfiltered/toScryptUnfiltered) were not. WhenuseUnfilteredTxis true, an unclamped negative unfiltered leg (observed: asset 405 ≈ −5.0M) drivestotalPlusPendingnegative and fires thetotalPlusPending < 0verbose log every minute. This adds the four symmetric clamps (placed after the!==filtered-vs-unfiltered discrepancy comparisons, so those still compare raw values).format:check/lint/type-checkclean, jest 67/67.The root cause of a persistently-negative unfiltered leg (asset 405) is a documented separate follow-up, out of scope here. Addresses #4310 (finding J).