-
Notifications
You must be signed in to change notification settings - Fork 0
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
Relayer Will Not Receive Any Fee If execute
Reverts
#220
Comments
It's quite possible that the slippage changes while the relayer's tx is in the mempool - which I think is the valid concern here. A relayer can't know for a fact that another existing tx won't change the current slippage (assuming there are multiple approved relayers).
Worth noting that the mitigation step here ^ is tricky -- it can incentivize relayers to submit transactions that fail quickly to maximize profit. For example, if we pay relayers even in the event of failure when slippage is too high, they are incentivized to submit txs when the slippage is too high (because they will fail more cheaply, as opposed to fully executing). Relayers could potentially profit by pushing the slippage over a large user transfer's limit via the stableswap themselves. I'm uncertain of whether I should acknowledge or dispute this issue because, while it is valid that relayers will lose funds in the case that the slippage changes while their tx is in the mempool, this may just be considered a core design property and a risk that relayers must factor into their executions. (Leaving as acknowledged for now.) |
While not paying out for every relayed transaction (i.e. forcing relayers to incur/budget for some loss if the transaction fails) is a valid concern, and makes the system less appealing to relay for, I think it is the nature of relay networks to deal with these kinds of problems. For example, even without the slippage, imagine there are two networks competing to relay for the same transaction. In this case, execution would fail for the second relayer, and there would be no fees remaining to pay them for their efforts. If you want to continue adding fees for the same transaction, you would be passing this failure cost onto the user (with a more stringent liveness condition). This is a valid issue, but the fixes would introduce more complexity and edge cases than make sense to handle at this level. |
I'd say this is part of the risk of being a relayer but definitely worth noting so keeping it as is. |
Lines of code
https://github.com/code-423n4/2022-06-connext/blob/4dd6149748b635f95460d4c3924c7e3fb6716967/contracts/contracts/core/connext/facets/BridgeFacet.sol#L415
Vulnerability details
Proof-of-Concept
Connext relies on the relayer to trigger the
BridgeFacet.execute
function on the destination domain to initiate the token transfer and calldata execution processes. Relayers pay for the gas cost to trigger theexecute
function, and in return for their effort, they are reimbused with the relayer fee.However, it is possible that the
BridgeFacet.execute
function will revert under certain circumstances when triggered by the relayers. For instance, when theBridgeFacet.execute
function is triggered, it will call theBridgeFacet._handleExecuteLiquidity
function. Within theBridgeFacet._handleExecuteLiquidity
function, it will attempt to perform token swap using a StablePool. If the slippage during the swap exceeded the user-defined value, the swap will revert and subseqently theexecute
will revert too.When the
BridgeFacet.execute
reverts, the relayers will not receive any relayer fee.The following code shows that the relayer who can claim the relayer fee is set within the
BridgeFacet.execute
function at Line 415. Therefore, if this function reverts, relayer will not be able to claim the fee.https://github.com/code-423n4/2022-06-connext/blob/4dd6149748b635f95460d4c3924c7e3fb6716967/contracts/contracts/core/connext/facets/BridgeFacet.sol#L415
Impact
Lost of fund for the relayers as they pay for the gas cost to trigger the functions, but did not receive any relayer fee in return.
Recommended Mitigation Steps
Update the implementation of the
BridgeFacet.execute
so that it will fail gracefully and not revert when the swap fails or other functions fails. Relayers should be entitled to relayer fee regardless of the outcome of theBridgeFacet.execute
call for their effort.The text was updated successfully, but these errors were encountered: