Skip to content

Commit e2e660e

Browse files
Clean up contract comment
1 parent cf5fab6 commit e2e660e

1 file changed

Lines changed: 12 additions & 14 deletions

File tree

src/protocol/taiko_alethia/MessageRelayer.sol

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -36,19 +36,18 @@ import {IMessageRelayer} from "src/protocol/IMessageRelayer.sol";
3636
/// )
3737
///
3838
/// To relay the message:
39-
// 1. Anyone is allowed to call relayMessage however the tip recipient is determined the two following cases:
40-
// a) If no tip recipient is specified in the ETHDeposit message the one in temporary storage will be used
41-
// b) If a tip recipient is specified in the ETHDeposit message it will be used
42-
// It is up to the relayer to decide whether it is worth to relay this message or not (decided if they control the
43-
// tipRecipient address or not)
44-
/// 2. This will call claimDeposit on the ETHBridge
45-
/// 3. If the original message was specified correctly, this will call receiveMessage on this contract
46-
/// 4. This will call the message recipient and send the tip to the tip recipient
39+
/// 1. Trigger the relay:
40+
/// a) If the tip recipient is specified in the ETHDeposit, the relayer can call `ETHBridge.claimDeposit` directly.
41+
/// b) Otherwise, anyone can pass a tip recipient to `relayMessage`, which will then call `ETHBridge.claimDeposit`.
42+
/// Note that the provided recipient will be ignored if it already specified.
43+
/// Relayers should ensure the tip they receive is sufficient compensation for the gas spent on this call.
44+
/// 2. If the original message was specified correctly, `claimDeposit` will invoke `receiveMessage` on this contract.
45+
/// 3. This will call the message recipient and send the tip to the tip recipient.
4746
///
48-
/// The tip recipient will net any tip minus the gas spent on the call to relayMessage.
49-
///
50-
/// WARN: There is no relayer protection. In particular:
51-
/// - if the ETHDeposit does not invoke receiveMessage, the tip recipient will not be paid.
47+
/// WARN: There is no relayer protection. In particular
48+
/// - if the ETHDeposit does not invoke `receiveMessage`, the tip recipient will not be paid.
49+
/// - if a relayer calls `claimDeposit` directly (case 1a above) but no recipient is specified, the tip will be sent
50+
/// to whichever address happens to be stored in the `TIP_RECIPIENT_SLOT` (including address(0)).
5251
contract MessageRelayer is ReentrancyGuardTransient, IMessageRelayer {
5352
using TransientSlot for *;
5453

@@ -64,8 +63,7 @@ contract MessageRelayer is ReentrancyGuardTransient, IMessageRelayer {
6463
uint256 private constant BUFFER = 20_000;
6564

6665
/// @inheritdoc IMessageRelayer
67-
/// @dev Only specify a tip recipient if one is not set in the ETHDeposit data field otherwise
68-
/// that one will be used instead
66+
/// @dev `ETHBridge.claimDeposit` should be called instead if the tip recipient is specified in the `ethDeposit`.
6967
function relayMessage(
7068
IETHBridge.ETHDeposit memory ethDeposit,
7169
uint256 height,

0 commit comments

Comments
 (0)