-
Notifications
You must be signed in to change notification settings - Fork 37
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
feat: initialize genesis denom with 18 decimals by default #51
Conversation
WalkthroughThe recent changes enhance the functionality of the EVM keeper package, focusing on ERC20 token management by introducing decimal precision handling. Key updates include modifying the Changes
Sequence Diagram(s)sequenceDiagram
participant TestKeepers
participant ERC20Keeper
participant Keeper
participant IERC20Keeper
TestKeepers->>Keeper: Initialize with Decimals
Keeper->>ERC20Keeper: CreateERC20 with Decimals
ERC20Keeper->>IERC20Keeper: Call CreateERC20
Note over IERC20Keeper: CreateERC20 now has Decimals parameter
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #51 +/- ##
==========================================
- Coverage 26.32% 26.31% -0.01%
==========================================
Files 111 111
Lines 11868 11870 +2
==========================================
Hits 3124 3124
- Misses 8299 8301 +2
Partials 445 445
|
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.
Actionable comments posted: 1
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (5)
- x/evm/keeper/common_test.go (3 hunks)
- x/evm/keeper/erc20.go (3 hunks)
- x/evm/keeper/genesis.go (2 hunks)
- x/evm/keeper/txutils_test.go (7 hunks)
- x/evm/types/expected_keeper.go (1 hunks)
Additional context used
GitHub Check: codecov/patch
x/evm/keeper/genesis.go
[warning] 21-21: x/evm/keeper/genesis.go#L21
Added line #L21 was not covered by tests
Additional comments not posted (13)
x/evm/types/expected_keeper.go (1)
72-72
: Verify implementations ofIERC20Keeper
.The
CreateERC20
method signature has been updated to include adecimals
parameter. Ensure all implementations ofIERC20Keeper
are updated to handle this new parameter.Run the following script to find all implementations of
IERC20Keeper
:x/evm/keeper/genesis.go (1)
Line range hint
24-48
: Ensure error handling consistency inInitializeWithDecimals
.The method
InitializeWithDecimals
handles errors consistently, but ensure that any additional logic added in the future maintains this consistency.Tools
GitHub Check: codecov/patch
[warning] 21-21: x/evm/keeper/genesis.go#L21
Added line #L21 was not covered by testsx/evm/keeper/txutils_test.go (6)
32-37
: LGTM! Dynamic fee calculation is correctly implemented.The dynamic calculation of
feeAmount
based ondecimals
enhances precision.
48-50
: LGTM! Correct use ofdecimals
ingasFeeCap
andvalue
.The use of
decimals
in the conversion functions ensures accurate unit representation.
97-97
: LGTM! Correct assertion of transaction fee.The assertion using
math.NewIntFromBigInt(feeAmount).AddRaw(1)
aligns with the new fee calculation logic.
124-130
: LGTM! Dynamic fee calculation is correctly implemented.The dynamic calculation of
feeAmount
based ondecimals
enhances precision.
140-142
: LGTM! Correct use ofdecimals
ingasFeeCap
andvalue
.The use of
decimals
in the conversion functions ensures accurate unit representation.
187-187
: LGTM! Correct assertion of transaction fee.The assertion using
math.NewIntFromBigInt(feeAmount).AddRaw(1)
aligns with the new fee calculation logic.x/evm/keeper/common_test.go (3)
145-145
: LGTM! Addition ofDecimals
field inTestKeepers
.The
Decimals
field allows for flexible handling of decimal values in tests.
275-281
: LGTM! Dynamic initialization ofdecimals
.The logic for initializing
decimals
introduces variability, enhancing test scenarios.
287-287
: LGTM! Correct assignment ofDecimals
inTestKeepers
.The assignment ensures that the
TestKeepers
struct accurately reflects the initialized state.x/evm/keeper/erc20.go (2)
301-301
: LGTM! Explicit decimal specification inMintCoins
.The call to
CreateERC20
with adecimals
parameter enhances control over token properties.
Line range hint
327-346
: LGTM! Correct handling ofdecimals
inCreateERC20
.The inclusion of the
decimals
parameter in the ABI packing process aligns with standard tokenomics practices.
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.
LGTM
Description
This update will allow the chain be initialized with 18 decimals genesis token.
Closes: #XXXX
Author Checklist
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.
I have...
!
in the type prefix if API or client breaking changeReviewers 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...
Summary by CodeRabbit
New Features
Bug Fixes
Documentation
IERC20Keeper
interface to reflect new decimals parameter for ERC20 creation.