Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IHederaTokenService precompile token create selectors are inconsistent with documentation #3902

Closed
Nana-EC opened this issue Sep 6, 2022 · 6 comments · Fixed by #3910
Closed
Assignees
Labels
Hedera Smart Contract Service Issues related to the Hedera Smart Contract Service.
Milestone

Comments

@Nana-EC
Copy link
Contributor

Nana-EC commented Sep 6, 2022

Description

Currently the selectors utilizing token supply params as part of a token create do not correctly match the docs and proto.

  • maxSupply is noted as an int64 but was implemented as uint32
  • totalSupply is noted as uint64 but was implemented as uint

Steps to reproduce

Attempting to pass token supply params to precompile create functions outside of the ranges documented but within the ranges implemented results in contract reverts e.g.

  • maxSupply where uint32.MAX < x < int64.MAX
  • totalSupply where uint64.MAX < x < int256.MAX

Additional context

Current selectors where types differ are noted here

  • createFungibleToken(HederaToken memory token, uint initialTotalSupply, uint decimals)
  • createFungibleTokenWithCustomFees(HederaToken memory token, uint initialTotalSupply, uint decimals, FixedFee[] memory fixedFees, FractionalFee[] memory fractionalFees)
  • getApproved(address token, uint256 tokenId)

No response

Hedera network

other

Version

v0.30.0

Operating system

No response

@Nana-EC Nana-EC added the Hedera Smart Contract Service Issues related to the Hedera Smart Contract Service. label Sep 6, 2022
@Nana-EC Nana-EC added this to the 0.30.0 milestone Sep 6, 2022
@lbaird
Copy link
Contributor

lbaird commented Sep 6, 2022 via email

@shemnon
Copy link
Contributor

shemnon commented Sep 6, 2022

Protobufs have mixed uint64 (for initial supply) and int64 (for total supply). My experience with recent EVM issues are that java and unsigned integers are bugs waiting to happen.

@Nana-EC Nana-EC changed the title IHederaTokenService token supply fields are missing uint64 support IHederaTokenService token supply fields are inconsistent with documentation Sep 6, 2022
@Nana-EC Nana-EC changed the title IHederaTokenService token supply fields are inconsistent with documentation IHederaTokenService token supply field types are inconsistent with documentation Sep 6, 2022
@Nana-EC
Copy link
Contributor Author

Nana-EC commented Sep 6, 2022

Should it be int64 rather than uint64?

@lbaird the issue is a bit more detailed as Danno noted.
We're updating the code to match the description on docs.hedera and the token create protobuf where maxSupply is a uint64 and initialTotalSupply is an int64
To answer your question maxSupply should be int64 and totalSupply should be uint64 as documented.

I've updated the title and description to align with the intention.
Initial form was to ensure we were tracking it.

@Nana-EC Nana-EC changed the title IHederaTokenService token supply field types are inconsistent with documentation IHederaTokenService precompile token create selectors are inconsistent with documentation Sep 6, 2022
@lbaird
Copy link
Contributor

lbaird commented Sep 7, 2022 via email

@lbaird
Copy link
Contributor

lbaird commented Sep 7, 2022 via email

@Nana-EC
Copy link
Contributor Author

Nana-EC commented Sep 9, 2022

It sounds like the documentation should be fixed. Unless there’s a logical reason to do it that way. In general, everything should be signed, to match what’s available in Java.

@lbaird circling back.
Given the progress of 0.30 we decided it wasn't worth the risk to pursue protobuf changes.
The approach utilized by the precompile allows us to version and support different selectors.
As such we decided to unblock the customer issue first and will circle back with #3916 to address the issue in all occurrences

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Hedera Smart Contract Service Issues related to the Hedera Smart Contract Service.
Projects
Archived in project
4 participants