-
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
chore: remove todo: "abstract out staking message back to staking" #21266
chore: remove todo: "abstract out staking message back to staking" #21266
Conversation
WalkthroughWalkthroughThe recent changes enhance transaction handling and message processing within the codebase. A new interface 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 (
|
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 (3)
- types/tx_msg.go (1 hunks)
- x/genutil/collect.go (2 hunks)
- x/staking/types/msg.go (1 hunks)
Additional context used
Path-based instructions (3)
x/genutil/collect.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.types/tx_msg.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.x/staking/types/msg.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
Additional comments not posted (3)
x/genutil/collect.go (1)
122-125
: Verify all messages implementsdk.MsgWithMoniker
.The code assumes that all messages in the transaction implement the
sdk.MsgWithMoniker
interface. Ensure that this assumption holds true, as a failed type assertion will cause a runtime panic.types/tx_msg.go (1)
83-87
: Addition ofMsgWithMoniker
interface is approved.The new interface
MsgWithMoniker
extendsMsg
with aGetMoniker()
method, providing a useful abstraction for messages that include a moniker.x/staking/types/msg.go (1)
93-96
: Addition ofGetMoniker
method is approved.The new
GetMoniker
method inMsgCreateValidator
provides direct access to the validator's moniker, enhancing its utility and aligning with theMsgWithMoniker
interface.
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
Outside diff range, codebase verification and nitpick comments (1)
types/tx_msg.go (1)
83-83
: File is notgci
-ed.The file is not formatted with
gci
, which is a tool for sorting and formatting imports according to the specified order.Consider running
gci
to format the imports.# Example command to format imports gci write --skip-generated -s standard -s default -s prefix(cosmossdk.io) -s prefix(github.com/cosmos/cosmos-sdk) types/tx_msg.go
Tools
golangci-lint
83-83: File is not
gci
-ed with --skip-generated -s standard -s default -s prefix(cosmossdk.io) -s prefix(github.com/cosmos/cosmos-sdk) --custom-order(gci)
Review details
Configuration used: .coderabbit.yml
Review profile: CHILL
Files selected for processing (2)
- types/tx_msg.go (1 hunks)
- x/genutil/collect.go (3 hunks)
Additional context used
Path-based instructions (2)
x/genutil/collect.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.types/tx_msg.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
golangci-lint
types/tx_msg.go
83-83: File is not
gci
-ed with --skip-generated -s standard -s default -s prefix(cosmossdk.io) -s prefix(github.com/cosmos/cosmos-sdk) --custom-order(gci)
Additional comments not posted (2)
x/genutil/collect.go (1)
122-125
: Ensure type assertion safety.The type assertion
msg := msgs[0].(MsgWithMoniker)
assumes that every message inmsgs
implementsMsgWithMoniker
. This could lead to a runtime panic if the assumption is incorrect.Consider adding a type assertion check to handle cases where the assertion might fail.
- msg := msgs[0].(MsgWithMoniker) + msg, ok := msgs[0].(MsgWithMoniker) + if !ok { + return appGenTxs, persistentPeers, fmt.Errorf("expected MsgWithMoniker, got %T", msgs[0]) + }types/tx_msg.go (1)
Line range hint
83-91
:
Ensure interface consistency.The
TxWithTimeoutTimeStamp
interface introduces a methodGetTimeoutTimeStamp()
. Ensure that all implementations of this interface are updated to include this method.Check if there are existing implementations of the
Tx
interface that need to be updated.Tools
golangci-lint
83-83: File is not
gci
-ed with --skip-generated -s standard -s default -s prefix(cosmossdk.io) -s prefix(github.com/cosmos/cosmos-sdk) --custom-order(gci)
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
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.yml
Review profile: CHILL
Files selected for processing (1)
- x/genutil/collect.go (3 hunks)
Additional context used
Path-based instructions (1)
x/genutil/collect.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
Additional comments not posted (1)
x/genutil/collect.go (1)
136-139
: Adherence to best practices: Unexported interface.The
msgWithMoniker
interface is unexported, aligning with best practices for encapsulation when the interface is only used within this package.
@coderabbitai review |
Actions performedReview triggered.
|
Note Currently processing new changes in this PR. This may take a few minutes, please wait... Files selected for processing (3)
Tip CodeRabbit can enforce grammar and style rules using `languagetool`.Configure 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 (
|
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, codebase verification and nitpick comments (1)
types/tx_msg.go (1)
83-83
: LGTM! InterfaceTxWithTimeoutTimeStamp
is correctly defined.The
TxWithTimeoutTimeStamp
interface extends theTx
interface with a timeout timestamp capability, enhancing transaction management.Consider ordering imports according to
gci
standards.The static analysis tool suggests the file is not ordered according to
gci
standards. Consider usinggci
to order the imports.# Command to order imports using gci gci -w --skip-generated -s standard -s default -s prefix(cosmossdk.io) -s prefix(github.com/cosmos/cosmos-sdk) types/tx_msg.go
Tools
golangci-lint
83-83: File is not
gci
-ed with --skip-generated -s standard -s default -s prefix(cosmossdk.io) -s prefix(github.com/cosmos/cosmos-sdk) --custom-order(gci)
Review details
Configuration used: .coderabbit.yml
Review profile: CHILL
Files selected for processing (3)
- types/tx_msg.go (1 hunks)
- x/genutil/collect.go (3 hunks)
- x/staking/types/msg.go (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- x/staking/types/msg.go
Additional context used
Path-based instructions (2)
x/genutil/collect.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.types/tx_msg.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
golangci-lint
types/tx_msg.go
83-83: File is not
gci
-ed with --skip-generated -s standard -s default -s prefix(cosmossdk.io) -s prefix(github.com/cosmos/cosmos-sdk) --custom-order(gci)
Additional comments not posted (2)
x/genutil/collect.go (2)
122-125
: LGTM! Type assertion with a check is used correctly.The type assertion for
msgWithMoniker
is handled properly, preventing potential runtime panics.
138-141
: LGTM! InterfacemsgWithMoniker
is correctly defined and unexported.The
msgWithMoniker
interface is properly defined with theGetMoniker()
method and is unexported as suggested in previous reviews.
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.
Great! Thanks!
You'll need to run make lint-fix
.
* main: (76 commits) docs: more app v2 renaming (#21336) chore: update link in disclaimer (#21339) refactor(x/distribution): audit QA (#21316) docs: rename app v2 to app di when talking about runtime v0 (#21329) feat(schema): specify JSON mapping (#21243) fix(x/authz): bring back msg response in `DispatchActions` (#21044) chore: fix all lint issue since golangci-lint bump (#21326) refactor(x/mint): v0.52 audit x/mint (#21301) chore: fix spelling errors (#21327) feat: export genesis in simapp v2 (#21199) fix(baseapp)!: Halt at height now does not produce the halt height block (#21256) refactor(scripts): remove unused variable (#21320) chore(schema/testing): upgrade to go 1.23 iterators (#21282) chore: readmes + upgrading docs (#21271) feat(client): add auto cli for node service (#21074) ci: fix github workflow vulnerable to script injection (#21304) build(deps): Bump github.com/prometheus/client_golang from 1.19.1 to 1.20.0 (#21307) build(deps): use Go 1.23 instead of Go 1.22 (#21280) refactor(x/auth): audit x/auth changes (#21146) chore: remove todo: "abstract out staking message back to staking" (#21266) ...
Description
this pr removes a todo on CollectTx. It abstract out staking message back to staking
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