@@ -25,6 +25,7 @@ contract FastBridgeSenderToEthereum is SafeBridgeSenderToEthereum, IFastBridgeSe
2525
2626 struct Ticket {
2727 bytes32 messageHash;
28+ uint256 blockNumber;
2829 bool sentSafe;
2930 }
3031
@@ -46,7 +47,13 @@ contract FastBridgeSenderToEthereum is SafeBridgeSenderToEthereum, IFastBridgeSe
4647 * The bridgers need to watch for these events and
4748 * relay the messageHash on the FastBridgeReceiverOnEthereum.
4849 */
49- event OutgoingMessage (uint256 indexed ticketID , address indexed target , bytes32 indexed messageHash , bytes message );
50+ event OutgoingMessage (
51+ uint256 indexed ticketID ,
52+ uint256 blockNumber ,
53+ address target ,
54+ bytes32 indexed messageHash ,
55+ bytes message
56+ );
5057
5158 // ************************************* //
5259 // * Function Modifiers * //
@@ -80,9 +87,9 @@ contract FastBridgeSenderToEthereum is SafeBridgeSenderToEthereum, IFastBridgeSe
8087 ticketID = currentTicketID++ ;
8188
8289 (bytes32 messageHash , bytes memory messageData ) = _encode (ticketID, _receiver, _calldata);
83- emit OutgoingMessage (ticketID, _receiver, messageHash, messageData);
90+ emit OutgoingMessage (ticketID, block . number , _receiver, messageHash, messageData);
8491
85- tickets[ticketID] = Ticket ({messageHash: messageHash, sentSafe: false });
92+ tickets[ticketID] = Ticket ({messageHash: messageHash, blockNumber: block . number , sentSafe: false });
8693 }
8794
8895 /**
@@ -94,6 +101,8 @@ contract FastBridgeSenderToEthereum is SafeBridgeSenderToEthereum, IFastBridgeSe
94101 * It may require some ETH (or whichever native token) to pay for the bridging cost,
95102 * depending on the underlying safe bridge.
96103 *
104+ * TODO: check if keeping _calldata in storage in sendFast() is cheaper than passing it again as a parameter here
105+ *
97106 * @param _ticketID The ticketID as provided by `sendFast()` if any.
98107 * @param _receiver The L1 contract address who will receive the calldata
99108 * @param _calldata The receiving domain encoded message data.
@@ -112,7 +121,12 @@ contract FastBridgeSenderToEthereum is SafeBridgeSenderToEthereum, IFastBridgeSe
112121
113122 // Safe Bridge message envelope
114123 bytes4 methodSelector = IFastBridgeReceiver.verifyAndRelaySafe.selector ;
115- bytes memory safeMessageData = abi.encodeWithSelector (methodSelector, _ticketID, messageData);
124+ bytes memory safeMessageData = abi.encodeWithSelector (
125+ methodSelector,
126+ _ticketID,
127+ ticket.blockNumber,
128+ messageData
129+ );
116130
117131 // TODO: how much ETH should be provided for bridging? add an ISafeBridgeSender.bridgingCost() if needed
118132 _sendSafe (address (fastBridgeReceiver), safeMessageData);
@@ -135,11 +149,11 @@ contract FastBridgeSenderToEthereum is SafeBridgeSenderToEthereum, IFastBridgeSe
135149 uint256 _ticketID ,
136150 address _receiver ,
137151 bytes memory _calldata
138- ) internal pure returns (bytes32 messageHash , bytes memory messageData ) {
152+ ) internal view returns (bytes32 messageHash , bytes memory messageData ) {
139153 // Encode the receiver address with the function signature + arguments i.e calldata
140154 messageData = abi.encode (_receiver, _calldata);
141155
142- // Compute the hash over the message header (ticketID) and body (data).
143- messageHash = keccak256 (abi.encode (_ticketID, messageData));
156+ // Compute the hash over the message header (ticketID, blockNumber ) and body (data).
157+ messageHash = keccak256 (abi.encode (_ticketID, block . number , messageData));
144158 }
145159}
0 commit comments