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

removed all uses of uints from hedera token service selectors #99

Closed
wants to merge 63 commits into from

Conversation

georg-getz
Copy link
Collaborator

@georg-getz georg-getz commented Oct 13, 2022

Signed-off-by: Georgi Georgiev georgi.getz@outlook.com

Description:
This PR removes usages of uints in the HederaTokenService interface and contract and any necessary follow up changes in the other files.

Related issue(s):
hashgraph/hedera-protobufs#235
hashgraph/hedera-services#4067

Fixes hashgraph/hedera-services#3916 and #85

Important note
Tests aren't passing because of 2 reasons:

  1. In order for them to pass the related issue in hedera services needs to be merged so that selectors are updated
  2. They currently don't pass in main branch either

Checklist

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

Copy link
Collaborator

@georgi-l95 georgi-l95 left a comment

Choose a reason for hiding this comment

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

LG, but I think that, we should apply those changes in the examples as well. Because of that the test are not passing.

Nana-EC
Nana-EC previously approved these changes Oct 20, 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.

Copy link

@IvanKavaldzhiev IvanKavaldzhiev left a comment

Choose a reason for hiding this comment

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

LGTM

shemnon
shemnon previously approved these changes Oct 27, 2022
@Nana-EC
Copy link
Collaborator

Nana-EC commented Nov 7, 2022

@georg-getz can rebase and we can sign off with passing tests

shemnon
shemnon previously approved these changes Nov 15, 2022
Copy link
Collaborator

@georgi-l95 georgi-l95 left a comment

Choose a reason for hiding this comment

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

LGTM!

Signed-off-by: SimiHunjan <simi.hunjan.k@gmail.com>
Signed-off-by: SimiHunjan <simi.hunjan.k@gmail.com>
Signed-off-by: SimiHunjan <simi.hunjan.k@gmail.com>
Nana-EC and others added 27 commits December 12, 2022 16:06
Bump 0.3.0-SNAPSHOT

Signed-off-by: Nana Essilfie-Conduah <nana@swirldslabs.com>
Add npm artifact github action for use in releases

Signed-off-by: Nana Essilfie-Conduah <nana@swirldslabs.com>
* Add tests

Signed-off-by: nikolay <n.atanasow94@gmail.com>

* Refactor tests

Signed-off-by: nikolay <n.atanasow94@gmail.com>

* Refactor tests

Signed-off-by: nikolay <n.atanasow94@gmail.com>

Signed-off-by: nikolay <n.atanasow94@gmail.com>
Signed-off-by: Georgi Georgiev <georgi.getz@outlook.com>
…era token service interface and contract

Signed-off-by: Georgi Georgiev <georgi.getz@outlook.com>
…ently in the protobufs

