Skip to content

Commit

Permalink
Add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pxrl committed Oct 11, 2024
1 parent c24c723 commit 6b5f5f9
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion contracts/SpokePool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ abstract contract SpokePool is
/**
* @notice Pauses deposit-related functions. This is intended to be used if this contract is deprecated or when
* something goes awry.
* @dev Affects `deposit()` but not `speedUpDeposit()`, so that existing deposits can be sped up and still
* @dev Affects `deposit()` but not `speedUpV3Deposit()`, so that existing deposits can be sped up and still
* relayed.
* @param pause true if the call is meant to pause the system, false if the call is meant to unpause it.
*/
Expand Down
17 changes: 17 additions & 0 deletions test/evm/hardhat/SpokePool.Relay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,23 @@ describe("SpokePool Relayer Logic", async function () {
updatedMessage
);
});
it("in absence of exclusivity", async function () {
// Clock drift between spokes can mean exclusivityDeadline is in future even when no exclusivity was applied.
await spokePool.setCurrentTime(relayData.exclusivityDeadline - 1);
await expect(
spokePool.connect(relayer).fillV3RelayWithUpdatedDeposit(
{
...relayData,
exclusiveRelayer: consts.zeroAddress,
},
consts.repaymentChainId,
updatedOutputAmount,
updatedRecipient,
updatedMessage,
signature
)
).to.emit(spokePool, "FilledV3Relay");
});
it("must be exclusive relayer before exclusivity deadline", async function () {
const _relayData = {
...relayData,
Expand Down
7 changes: 7 additions & 0 deletions test/evm/hardhat/SpokePool.SlowRelay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,13 @@ describe("SpokePool Slow Relay Logic", async function () {
relayData.fillDeadline = (await spokePool.getCurrentTime()).sub(1);
await expect(spokePool.connect(relayer).requestV3SlowFill(relayData)).to.be.revertedWith("ExpiredFillDeadline");
});
it("in absence of exclusivity", async function () {
// Clock drift between spokes can mean exclusivityDeadline is in future even when no exclusivity was applied.
await spokePool.setCurrentTime(relayData.exclusivityDeadline - 1);
await expect(
spokePool.connect(relayer).requestV3SlowFill({ ...relayData, exclusiveRelayer: consts.zeroAddress })
).to.emit(spokePool, "RequestedV3SlowFill");
});
it("during exclusivity deadline", async function () {
await spokePool.setCurrentTime(relayData.exclusivityDeadline);
await expect(spokePool.connect(relayer).requestV3SlowFill(relayData)).to.be.revertedWith(
Expand Down

0 comments on commit 6b5f5f9

Please sign in to comment.