-
Notifications
You must be signed in to change notification settings - Fork 14
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
feat: added rate limiting to Escrow #274
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #274 +/- ##
=======================================
Coverage 99.83% 99.84%
=======================================
Files 13 14 +1
Lines 621 650 +29
=======================================
+ Hits 620 649 +29
Misses 1 1 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some naming comments and one change to avoid state changes when rate limit is zero.
But we also need a better story around upgrading, so we wait to merge this until we have solved that.
/// @notice Checks the rate limit for a token and updates the daily usage | ||
/// @param token The token address | ||
/// @param amount The amount to check against the rate limit | ||
function _checkRateLimit(address token, uint256 amount) internal { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This needs a better name, because it is not clear from the name that it also updates the daily usage. The check implies that it just checks it. Either something a bit more verbose like verifyAndUpdateDailyRate
or if we want something shorter maybe applyRateLimit
.
if (rateLimit != 0) { | ||
require(usage <= rateLimit, RateLimitExceeded(rateLimit, usage)); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (rateLimit != 0) { | |
require(usage <= rateLimit, RateLimitExceeded(rateLimit, usage)); | |
} | |
if (rateLimit == 0) { | |
return | |
} | |
require(usage <= rateLimit, RateLimitExceeded(rateLimit, usage)); |
Description
closes: #271
Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.
godoc
comments.Files changed
in the GitHub PR explorer.SonarCloud Report
in the comment section below once CI passes.