@@ -182,9 +182,16 @@ contract WormholeTransceiver is
182
182
TransceiverStructs.TransceiverInstruction memory instruction ,
183
183
bytes memory nttManagerMessage
184
184
) internal override {
185
- TransceiverStructs.TransceiverMessage memory transceiverMessage;
186
- bytes memory encodedTransceiverPayload;
187
- bytes32 wormholeFormattedCaller = toWormholeFormat (caller);
185
+ (
186
+ TransceiverStructs.TransceiverMessage memory transceiverMessage ,
187
+ bytes memory encodedTransceiverPayload
188
+ ) = TransceiverStructs.buildAndEncodeTransceiverMessage (
189
+ WH_TRANSCEIVER_PAYLOAD_PREFIX,
190
+ toWormholeFormat (caller),
191
+ recipientNttManagerAddress,
192
+ nttManagerMessage,
193
+ new bytes (0 )
194
+ );
188
195
189
196
WormholeTransceiverInstruction memory weIns =
190
197
parseWormholeTransceiverInstruction (instruction.payload);
@@ -193,15 +200,6 @@ contract WormholeTransceiver is
193
200
// NOTE: standard relaying supports refunds. The amount to be refunded will be sent
194
201
// to a refundAddress specified by the client on the destination chain.
195
202
196
- (transceiverMessage, encodedTransceiverPayload) = TransceiverStructs
197
- .buildAndEncodeTransceiverMessage (
198
- WH_TRANSCEIVER_PAYLOAD_PREFIX,
199
- wormholeFormattedCaller,
200
- recipientNttManagerAddress,
201
- nttManagerMessage,
202
- new bytes (0 )
203
- );
204
-
205
203
// push onto the stack again to avoid stack too deep error
206
204
bytes32 refundRecipient = refundAddress;
207
205
uint16 destinationChain = recipientChain;
@@ -218,49 +216,18 @@ contract WormholeTransceiver is
218
216
219
217
emit RelayingInfo (uint8 (RelayingType.Standard), refundAddress, deliveryPayment);
220
218
} else if (! weIns.shouldSkipRelayerSend && isSpecialRelayingEnabled (recipientChain)) {
221
- // This transceiver payload is used to signal whether the message should be
222
- // picked up by the special relayer or not:
223
- // - It only affects the off-chain special relayer.
224
- // - It is not used by the target NTT Manager contract.
225
- // Transceiver payload is prefixed with 1 byte representing the version of
226
- // the payload. The rest of the bytes are the -actual- payload data. In payload
227
- // v1, the payload data is a boolean representing whether the message should
228
- // be picked up by the special relayer or not.
229
- bytes memory transceiverPayload = abi.encodePacked (uint8 (1 ), true );
230
- (transceiverMessage, encodedTransceiverPayload) = TransceiverStructs
231
- .buildAndEncodeTransceiverMessage (
232
- WH_TRANSCEIVER_PAYLOAD_PREFIX,
233
- wormholeFormattedCaller,
234
- recipientNttManagerAddress,
235
- nttManagerMessage,
236
- transceiverPayload
237
- );
238
-
239
- // push onto the stack again to avoid stack too deep error
240
- uint256 deliveryFee = deliveryPayment;
241
- uint16 destinationChain = recipientChain;
242
-
243
219
uint256 wormholeFee = wormhole.messageFee ();
244
220
uint64 sequence = wormhole.publishMessage {value: wormholeFee}(
245
221
0 , encodedTransceiverPayload, consistencyLevel
246
222
);
247
- specialRelayer.requestDelivery {value: deliveryFee - wormholeFee}(
248
- getNttManagerToken (), destinationChain , 0 , sequence
223
+ specialRelayer.requestDelivery {value: deliveryPayment - wormholeFee}(
224
+ getNttManagerToken (), recipientChain , 0 , sequence
249
225
);
250
226
251
227
// NOTE: specialized relaying does not currently support refunds. The zero address
252
228
// is used as a placeholder for the refund address until support is added.
253
- emit RelayingInfo (uint8 (RelayingType.Special), bytes32 (0 ), deliveryFee );
229
+ emit RelayingInfo (uint8 (RelayingType.Special), bytes32 (0 ), deliveryPayment );
254
230
} else {
255
- (transceiverMessage, encodedTransceiverPayload) = TransceiverStructs
256
- .buildAndEncodeTransceiverMessage (
257
- WH_TRANSCEIVER_PAYLOAD_PREFIX,
258
- wormholeFormattedCaller,
259
- recipientNttManagerAddress,
260
- nttManagerMessage,
261
- new bytes (0 )
262
- );
263
-
264
231
wormhole.publishMessage {value: deliveryPayment}(
265
232
0 , encodedTransceiverPayload, consistencyLevel
266
233
);
0 commit comments