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

HTS precompile token key management tests #464

Merged
merged 30 commits into from
Sep 20, 2022

Conversation

Ivo-Yankov
Copy link
Collaborator

@Ivo-Yankov Ivo-Yankov commented Aug 23, 2022

Description:
Adds tests for getTokenKey and updateTokenKeys.
Applies changes from PR #524
Adds a new acceptance test suite - htsPrecompile_v2 in order to reduce the size of BaseHTS.sol so that the bytecode doesn't exceed 24kb.

Related issue(s):

Fixes #409
Fixes #521

Notes for reviewer:

Checklist

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

Signed-off-by: Ivo Yankov <[email protected]>

# Conflicts:
#	packages/server/tests/acceptance/htsPrecompile.spec.ts
#	packages/server/tests/contracts/HederaTokenService.sol
#	packages/server/tests/contracts/IHederaTokenService.sol
@Ivo-Yankov Ivo-Yankov changed the title 409 hts precompile token key tests HTS precompile token key management tests Aug 23, 2022
@Nana-EC Nana-EC added enhancement New feature or request limechain P2 labels Aug 23, 2022
Signed-off-by: Ivo Yankov <[email protected]>
@Ivo-Yankov Ivo-Yankov marked this pull request as draft August 24, 2022 11:52
@Nana-EC Nana-EC added this to the 0.8.0 milestone Aug 24, 2022
Ivo-Yankov and others added 5 commits September 5, 2022 14:49
Signed-off-by: Ivo Yankov <[email protected]>
Signed-off-by: Nana Essilfie-Conduah <[email protected]>
# Conflicts:
#	packages/server/tests/acceptance/htsPrecompile.spec.ts
#	packages/server/tests/contracts/BaseHTS.json
#	packages/server/tests/contracts/BaseHTS.sol
#	packages/server/tests/contracts/HederaTokenService.json
#	packages/server/tests/contracts/HederaTokenService.sol
#	packages/server/tests/contracts/IHederaTokenService.json
#	packages/server/tests/contracts/IHederaTokenService.sol
@codecov-commenter
Copy link

codecov-commenter commented Sep 12, 2022

Codecov Report

Base: 76.67% // Head: 76.88% // Increases project coverage by +0.20% 🎉

Coverage data is based on head (fcb283e) compared to base (bed9aa9).
Patch has no changes to coverable lines.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #464      +/-   ##
==========================================
+ Coverage   76.67%   76.88%   +0.20%     
==========================================
  Files          12       12              
  Lines         926      943      +17     
  Branches      145      149       +4     
==========================================
+ Hits          710      725      +15     
- Misses        164      169       +5     
+ Partials       52       49       -3     
Impacted Files Coverage Δ
packages/relay/src/lib/constants.ts 100.00% <0.00%> (ø)
packages/relay/src/lib/eth.ts 84.71% <0.00%> (+0.06%) ⬆️
packages/relay/src/lib/errors/JsonRpcError.ts 77.77% <0.00%> (+2.77%) ⬆️

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

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Signed-off-by: Ivo Yankov <[email protected]>
# Conflicts:
#	packages/server/tests/contracts/BaseHTS.json
Signed-off-by: Ivo Yankov <[email protected]>
@Ivo-Yankov Ivo-Yankov marked this pull request as ready for review September 14, 2022 15:00
Nana-EC
Nana-EC previously approved these changes Sep 14, 2022
Copy link
Collaborator

@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
Please update PR descriptions

package-lock.json Outdated Show resolved Hide resolved
tools/hardhat-example/hardhat.config.js Outdated Show resolved Hide resolved
natanasow
natanasow previously approved these changes Sep 15, 2022
# Conflicts:
#	packages/server/tests/acceptance/htsPrecompile.spec.ts
#	packages/server/tests/contracts/BaseHTS.json
#	packages/server/tests/contracts/BaseHTS.sol
#	packages/server/tests/contracts/HederaTokenService.sol
#	packages/server/tests/contracts/IHederaTokenService.sol
Signed-off-by: Ivo Yankov <[email protected]>
Nana-EC
Nana-EC previously approved these changes Sep 16, 2022
Copy link
Collaborator

@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

# Conflicts:
#	packages/server/tests/acceptance/htsPrecompile.spec.ts
#	packages/server/tests/contracts/BaseHTS.json
#	packages/server/tests/contracts/BaseHTS.sol
#	packages/server/tests/contracts/IHederaTokenService.json
#	packages/server/tests/contracts/IHederaTokenService.sol
Signed-off-by: Ivo Yankov <[email protected]>
georgi-l95
georgi-l95 previously approved these changes Sep 18, 2022
@Ivo-Yankov
Copy link
Collaborator Author

The HTS Precompile tests in their current state are very unstable and require a refactor. The bytecode of BaseHTS contract has become larger than 25kb and it cannot be deployed because of the EVM limit of 24kb.

Signed-off-by: Ivo Yankov <[email protected]>
@Ivo-Yankov Ivo-Yankov mentioned this pull request Sep 19, 2022
2 tasks
package.json Outdated
@@ -25,6 +25,7 @@
"acceptancetest:erc20": "ts-mocha packages/server/tests/acceptance/index.spec.ts -g '@erc20' --exit",
"acceptancetest:htsprecompile": "ts-mocha packages/server/tests/acceptance/index.spec.ts -g '@htsprecompile' --exit",
"acceptancetest:htsprecompilev1": "ts-mocha packages/server/tests/acceptance/index.spec.ts -g '@htsprecompilev1' --exit",
"acceptancetest:htsprecompilev2": "ts-mocha packages/server/tests/acceptance/index.spec.ts -g '@htsprecompilev2' --exit",
Copy link
Member

Choose a reason for hiding this comment

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

the -g flag is a grep and thus -g '@htsprecompile' will match three acceptance tests (acceptancetest:htsprecompile, acceptancetest:htsprecompilev1, acceptancetest:htsprecompilev2).

Copy link
Collaborator

@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.

Let's not use a v2 as it gives a different meaning
Provided suggestions

.github/workflows/acceptance.yml Outdated Show resolved Hide resolved
packages/server/tests/contracts/contracts_v2/BaseHTS.sol Outdated Show resolved Hide resolved
Copy link
Collaborator

@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.

Some contract function dupes to fix

@sonarqubecloud
Copy link

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

No Coverage information No Coverage information
0.0% 0.0% Duplication

Copy link
Collaborator

@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


import "./TokenCreate.sol";

contract TokenContractContract is TokenCreate {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can fix this later

Suggested change
contract TokenContractContract is TokenCreate {
contract TokenCreateContract is TokenCreate {

@Nana-EC Nana-EC merged commit abab2db into main Sep 20, 2022
@Nana-EC Nana-EC deleted the 409-hts-precompile-token-key-tests branch September 20, 2022 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request limechain P2
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Enable pending acceptance tests Add preCompile acceptance test coverage for token key methods
6 participants