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

eth_getCode to return the redirect bytecode for HTS tokens #598

Merged

Conversation

georgi-l95
Copy link
Collaborator

@georgi-l95 georgi-l95 commented Oct 7, 2022

Description:

  • Expand resolveEntityType function in mirror node to support token types
  • Change logic in eth_getCode - check for address type, if it's HTS token return redirect bytecode, rest is the same as before
  • address to tokenId conversion by using parseInt(address, 16)
  • Added acceptance test to cover this use case
  • Added unit test to cover this use case

Related issue(s):

Fixes #594
Fixes #583

Notes for reviewer:
Little change in unit tests, as we are making some additional requests and we need to mock them.

Checklist

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

Signed-off-by: georgi-l95 <glazarov95@gmail.com>
Signed-off-by: georgi-l95 <glazarov95@gmail.com>
@georgi-l95 georgi-l95 self-assigned this Oct 7, 2022
@georgi-l95 georgi-l95 linked an issue Oct 7, 2022 that may be closed by this pull request
@georgi-l95 georgi-l95 added bug Something isn't working limechain P2 labels Oct 7, 2022
@georgi-l95 georgi-l95 added this to the 0.10 milestone Oct 7, 2022
@codecov-commenter
Copy link

codecov-commenter commented Oct 7, 2022

Codecov Report

Base: 71.39% // Head: 70.85% // Decreases project coverage by -0.53% ⚠️

Coverage data is based on head (0b9baab) compared to base (54bb7d4).
Patch coverage: 76.92% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #598      +/-   ##
==========================================
- Coverage   71.39%   70.85%   -0.54%     
==========================================
  Files          16       16              
  Lines        1115     1139      +24     
  Branches      192      195       +3     
==========================================
+ Hits          796      807      +11     
- Misses        267      280      +13     
  Partials       52       52              
Impacted Files Coverage Δ
packages/relay/src/lib/constants.ts 100.00% <ø> (ø)
packages/relay/src/lib/eth.ts 83.30% <62.50%> (-0.43%) ⬇️
packages/relay/src/lib/clients/mirrorNodeClient.ts 92.15% <100.00%> (+2.96%) ⬆️
packages/relay/src/lib/clients/sdkClient.ts 6.28% <0.00%> (-0.55%) ⬇️

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: georgi-l95 <glazarov95@gmail.com>
@georgi-l95 georgi-l95 marked this pull request as ready for review October 7, 2022 08:40
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, missing UT's in mirrorNodeClient.spec.ts and one suggestion

packages/relay/src/lib/eth.ts Outdated Show resolved Hide resolved
Signed-off-by: georgi-l95 <glazarov95@gmail.com>
@georgi-l95 georgi-l95 requested a review from Nana-EC October 10, 2022 09:22
Nana-EC
Nana-EC previously approved these changes Oct 10, 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

packages/relay/src/lib/eth.ts Outdated Show resolved Hide resolved
Signed-off-by: georgi-l95 <glazarov95@gmail.com>
@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

@georgi-l95 georgi-l95 merged commit 048677f into main Oct 10, 2022
@georgi-l95 georgi-l95 deleted the 594-eth_getcode-to-return-the-redirect-bytecode-for-hts-tokens branch October 10, 2022 20:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working limechain P2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

eth_getCode to return the redirect bytecode for HTS tokens HTS NFTs not supported in Metamask mobile wallet
3 participants