Skip to content

Commit

Permalink
fix: modified wrong data decoding in _checkPayloadAgainstGatewayData (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
ahramy authored Sep 17, 2024
1 parent 2b07e70 commit be24c94
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions contracts/InterchainTokenService.sol
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,8 @@ contract InterchainTokenService is
* @param amount The amount for the call contract with token.
*/
function _checkPayloadAgainstGatewayData(bytes memory payload, string calldata tokenSymbol, uint256 amount) internal view {
// The same payload is decoded in both _checkPayloadAgainstGatewayData and _contractCallValue using different parameters.
// This is intentional, as using `uint256` instead of `bytes` improves gas efficiency without any functional difference.
(, bytes32 tokenId, , , uint256 amountInPayload) = abi.decode(payload, (uint256, bytes32, uint256, uint256, uint256));

if (validTokenAddress(tokenId) != gateway.tokenAddresses(tokenSymbol) || amount != amountInPayload)
Expand Down

0 comments on commit be24c94

Please sign in to comment.