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
bugfix: Update utils.go #530
Conversation
bugfix: compare 2 DenomUnit variable wrong because they are pointers
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for contributing! This looks good to me.
Can you write some tests in x/erc20/types/utils_test.go
?
decimals := uint8(coinMetadata.DenomUnits[0].Exponent) The original code maybe OK for evmos itself. However, it may causes incorrect decimal value 1. in the metadata validation func: cosmos-sdk/x/bank/types/metadata.go: Metadata.Validate() it makes sure Denomination units are sorted in ascending order. 2. https://docs.evmos.org/modules/erc20/01_concepts.html "Coin Metadata to ERC20 details" informaiton
@danburck thanks for your review, I have added the test code in I have submit another commit about fetch "decimal" value from cosmos coin metadata during deploy ERC20 contract. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @liziblockchain! Code changes look great. Left a few minor comments on the tests
Codecov Report
@@ Coverage Diff @@
## main #530 +/- ##
==========================================
+ Coverage 81.46% 81.56% +0.10%
==========================================
Files 115 115
Lines 6360 6375 +15
==========================================
+ Hits 5181 5200 +19
+ Misses 1024 1018 -6
- Partials 155 157 +2
|
bugfix: compare 2 DenomUnit variable wrong because they are pointers
Description
Closes: #XXX
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
PR review checkboxes:
I have...
Unreleased
section inCHANGELOG.md
Code maintenance:
I have...
godoc
and code comments.docs/
) or specification (x/<module>/spec/
)Reviewers Checklist
All items are required. Please add a note if the item is not applicable and please add your handle next to the items reviewed if you only reviewed selected items.
I have...