Skip to content

Commit 73593f9

Browse files
committed
fix: set channelIds as destination
1 parent 6de3b28 commit 73593f9

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

src/apps/polymer/vIBCEscrow.sol

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,6 @@ contract IncentivizedPolymerEscrow is APolymerEscrow, IbcReceiverBase, IbcReceiv
118118

119119
//--- IBC Packet Callbacks ---//
120120

121-
// packet.srcPortAddr is the IncentivizedPolymerEscrow address on the source chain.
122-
// packet.destPortAddr is the address of this contract.
123-
// channelId: the channel id from the running chain's perspective, which can be used to identify the counterparty chain.
124121
function onRecvPacket(IbcPacket calldata packet)
125122
external override
126123
onlyIbcDispatcher
@@ -129,12 +126,12 @@ contract IncentivizedPolymerEscrow is APolymerEscrow, IbcReceiverBase, IbcReceiv
129126
uint256 gasLimit = gasleft();
130127
bytes32 feeRecipitent = bytes32(uint256(uint160(tx.origin)));
131128

132-
// Collect the implementation identifier we added. Remember, this is trusted IFF packet.src.channelId is trusted.
129+
// Collect the implementation identifier we added. Remember, this is trusted IFF packet.dest.channelId is trusted.
133130
// sourceImplementationIdentifier has already been defined by the channel on channel creation.
134131
bytes memory sourceImplementationIdentifier = packet.data[POLYMER_SENDER_IDENTIFIER_START:POLYMER_SENDER_IDENTIFIER_END];
135132

136133
bytes memory receiveAck = _handleMessage(
137-
packet.src.channelId,
134+
packet.dest.channelId,
138135
sourceImplementationIdentifier,
139136
packet.data[POLYMER_PACKAGE_PAYLOAD_START: ],
140137
feeRecipitent,
@@ -155,18 +152,18 @@ contract IncentivizedPolymerEscrow is APolymerEscrow, IbcReceiverBase, IbcReceiv
155152
uint256 gasLimit = gasleft();
156153
bytes32 feeRecipitent = bytes32(uint256(uint160(tx.origin)));
157154

158-
// Collect the implementation identifier we added. Remember, this is trusted IFF packet.src.channelId is trusted.
155+
// Collect the implementation identifier we added. Remember, this is trusted IFF packet.dest.channelId is trusted.
159156
bytes memory destinationImplementationIdentifier = ack.data[POLYMER_SENDER_IDENTIFIER_START:POLYMER_SENDER_IDENTIFIER_END];
160157

161158
// Get the payload by removing the implementation identifier.
162159
bytes calldata rawMessage = ack.data[POLYMER_PACKAGE_PAYLOAD_START:];
163160

164161
// Set a verificaiton context so we can recover the ack.
165162
isVerifiedMessageHash[keccak256(rawMessage)] = VerifiedMessageHashContext({
166-
chainIdentifier: packet.src.channelId,
163+
chainIdentifier: packet.dest.channelId,
167164
implementationIdentifier: destinationImplementationIdentifier
168165
});
169-
_handleAck(packet.src.channelId, destinationImplementationIdentifier, rawMessage, feeRecipitent, gasLimit);
166+
_handleAck(packet.dest.channelId, destinationImplementationIdentifier, rawMessage, feeRecipitent, gasLimit);
170167
}
171168

172169
function onTimeoutPacket(IbcPacket calldata packet) external override onlyIbcDispatcher{
@@ -178,7 +175,7 @@ contract IncentivizedPolymerEscrow is APolymerEscrow, IbcReceiverBase, IbcReceiv
178175
bytes32 messageIdentifier = bytes32(rawMessage[MESSAGE_IDENTIFIER_START:MESSAGE_IDENTIFIER_END]);
179176
address fromApplication = address(uint160(bytes20(rawMessage[FROM_APPLICATION_START_EVM:FROM_APPLICATION_END])));
180177
_handleTimeout(
181-
packet.src.channelId, messageIdentifier, fromApplication, rawMessage[CTX0_MESSAGE_START:], feeRecipitent, gasLimit
178+
packet.dest.channelId, messageIdentifier, fromApplication, rawMessage[CTX0_MESSAGE_START:], feeRecipitent, gasLimit
182179
);
183180
}
184181

0 commit comments

Comments
 (0)