Skip to content

Commit

Permalink
update comment of l2 withdraw message
Browse files Browse the repository at this point in the history
  • Loading branch information
zkbenny committed Mar 5, 2024
1 parent 76716df commit 66ad9d4
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions contracts/ZkLink.sol
Original file line number Diff line number Diff line change
Expand Up @@ -542,10 +542,9 @@ contract ZkLink is
// It should be equal to the length of the bytes4 function signature + address l1Receiver + uint256 amount = 4 + 20 + 32 = 56 (bytes).
// 2. The message that is sent by `withdrawWithMessage(address _l1Receiver, bytes calldata _additionalData)`
// It should be equal to the length of the following:
// bytes4 function signature + address l1Receiver + uint256 amount + address l2Sender + bytes _additionalData =
// = 4 + 20 + 32 + 32 + _additionalData.length >= 68 (bytes).

// So the data is expected to be at least 56 bytes long.
// bytes4 function signature + address l1Gateway + uint256 amount + address l2Sender + bytes _additionalData
// (where the _additionalData = abi.encode(l1Receiver))
// = 4 + 20 + 32 + 20 + 32 == 108 (bytes).
require(_message.length == 108, "pm");

(uint32 functionSignature, uint256 offset) = UnsafeBytes.readUint32(_message, 0);
Expand Down

0 comments on commit 66ad9d4

Please sign in to comment.