You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The relayer may (maliciously or by accident) complete a transfer on the target chain (L1) twice. This needs to be prevented, as it constitutes a double spend.
Transfers are identified on the source chain (L2) by L2L1bridgeTransferId. The native bridge contract on the target chain (L1) MUST keep a list L2L1bridgeTransferIds in the solidity contract and the contract MUST check if the requested completion of a transfer by the relayer has been already previously completed.
Recommendations
DO NOT use bridgeTransferId. It should be crystal clear from the code that this is an L2-->L1 transfer.
The text was updated successfully, but these errors were encountered:
// Ensure the nonce is valid
require(nonce > 0, InvalidNonce());
// Ensure the incoming bridge transfer ID has not already been completed
require(idsToIncomingNonces[bridgeTransferId] == 0, CompletedBridgeTransferId());
// Ensure the bridge transfer ID is valid against the initiator, recipient, amount, and nonce
require(
bridgeTransferId == keccak256(abi.encodePacked(initiator, recipient, amount, nonce)),
InvalidBridgeTransferId()
);
// Store the incoming nonce to incoming bridge transfer ID
idsToIncomingNonces[bridgeTransferId] = nonce;
```
does this suffices?
Problem
This considers a transfer from L2 --> L1.
The relayer may (maliciously or by accident) complete a transfer on the target chain (L1) twice. This needs to be prevented, as it constitutes a double spend.
Background
MIP-58: Trusted-Relayer focused Bridge Design
Solution
Transfers are identified on the source chain (L2) by
L2L1bridgeTransferId
. The native bridge contract on the target chain (L1) MUST keep a listL2L1bridgeTransferIds
in the solidity contract and the contract MUST check if the requested completion of a transfer by the relayer has been already previously completed.Recommendations
DO NOT use
bridgeTransferId
. It should be crystal clear from the code that this is an L2-->L1 transfer.The text was updated successfully, but these errors were encountered: