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(SpokePool): Enforce exclusivity consistently #649

Merged
merged 8 commits into from
Oct 30, 2024
Merged
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions contracts/SpokePool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -885,7 +885,11 @@ abstract contract SpokePool is
) public override nonReentrant unpausedFills {
// Exclusivity deadline is inclusive and is the latest timestamp that the exclusive relayer has sole right
// to fill the relay.
if (relayData.exclusivityDeadline >= getCurrentTime() && relayData.exclusiveRelayer != msg.sender) {
if (
relayData.exclusiveRelayer != msg.sender &&
relayData.exclusivityDeadline >= getCurrentTime() &&
relayData.exclusiveRelayer != address(0)
) {
revert NotExclusiveRelayer();
}
Copy link
Contributor Author

@pxrl pxrl Oct 9, 2024

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.

Copy link
Contributor Author

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.


Expand Down Expand Up @@ -931,7 +935,9 @@ abstract contract SpokePool is
// fast fill within this deadline. Moreover, the depositor should expect to get *fast* filled within
// this deadline, not slow filled. As a simplifying assumption, we will not allow slow fills to be requested
// during this exclusivity period.
if (relayData.exclusivityDeadline >= getCurrentTime()) revert NoSlowFillsInExclusivityWindow();
if (relayData.exclusivityDeadline >= getCurrentTime() && relayData.exclusiveRelayer != address(0)) {
revert NotExclusiveRelayer();
}
if (relayData.fillDeadline < getCurrentTime()) revert ExpiredFillDeadline();

bytes32 relayHash = _getV3RelayHash(relayData);
Expand Down
Loading