Omniscia SaucerSwap Labs Audit

HederaTokenService Manual Review Findings

HederaTokenService Manual Review Findings

HTS-01M: Inexistent Sanitization of Token Configuration

TypeSeverityLocation
Input SanitizationHederaTokenService.sol:L45

Description:

In contrast to the original HederaTokenService implementation of the Hedera Protocol, the HederaTokenService::createFungibleToken does not apply any sanitization on the input token configuration.

Impact:

The current behaviour of the HederaTokenService::createFungibleToken is in direct discrepancy with the official implementation it is meant to represent.

Example:

contracts/hedera/HederaTokenService.sol
44function createFungibleToken(
45 IHederaTokenService.HederaToken memory token,
46 uint initialTotalSupply,
47 uint decimals)
48internal returns (int responseCode, address tokenAddress) {
49
50 (bool success, bytes memory result) = precompileAddress.call{value: msg.value}(
51 abi.encodeWithSelector(IHederaTokenService.createFungibleToken.selector,
52 token, initialTotalSupply, decimals));
53
54
55 (responseCode, tokenAddress) = success ? abi.decode(result, (int32, address)) : (HederaResponseCodes.UNKNOWN, address(0));
56}

Recommendation:

We advise the code of the Hedera Protocol to be mimicked, ensuring that the SDK's behaviour is replicated and that no other side-effects arise such as those described in issues #4 and #151 of the original Hedera Protocol codebase.

Alleviation (a2c5a0b913a7ddc21ff96f97fa51f2820a5da7ec):

The HederaTokenService contract was updated to properly apply a non-empty expiry for the input token configuration via the HederaTokenService::nonEmptyExpiry that was carried over from the original implementation. As such, we consider this exhibit adequately dealt with.