Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(validateRunningBalances): Change events we track to perform accounting #987

Merged
merged 3 commits into from
Oct 10, 2023

Conversation

nicholaspai
Copy link
Member

Various fixes to script:

  • Tracks correct event on OPStack L2's to account for missing PoolRebalance deposits to the SpokePool. Without this, the excess balance looked too high
  • Make excess check less sensitive and ignore dust
    Signed-off-by: nicholaspai [email protected]

Copy link
Contributor

@james-a-morris james-a-morris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work. I only have nits for this one which may help prevent some error paths if our numbers are anomylously large.

src/scripts/validateRunningBalances.ts Outdated Show resolved Hide resolved
src/scripts/validateRunningBalances.ts Outdated Show resolved Hide resolved
Comment on lines +376 to +377
const excess = Number(excesses[0]);
return excess > 0.05 || excess < -0.05;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may be problematic for the edge case that excesses[0] is too large. It would probably make sense to compare something like:

return excess.abs().gt(fromWei(0.05))

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

excess is not a BN, its already been converted from one above

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, but why are we wrapping the excesses[0] string in Number? We could deal with it as a BN and prevent any overflow issues

@james-a-morris
Copy link
Contributor

james-a-morris commented Oct 10, 2023

Has this been broken for some time, or was this changed in more recent changes?

We may want to run this on a fixed interval and flag it into Slack to catch this earlier.

@nicholaspai nicholaspai merged commit 306d81a into master Oct 10, 2023
2 checks passed
@pxrl pxrl deleted the npai/validate-fix-script branch September 5, 2024 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants