-
Notifications
You must be signed in to change notification settings - Fork 55
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(SpokePool): Enforce exclusivity consistently #649
Conversation
The new relative exclusivity check has not been propagated to fillV3RelayWithUpdatedDeposit(). Identified via test case failures in the relayer. Signed-off-by: Paul <[email protected]>
contracts/SpokePool.sol
Outdated
if ( | ||
relayData.exclusiveRelayer != msg.sender && | ||
relayData.exclusivityDeadline >= getCurrentTime() && | ||
relayData.exclusiveRelayer != address(0) | ||
) { | ||
revert NotExclusiveRelayer(); | ||
} |
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.
We now have this check in 2 places. I'm tempted to factor it out to a separate function; it'd be nice to also bundle the requestedV3SlowFill()
check as well but it's slightly less strict.
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.
I factored out the common logic to a _fillIsExclusive()
function. I think this is probably the right call but could be persuaded otherwise.
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.
Dang good catch. I think refactoring to shared internal function could make sense
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.
Can you add unit tests to these functions similar to these so we can prevent regressions? https://github.com/across-protocol/contracts/blob/master/test/evm/hardhat/SpokePool.Relay.ts#L330
@@ -222,7 +222,6 @@ interface V3SpokePoolInterface { | |||
error DisabledRoute(); | |||
error InvalidQuoteTimestamp(); | |||
error InvalidFillDeadline(); | |||
error InvalidExclusiveRelayer(); |
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.
Driveby change - this error is unused. It was dropped with the recent changes to permit relative exclusivity.
Added tests here: 6b5f5f9 |
The new relative exclusivity check has not been propagated to fillV3RelayWithUpdatedDeposit() or requestV3SlowFill(). Identified via test case failures in the relayer.
This is a very-low criticality issue. It's very unlikely that any relayer would be trying to call
fillV3RelayWithUpdatedDeposit()
within the exclusivity window. There's a slightly higher chance of hitting this issue on slow fill requests because the RL relayer is fast enough to hit the probable exclusivity windows on some routes for larger transfers, which is where a token shortfall is more likely.