Skip to content

Commit 8426b4c

Browse files
committed
fix: add more docs on the design behind callhook reverts [L-13]
1 parent 9e7686f commit 8426b4c

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

contracts/gateway/L1GraphTokenGateway.sol

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,12 @@ contract L1GraphTokenGateway is GraphTokenGateway, L1ArbitrumMessenger {
172172
* The ticket must be redeemed on L2 to receive tokens at the specified address.
173173
* Note that the caller must previously allow the gateway to spend the specified amount of GRT.
174174
* @dev maxGas and gasPriceBid must be set using Arbitrum's NodeInterface.estimateRetryableTicket method.
175+
* Also note that whitelisted senders (some protocol contracts) can include additional calldata
176+
* for a callhook to be executed on the L2 side when the tokens are received. In this case, the L2 transaction
177+
* can revert if the callhook reverts, potentially locking the tokens on the bridge if the callhook
178+
* never succeeds. This requires extra care when adding contracts to the whitelist, but is necessary to ensure that
179+
* the tickets can be retried in the case of a temporary failure, and to ensure the atomicity of callhooks
180+
* with token transfers.
175181
* @param _l1Token L1 Address of the GRT contract (needed for compatibility with Arbitrum Gateway Router)
176182
* @param _to Recipient address on L2
177183
* @param _amount Amount of tokens to tranfer

contracts/l2/gateway/L2GraphTokenGateway.sol

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,12 @@ contract L2GraphTokenGateway is GraphTokenGateway, L2ArbitrumMessenger {
208208
* @notice Receives token amount from L1 and mints the equivalent tokens to the receiving address
209209
* @dev Only accepts transactions from the L1 GRT Gateway.
210210
* The function is payable for ITokenGateway compatibility, but msg.value must be zero.
211+
* Note that whitelisted senders (some protocol contracts) can include additional calldata
212+
* for a callhook to be executed on the L2 side when the tokens are received. In this case, the L2 transaction
213+
* can revert if the callhook reverts, potentially locking the tokens on the bridge if the callhook
214+
* never succeeds. This requires extra care when adding contracts to the whitelist, but is necessary to ensure that
215+
* the tickets can be retried in the case of a temporary failure, and to ensure the atomicity of callhooks
216+
* with token transfers.
211217
* @param _l1Token L1 Address of GRT
212218
* @param _from Address of the sender on L1
213219
* @param _to Recipient address on L2

0 commit comments

Comments
 (0)