@@ -106,15 +106,10 @@ contract FastBridgeReceiverOnEthereum is SafeBridgeReceiverOnEthereum, IFastBrid
106
106
emit ClaimChallenged (_ticketID, ticket.claim.messageHash, block .timestamp );
107
107
}
108
108
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 {
116
110
Ticket storage ticket = tickets[_ticketID];
117
111
require (ticket.claim.bridger != address (0 ), "Claim does not exist " );
112
+ require (ticket.claim.messageHash == keccak256 (abi.encode (_ticketID, _messageData)), "Invalid hash " );
118
113
require (ticket.claim.claimedAt + challengeDuration < block .timestamp , "Challenge period not over " );
119
114
require (ticket.challenge.challenger == address (0 ), "Claim is challenged " );
120
115
require (ticket.relayed == false , "Message already relayed " );
@@ -124,19 +119,15 @@ contract FastBridgeReceiverOnEthereum is SafeBridgeReceiverOnEthereum, IFastBrid
124
119
require (_relay (_messageData), "Failed to call contract " ); // Checks-Effects-Interaction
125
120
}
126
121
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 {
132
123
require (isSentBySafeBridge (), "Access not allowed: SafeBridgeSender only. " );
133
- require (_verify (_messageHash, _ticketID, _messageData), "Invalid hash " );
134
124
135
125
Ticket storage ticket = tickets[_ticketID];
136
126
require (ticket.relayed == false , "Message already relayed " );
137
127
138
128
// 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) {
140
131
ticket.claim.verified = true ;
141
132
}
142
133
@@ -203,14 +194,6 @@ contract FastBridgeReceiverOnEthereum is SafeBridgeReceiverOnEthereum, IFastBrid
203
194
// * Internal * //
204
195
// ************************ //
205
196
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
-
214
197
function _relay (bytes memory _messageData ) internal returns (bool success ) {
215
198
// Decode the receiver address from the data encoded by the IFastBridgeSender
216
199
(address receiver , bytes memory data ) = abi.decode (_messageData, (address , bytes ));
0 commit comments