-
Notifications
You must be signed in to change notification settings - Fork 27
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
Add Rate limiter #114
Add Rate limiter #114
Conversation
This reverts commit 96dec40.
Pull Request Test Coverage Report for Build 2152410060
💛 - Coveralls |
} | ||
|
||
function retryByKappa(bytes32 kappa) external onlyRole(LIMITER_ROLE) { | ||
(bytes memory toRetry, ) = rateLimited.get(kappa); |
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.
Check if kappa already exists before calling bridge. I think assumption that all kappas in the queue were not yet processed is too strong to preserve.
if (!IBridge(BRIDGE_ADDRESS).kappaExists(kappa)) {
(bool success, bytes memory returnData) = BRIDGE_ADDRESS.call(toRetry);
require(
success,
Strings.append("could not call bridge:", _getRevertMsg(returnData))
);
}
rateLimited.remove(kappa);
); | ||
|
||
for (uint8 i = 0; i < attempts; i++) { | ||
(bytes32 kappa, bytes memory toRetry, ) = rateLimited.at(i); |
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.
See comment above:
https://github.com/synapsecns/synapse-contracts/pull/114/files#r849141913
Also, some generalization on retrying the kappas is required.
) | ||
); | ||
|
||
rateLimited.remove(kappa); |
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.
Doing map.remove()
in the same for loop as map.at()
will break things. Either do two separate loops for iteration and deletion. Or even better, change Map
to queue and use peek
and poll
to get the first element and then delete it.
Moving to #116 to follow our git flow |
Description
Fixes # (issue)
Checklist