Signed-off-by: Georgi Georgiev <georgi.getz@outlook.com>
Signed-off-by: Georgi Georgiev <georgi.getz@outlook.com>
Bumps [@xmldom/xmldom](https://github.com/xmldom/xmldom) from 0.7.5 to 0.7.6.
- [Release notes](https://github.com/xmldom/xmldom/releases)
- [Changelog](https://github.com/xmldom/xmldom/blob/master/CHANGELOG.md)
- [Commits](xmldom/xmldom@0.7.5...0.7.6)

---
updated-dependencies:
- dependency-name: "@xmldom/xmldom"
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
* TokenQueryContract.sol ready

Signed-off-by: georgi-l95 <glazarov95@gmail.com>

* add transferFrom and tranferFromNFT to HTS

Signed-off-by: georgi-l95 <glazarov95@gmail.com>

* TokenTransferContract.sol ready

Signed-off-by: georgi-l95 <glazarov95@gmail.com>

* TokenManagementContract.sol ready

Signed-off-by: georgi-l95 <glazarov95@gmail.com>

* TokenCreateContract.sol ready

Signed-off-by: georgi-l95 <glazarov95@gmail.com>

* delete TokenCreate.sol

Signed-off-by: georgi-l95 <glazarov95@gmail.com>

* fix tests

Signed-off-by: georgi-l95 <glazarov95@gmail.com>

* fixed empty lines

Signed-off-by: georgi-l95 <glazarov95@gmail.com>

* fix tests

Signed-off-by: georgi-l95 <glazarov95@gmail.com>

* x

Signed-off-by: georgi-l95 <glazarov95@gmail.com>

* x

Signed-off-by: georgi-l95 <glazarov95@gmail.com>

* fix test

Signed-off-by: georgi-l95 <glazarov95@gmail.com>

* address comments

Signed-off-by: georgi-l95 <glazarov95@gmail.com>

Signed-off-by: georgi-l95 <glazarov95@gmail.com>
Signed-off-by: Georgi Georgiev <georgi.getz@outlook.com>
Add tests for token query contract

Signed-off-by: georgi-l95 <glazarov95@gmail.com>
Signed-off-by: georgi-l95 <glazarov95@gmail.com>
* test: expand TokenCreateContract coverage

Signed-off-by: Ivo Yankov <ivo@devlabs.bg>

* chore: update versions in ci

Signed-off-by: Ivo Yankov <ivo@devlabs.bg>

* chore: resolve conflicts

Signed-off-by: Ivo Yankov <ivo@devlabs.bg>

* chore: move unfreeze and unpause methods

Signed-off-by: Ivo Yankov <ivo@devlabs.bg>

Signed-off-by: Ivo Yankov <ivo@devlabs.bg>
Signed-off-by: Georgi Georgiev <georgi.getz@outlook.com>
* test: expand ERC20 test coverage

Signed-off-by: Ivo Yankov <ivo@devlabs.bg>

* test: add test for delegateTransferFrom

Signed-off-by: Ivo Yankov <ivo@devlabs.bg>

* chore: enable other tests

Signed-off-by: Ivo Yankov <ivo@devlabs.bg>

Signed-off-by: Ivo Yankov <ivo@devlabs.bg>
* test: add tests for unsupported methods

Signed-off-by: Ivo Yankov <ivo@devlabs.bg>

* test: add negative tests for transferFrom and approve

Signed-off-by: Ivo Yankov <ivo@devlabs.bg>

* chore: assert error codes for approve and transferFrom

Signed-off-by: Ivo Yankov <ivo@devlabs.bg>

Signed-off-by: Ivo Yankov <ivo@devlabs.bg>
Adds transfer tests with support for delegate calls

Signed-off-by: nikolay <n.atanasow94@gmail.com>
Clean up dependencies of hts-precompile modules to reduce unnecessary coupling and fix some warnings about visibility modifiers.
The PR modifies the hts-precompile contracts to:

- Reduce coupling between helpers
- Changes `HederaResponseCodes` to a library
- Makes all hts-precompile contracts abstract
- Changes the visibility of `FeeHelper` to pure to silence compiler warnings.
- Bump hedera local-node version
- Bump hardhat-chai-matchers version

Signed-off-by: georgi-l95 <glazarov95@gmail.com>
Changed functions perform critical operations that change token state. If they are left external, it would allow anyone to cause very serious issues if the inheriting contract has the ADMIN, KYC, or PAUSE keys for Hedera token[s].

In your tutorials, devs are suggested to inherit these HTS contracts. If they decide to make the inheriting contract have the admin key to allow it to change the token's certain properties behind restricted functions, anyone can bypass the restrictions via the inherited HTS contract, and hijack the token. Or if they make the inheriting contract have the pause key and make it algorithmically manage the pause state of the token, anyone can bypass such algorithm and DOS the token. Given the expected usage of these contracts, and the severity of the impact, this is a high risk issue.

Signed-off-by: georgi-l95 <glazarov95@gmail.com>
Signed-off-by: Georgi Georgiev <georgi.getz@outlook.com>
…approval (hashgraph#134)

* Tests to so transferFrom with approval does not work for HTS tokens

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

* fix NFT transferFrom test to use serial number

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

* improve variable name

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

ensure tests fail unless expection thrown

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

remove test identifier

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

Signed-off-by: lukelee-sl <luke.lee@swirldslabs.com>
Add ABI JSON Files for

- System Contract contracts
- Supporting Caller contracts
- Example contracts

Signed-off-by: Nana Essilfie-Conduah <nana@swirldslabs.com>
Signed-off-by: Nana Essilfie-Conduah <nana@swirldslabs.com>

Signed-off-by: Nana Essilfie-Conduah <nana@swirldslabs.com>
* Edit erc20 and erc721

Signed-off-by: nikolay <n.atanasow94@gmail.com>

* Edit token create/management/query contracts

Signed-off-by: nikolay <n.atanasow94@gmail.com>

* Edit tests

Signed-off-by: nikolay <n.atanasow94@gmail.com>

Signed-off-by: nikolay <n.atanasow94@gmail.com>
Fix updateTokenInfo test. Treasury needed to be changed to the admin account. We were trying to set it to the contractId, while signing with signers[0].

Signed-off-by: georgi-l95 <glazarov95@gmail.com>
* Add compare test for hapi vs precompile token

Signed-off-by: georgi-l95 <glazarov95@gmail.com>

fix workflow

Signed-off-by: georgi-l95 <glazarov95@gmail.com>

fix workflow

Signed-off-by: georgi-l95 <glazarov95@gmail.com>

fix workflow

Signed-off-by: georgi-l95 <glazarov95@gmail.com>

* method name correction

Signed-off-by: georgi-l95 <glazarov95@gmail.com>

Signed-off-by: georgi-l95 <glazarov95@gmail.com>
Signed-off-by: Georgi Georgiev <georgi.getz@outlook.com>
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 Items for Limechain team P1
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Remove use of uints from IHederaTokenService precompile selectors