-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
refactor(genutil/cli): remove txConfig
from genesis command
#20976
Conversation
Warning Rate limit exceeded@zakir-code has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 0 minutes and 22 seconds before requesting another review. How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. WalkthroughWalkthroughThe changes primarily involve the removal of the Changes
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 (
|
txConfig
from genesis command
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: 0
Review details
Configuration used: .coderabbit.yml
Review profile: CHILL
Files selected for processing (11)
- simapp/simd/cmd/commands.go (3 hunks)
- simapp/simd/cmd/root.go (1 hunks)
- simapp/simd/cmd/root_di.go (1 hunks)
- simapp/v2/simdv2/cmd/commands.go (3 hunks)
- x/genutil/client/cli/commands.go (2 hunks)
- x/genutil/client/cli/genaccount.go (3 hunks)
- x/genutil/client/cli/genaccount_test.go (3 hunks)
- x/genutil/client/cli/gentx.go (4 hunks)
- x/genutil/client/cli/gentx_test.go (2 hunks)
- x/genutil/client/cli/init.go (1 hunks)
- x/staking/client/cli/tx.go (2 hunks)
Additional context used
Path-based instructions (11)
x/genutil/client/cli/commands.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.x/genutil/client/cli/genaccount_test.go (2)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
Pattern
**/*_test.go
: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"x/genutil/client/cli/genaccount.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.simapp/simd/cmd/root_di.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.x/genutil/client/cli/gentx_test.go (2)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
Pattern
**/*_test.go
: "Assess the unit test code assessing sufficient code coverage for the changes associated in the pull request"simapp/simd/cmd/commands.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.simapp/simd/cmd/root.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.simapp/v2/simdv2/cmd/commands.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.x/genutil/client/cli/init.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.x/genutil/client/cli/gentx.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.x/staking/client/cli/tx.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
Additional comments not posted (24)
x/genutil/client/cli/commands.go (2)
24-25
: Simplified function signature.The removal of
txConfig
andMigrationMap
parameters simplifies the function signature.
Line range hint
30-44
: Simplified function signature and internal calls.The removal of
txConfig
andmigrationMap
parameters simplifies the function signature and internal calls.x/genutil/client/cli/genaccount_test.go (6)
Line range hint
1-13
: Removed unused import.The removal of
addresscodec
import is consistent with the changes in the function signatures.
73-73
: Updatedviper
initialization.The change to use
v
instead ofviper
is consistent and improves readability.
75-77
: UpdatedappCodec
initialization and introducedencodingConfig
.The introduction of
encodingConfig
and update toappCodec
initialization is consistent with the removal oftxConfig
parameter.
83-84
: Updated context setup to includetxConfig
.The update to include
txConfig
in the context setup is consistent with the changes in the function signatures.
97-97
: Updated context setup to usev
.The update to use
v
instead ofviper
in the context setup is consistent and improves readability.
100-100
: SimplifiedAddGenesisAccountCmd
initialization.The removal of
addresscodec
parameter simplifies the function signature and is consistent with the changes in the function signatures.x/genutil/client/cli/genaccount.go (2)
26-26
: Simplified function signature.The removal of
addressCodec
parameter simplifies the function signature.
40-40
: Simplified internal logic.The update to retrieve
addressCodec
from the client context simplifies the function logic and is consistent with the changes in the function signatures.simapp/simd/cmd/root_di.go (2)
84-84
: Simplified function signature.The removal of
clientCtx.TxConfig
parameter simplifies the function signature.
Line range hint
86-88
: Improved error handling.The update to handle errors returned by
autoCliOpts.EnhanceRootCommand
improves error handling and robustness of the function.x/genutil/client/cli/gentx_test.go (1)
126-126
: LGTM! But verify the function usage in the codebase.The code changes are approved.
However, ensure that all function calls to
GenTxCmd
match the new signature.Verification successful
All instances of
GenTxCmd
match the new signature.The code changes are verified and approved.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Verify all function calls to `GenTxCmd` match the new signature. # Test: Search for the function usage. Expect: Only occurrences of the new signature. rg --type go -A 5 $'GenTxCmd'Length of output: 1774
simapp/simd/cmd/commands.go (2)
Line range hint
17-20
:
LGTM! Simplified function signature.The removal of the
txConfig
parameter simplifies the function signature.
Line range hint
62-70
:
LGTM! Simplified function signature.The removal of the
txConfig
parameter simplifies the function signature.simapp/simd/cmd/root.go (1)
112-112
: LGTM! Simplified function call.The removal of the
encodingConfig.TxConfig
argument simplifies the function call.simapp/v2/simdv2/cmd/commands.go (2)
Line range hint
36-39
:
LGTM! Simplified function signature.The removal of the
txConfig
parameter simplifies the function signature.
Line range hint
145-151
:
LGTM! Simplified function signature.The removal of the
txConfig
parameter simplifies the function signature.x/genutil/client/cli/init.go (1)
92-94
: Ensureconfig.RootDir
is set correctly.The change ensures that
config.RootDir
defaults toclientCtx.HomeDir
if it is not set, which is a good practice to avoid null or empty values.x/genutil/client/cli/gentx.go (3)
30-30
: Update function signature to remove unnecessary parameters.The
GenTxCmd
function signature has been updated to removetxEncCfg
andvalAdddressCodec
parameters, simplifying the function and reducing dependencies.
141-141
: Ensure correct context setup.The
clientCtx
is updated withinBuf
andaddr
, which is necessary for subsequent operations.
157-157
: Update function call to remove unnecessary parameter.The call to
cli.BuildCreateValidatorMsg
has been updated to remove thevalAdddressCodec
parameter, simplifying the function call.x/staking/client/cli/tx.go (2)
368-368
: Update function signature to remove unnecessary parameter.The
BuildCreateValidatorMsg
function signature has been updated to remove thevalCodec
parameter, simplifying the function and reducing dependencies.
401-402
: RetrievevalCodec
fromclientCtx
.The
valCodec
is now obtained fromclientCtx.TxConfig.SigningContext().ValidatorAddressCodec()
, which centralizes the configuration retrieval.
if config.RootDir == "" { | ||
config.RootDir = clientCtx.HomeDir | ||
} |
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.
cosmos-sdk/server/util_test.go
Line 462 in 25aea8a
cmd := genutilcli.InitCmd(module.NewManager()) |
The init
command did not read into the root(hoom) directory during unit test TestEmptyMinGasPrices
, causing the file to be created in the current directory
@@ -120,6 +120,9 @@ Every module contains its own CHANGELOG.md. Please refer to the module you are i | |||
|
|||
### API Breaking Changes | |||
|
|||
* (client) [#20976](https://github.com/cosmos/cosmos-sdk/pull/20976) Simplified command initialization by removing unnecessary parameters such as `txConfig` and `addressCodec`. | |||
* Remove parameter `txConfig` from `genutilcli.Commands`,`genutilcli.CommandsWithCustomMigrationMap`,`genutilcli.GenTxCmd`. | |||
* Remove parameter `addressCodec` from `genutilcli.GenTxCmd`,`genutilcli.AddGenesisAccountCmd`,`stakingcli.BuildCreateValidatorMsg`. |
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.
Can we check if addressCodec was there in 0.50? I don't think so, and that means we can remove this line.
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.
I checked the latest version 0.50, and it does have addressCodec.
https://github.com/cosmos/cosmos-sdk/blob/v0.50.8/x/genutil/client/cli/commands.go
Description
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 changeCHANGELOG.md
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.
Please see Pull Request Reviewer section in the contributing guide for more information on how to review a pull request.
I have...
Summary by CodeRabbit
Refactor
txConfig
andaddressCodec
.Bug Fixes
Tests