-
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
feat(client/keys): add support for importing hex key using standard input #21829
Conversation
WalkthroughWalkthroughThe changes introduce a new feature in the Cosmos SDK's 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 using PR comments)
Other keywords and placeholders
Documentation and Community
|
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
Outside diff range and nitpick comments (3)
CHANGELOG.md (3)
Line range hint
1-4
: Suggestion: Add a title and description at the top of the changelogConsider adding a brief title and description at the very top of the changelog explaining what this document is, and how users can make the most of the information here. This can help new users quickly understand the purpose and structure of the changelog.
Line range hint
310-310
: Typo: "begin" should be "begin block"- (x/upgrade) [#12603](https://github.com/cosmos/cosmos-sdk/pull/12603) feat: Move AppModule.BeginBlock and AppModule.EndBlock to extension interfaces
Here "begin" should be expanded to "begin block" to match "end block" and be more descriptive.
Line range hint
407-407
: Unclear breaking change description- [#9879](https://github.com/cosmos/cosmos-sdk/pull/9879) Modify ABCI Queries to use `abci.QueryRequest` Height field if it is non-zero, otherwise continue using context height.
The breaking change description here is quite unclear. It doesn't explain what queries were impacted, what the previous behavior was, and why the new behavior might break existing clients.
Consider expanding this with more context, such as:
- [#9879](https://github.com/cosmos/cosmos-sdk/pull/9879) ABCI Queries should use the `Height` field of `abci.RequestQuery` if it is non-zero. Previously, the context height was used in all cases. Clients relying on the old behavior of using context height when the `Height` field is set will need to be updated.
This provides more details on what changed, what the previous behavior was, and how clients might be impacted and need to adapt.
Review details
Configuration used: .coderabbit.yml
Review profile: CHILL
Files selected for processing (3)
- CHANGELOG.md (1 hunks)
- client/keys/import.go (3 hunks)
- client/keys/import_test.go (5 hunks)
Additional context used
Path-based instructions (3)
CHANGELOG.md (1)
Pattern
**/*.md
: "Assess the documentation for misspellings, grammatical errors, missing documentation and correctness"client/keys/import.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.client/keys/import_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"
Additional comments not posted (7)
client/keys/import.go (2)
Line range hint
37-47
: LGTM!The changes in the
ImportKeyCommand
function are well-structured and improve code readability:
- Reading the file contents into a variable named
armor
is more descriptive than the previous namebz
.- Using
string(armor)
instead ofstring(bz)
in theImportPrivKey
call is consistent with the variable name change.The logic flow remains clear and concise.
Line range hint
54-78
: Great work on enhancing theImportKeyHexCommand
function!The updates to the command usage and argument handling logic improve the user experience:
- Changing
Args: cobra.ExactArgs(2)
toArgs: cobra.RangeArgs(1, 2)
allows for flexibility in providing the hex key.- The conditional logic for handling the second argument is well-structured and handles both cases effectively.
- Prompting the user for input when the second argument is not provided is a nice touch.
- Using the
name
variable instead ofargs[0]
in theImportPrivKeyHex
call improves code readability.The changes are logically sound and enhance the functionality of the command.
client/keys/import_test.go (2)
85-88
: LGTM!The changes simplify the setup and cleanup of the temporary keybase directory for each test case. Using
os.MkdirAll
directly without checking for existence first is a cleaner approach. Applying the cleanup function consistently witht.Cleanup
ensures proper removal of the directory after each test case.
135-141
: Excellent addition of the new test case and cleanup improvements!The new test case for reading the hex key from standard input enhances the flexibility and coverage of the test suite. The use of the
stdInput
flag to conditionally set the command arguments is a clean approach.Also, applying the cleanup function consistently with
t.Cleanup
for removing the temporary keybase directory is a good improvement.Also applies to: 152-155, 166-173
CHANGELOG.md (3)
49-49
: The new--output
flag fortx
CLI commands is a useful additionAllowing JSON output for
tx
CLI commands with the new--output
flag will make it easier to integrate the CLI with scripts and tools that consume JSON. Nice improvement!
Line range hint
8-46
: The v0.46.0 release notes are quite thoroughThe release notes for v0.46.0 are very comprehensive, covering breaking changes, new features, bug fixes and improvements across many areas of the SDK. Excellent work on putting together such detailed release notes - this will really help users understand all the changes in this release and how to upgrade.
Some additional suggestions to consider:
- Adding a high-level summary at the top of the major themes or focus areas for this release
- Providing links to documentation or other resources with more details on some of the major changes
- Including any steps or guidance for upgrading from the previous major version (v0.45.x)
But overall, the level of detail and organization here is great!
Line range hint
8-11
: Verify if the security fix for non-Cosmos Hub chains is still relevantThis changelog entry mentions an important security fix for non-Cosmos Hub chains running Stargate versions of the SDK. However, it's not clear if this is still an issue that operators need to be aware of when upgrading to v0.46.0.
To verify, we can search the codebase for the original issue and fix to see if it's still present in v0.46.0:
If the searches don't turn up the original issue and affected version logic, we can likely remove this item as it's no longer relevant. If they are still present, the entry should be updated to clearly state if this remains an issue in v0.46.0.
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.
Nice one!!
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
New Features
Bug Fixes
Tests