Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 3 additions & 1 deletion contracts/SpokePool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -1213,7 +1213,9 @@ abstract contract SpokePool is
// net movement of funds.
// Note: this is important because it means that relayers can intentionally self-relay in a capital efficient
// way (no need to have funds on the destination).
if (msg.sender == relayExecution.updatedRecipient) return fillAmountPreFees;
// If this is a slow fill, we can't exit early since we still need to send funds out of this contract
// since there is no "relayer".
if (msg.sender == relayExecution.updatedRecipient && !relayExecution.slowFill) return fillAmountPreFees;

// If relay token is wrappedNativeToken then unwrap and send native token.
if (relayData.destinationToken == address(wrappedNativeToken)) {
Expand Down
26 changes: 26 additions & 0 deletions test/SpokePool.SlowRelay.ts
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,32 @@ describe("SpokePool Slow Relay Logic", async function () {
[fullRelayAmountPostFees.mul(10).mul(-1), fullRelayAmountPostFees.mul(10)]
);
});
it("Recipient should be able to execute their own slow relay", async function () {
await expect(() =>
spokePool
.connect(recipient)
.executeSlowRelayLeaf(
...getExecuteSlowRelayParams(
depositor.address,
recipient.address,
destErc20.address,
consts.amountToRelay,
consts.originChainId,
consts.realizedLpFeePct,
consts.depositRelayerFeePct,
consts.firstDepositId,
0,
erc20Message,
ethers.utils.parseEther("9"),
tree.getHexProof(slowFills.find((slowFill) => slowFill.relayData.destinationToken === destErc20.address)!)
)
)
).to.changeTokenBalances(
destErc20,
[spokePool, recipient],
[fullRelayAmountPostFees.mul(10).mul(-1), fullRelayAmountPostFees.mul(10)]
);
});

it("Simple SlowRelay ERC20 FilledRelay event", async function () {
slowFills.find((slowFill) => slowFill.relayData.destinationToken === destErc20.address)!;
Expand Down