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

fixes TRST-M-1 - adds additional padding for precision loss #51

Merged
merged 2 commits into from
May 30, 2024

Conversation

0xean
Copy link
Contributor

@0xean 0xean commented May 29, 2024

Screenshot 2024-05-29 at 1 00 28 PM

While we don't plan to use this for tokens with > 18 decimals or more than 1 billion staked tokens, we can still add some additional padding to make the contract more flexible and future proof.

This adds additional padding to the REWARD_RATE which is the same outcome as suggested by the auditors it also adds additional paranoia in testing by increasing the supply of test fox tokens and the number of years we check for overflow on.

note: this doesn't divide by the increase as suggested by Trust in the audit - but I don't think that is required based on the expected use case here and the checks for overflow.

@gomesalexandre gomesalexandre self-requested a review May 29, 2024 17:31
Copy link
Contributor

@gomesalexandre gomesalexandre left a comment

Choose a reason for hiding this comment

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

Potential precision loss has been addressed with reward rate padding, ensuring numerator/denominator ratio stays v. large, and updated testing cases with tests still passing confirm this.
Get in!

* fix: emit events on pause changes TRST-R-1

* Fix/coding best practices trst r 3 (#53)

* fix: add reentrancy init

* rename internal function

* fix: checks for state prior to changing state

* Fix/cei trst r 5 (#54)

* fix TRST-R-5 to follow CEI pattern

* lint

* use modifiers where we can
@0xean 0xean merged commit bd94f64 into main May 30, 2024
1 check passed
@0xean 0xean deleted the fix/precision-loss branch May 30, 2024 17:10
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