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

update token create and token update precompile selectors to match documentation/protobuf #3910

Merged
merged 3 commits into from
Sep 8, 2022

Conversation

lukelee-sl
Copy link
Member

@lukelee-sl lukelee-sl commented Sep 7, 2022

Signed-off-by: lukelee-sl luke.lee@swirldslabs.com

Description:
Some of the types in structs and call parameters for creating and updating tokens did not match documentation and/or protobuf specs. The Hedera-smart-contract repo has been updated with the correct types and this pull request addresses the necessary changes on the services side.

For backwards compatibility, the existing selectors were left in place and new selectors were added to DecodingFacade to support the new signatures.

Related issue(s):

Fixes #3902
Based on hashgraph/hedera-smart-contracts#56

Notes for reviewer:

Checklist

  • Documented (Code comments, README, etc.)
  • Tested (unit, integration, etc.)

…cumentation/protobuf

Signed-off-by: lukelee-sl <luke.lee@swirldslabs.com>
Signed-off-by: lukelee-sl <luke.lee@swirldslabs.com>
@codecov
Copy link

codecov bot commented Sep 8, 2022

Codecov Report

Merging #3910 (ea3098a) into master (56132d5) will increase coverage by 11.43%.
The diff coverage is 98.66%.

@@              Coverage Diff              @@
##             master    #3910       +/-   ##
=============================================
+ Coverage     85.19%   96.62%   +11.43%     
- Complexity    12889    14032     +1143     
=============================================
  Files           945      941        -4     
  Lines         45850    40497     -5353     
  Branches       4906     4097      -809     
=============================================
+ Hits          39061    39132       +71     
+ Misses         6102      677     -5425     
- Partials        687      688        +1     
Impacted Files Coverage Δ
...vices/store/contracts/precompile/AbiConstants.java 100.00% <ø> (ø)
...ntracts/precompile/impl/TokenUpdatePrecompile.java 87.50% <83.33%> (-3.41%) ⬇️
...e/contracts/precompile/HTSPrecompiledContract.java 97.47% <100.00%> (ø)
...ore/contracts/precompile/codec/DecodingFacade.java 99.64% <100.00%> (+0.02%) ⬆️
...ntracts/precompile/impl/TokenCreatePrecompile.java 96.75% <100.00%> (+0.17%) ⬆️
...main/java/com/hedera/services/fees/TxnFeeType.java 0.00% <0.00%> (ø)
...ava/com/hedera/services/fees/HbarCentExchange.java 0.00% <0.00%> (ø)
...vices/exceptions/NonZeroNetTransfersException.java 0.00% <0.00%> (ø)
...s/exceptions/InconsistentAdjustmentsException.java 0.00% <0.00%> (ø)
...rvices/sigs/metadata/lookups/HfsSigMetaLookup.java
... and 243 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

Signed-off-by: lukelee-sl <luke.lee@swirldslabs.com>
@sonarcloud
Copy link

sonarcloud bot commented Sep 8, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

98.7% 98.7% Coverage
0.0% 0.0% Duplication

@georg-getz
Copy link
Collaborator

Hi, if the problem was that field types weren't correct and didn't match protobuf/docs is there a good reason for backwards compatibility? Isn't it better to outright delete the older version?

@Nana-EC
Copy link
Contributor

Nana-EC commented Sep 8, 2022

Hi, if the problem was that field types weren't correct and didn't match protobuf/docs is there a good reason for backwards compatibility? Isn't it better to outright delete the older version?

Dev experience.
Even if we deprecate it we should provide some announcement and timeline to not break people with existing deployed contracts. These are older methods, if it was HIP 514 we could have made the case of no backwards compatibility since it hasn't hit mainnet yet

Copy link
Contributor

@shemnon shemnon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@Nana-EC Nana-EC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LG

@@ -131,20 +133,38 @@ private AbiConstants() {
// **** HIP-358 function selectors ****
// createFungibleToken(HederaToken memory token, uint initialTotalSupply, uint decimals)
public static final int ABI_ID_CREATE_FUNGIBLE_TOKEN = 0x7812a04b;
// createFungibleToken(HederaToken memory token, uint64 initialTotalSupply, uint32 decimals)
public static final int ABI_ID_CREATE_FUNGIBLE_TOKEN_V2 = 0xc23baeb6;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: I like the callout comment you did on the others so suggesting this

Suggested change
public static final int ABI_ID_CREATE_FUNGIBLE_TOKEN_V2 = 0xc23baeb6;
// decimals updated to uint32
public static final int ABI_ID_CREATE_FUNGIBLE_TOKEN_V2 = 0xc23baeb6;

Copy link
Collaborator

@tinker-michaelj tinker-michaelj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tinker-michaelj tinker-michaelj merged commit ac22052 into master Sep 8, 2022
@tinker-michaelj tinker-michaelj deleted the 3902-update-precompile-selectors branch September 8, 2022 18:06
Copy link
Member

@Neeharika-Sompalli Neeharika-Sompalli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

IHederaTokenService precompile token create selectors are inconsistent with documentation
6 participants