@@ -106,15 +106,10 @@ contract FastBridgeReceiverOnEthereum is SafeBridgeReceiverOnEthereum, IFastBrid
106106 emit ClaimChallenged (_ticketID, ticket.claim.messageHash, block .timestamp );
107107 }
108108
109- function verifyAndRelay (
110- uint256 _ticketID ,
111- bytes32 _messageHash ,
112- bytes memory _messageData
113- ) external override {
114- require (_verify (_messageHash, _ticketID, _messageData), "Invalid hash " );
115-
109+ function verifyAndRelay (uint256 _ticketID , bytes memory _messageData ) external override {
116110 Ticket storage ticket = tickets[_ticketID];
117111 require (ticket.claim.bridger != address (0 ), "Claim does not exist " );
112+ require (ticket.claim.messageHash == keccak256 (abi.encode (_ticketID, _messageData)), "Invalid hash " );
118113 require (ticket.claim.claimedAt + challengeDuration < block .timestamp , "Challenge period not over " );
119114 require (ticket.challenge.challenger == address (0 ), "Claim is challenged " );
120115 require (ticket.relayed == false , "Message already relayed " );
@@ -124,19 +119,15 @@ contract FastBridgeReceiverOnEthereum is SafeBridgeReceiverOnEthereum, IFastBrid
124119 require (_relay (_messageData), "Failed to call contract " ); // Checks-Effects-Interaction
125120 }
126121
127- function verifyAndRelaySafe (
128- uint256 _ticketID ,
129- bytes32 _messageHash ,
130- bytes memory _messageData
131- ) external override {
122+ function verifyAndRelaySafe (uint256 _ticketID , bytes memory _messageData ) external override {
132123 require (isSentBySafeBridge (), "Access not allowed: SafeBridgeSender only. " );
133- require (_verify (_messageHash, _ticketID, _messageData), "Invalid hash " );
134124
135125 Ticket storage ticket = tickets[_ticketID];
136126 require (ticket.relayed == false , "Message already relayed " );
137127
138128 // Claim assessment if any
139- if (ticket.claim.bridger != address (0 ) && ticket.claim.messageHash == _messageHash) {
129+ bytes32 messageHash = keccak256 (abi.encode (_ticketID, _messageData));
130+ if (ticket.claim.bridger != address (0 ) && ticket.claim.messageHash == messageHash) {
140131 ticket.claim.verified = true ;
141132 }
142133
@@ -203,14 +194,6 @@ contract FastBridgeReceiverOnEthereum is SafeBridgeReceiverOnEthereum, IFastBrid
203194 // * Internal * //
204195 // ************************ //
205196
206- function _verify (
207- bytes32 _expectedHash ,
208- uint256 _ticketID ,
209- bytes memory _messageData
210- ) internal pure returns (bool ) {
211- return _expectedHash == keccak256 (abi.encode (_ticketID, _messageData));
212- }
213-
214197 function _relay (bytes memory _messageData ) internal returns (bool success ) {
215198 // Decode the receiver address from the data encoded by the IFastBridgeSender
216199 (address receiver , bytes memory data ) = abi.decode (_messageData, (address , bytes ));
0 commit comments