-
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(stf/appmanager): remove the need of recurseStateChanges
#20911
Conversation
WalkthroughWalkthroughThe changes primarily involve minor modifications such as formatting tweaks, comment adjustments, and type updates. Significant adjustments include changing the types in 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 (
|
Not writing the state changes on graph LR;
a-->b
a-->c
b-->d
Before: calling I don't think we use branching in v2 with that expectation (this PR corrects that) but a consumer of the library might. Does anyone else have an opinion on this? @julienrbrt @tac0turtle |
I agree @kocubinski that your solution is more correct, but I feel that:
|
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)
server/v2/appmanager/appmanager_builder.go (1)
11-11
: Update the import path or type definition forStore
.The type of
DB
has been changed fromstore.Store
toStore
, but the import path forStore
is not updated. Ensure thatStore
is correctly defined or imported.
server/v2/appmanager/appmanager_builder.go
Analysis chain
Update the import path or type definition for
Store
.The type of
DB
has been changed fromstore.Store
toStore
, but the import path forStore
is not updated. Ensure thatStore
is correctly defined or imported.Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Verify the definition or import of `Store`. # Test: Search for `Store` definition or import. Expect: Correct import or definition. rg --type go --pattern 'type Store' --files-with-matchesLength of output: 470
Script:
#!/bin/bash # Verify the definition or import of `Store`. # Test: Search for `Store` type definitions. rg 'type Store' --type go -A 2 # Test: Search for `Store` import statements. rg 'import.*Store' --type go -A 2Length of output: 7871
Script:
#!/bin/bash # Verify the import of `Store` in appmanager_builder.go. # Test: Search for import statements in appmanager_builder.go. rg '^import' -A 5 server/v2/appmanager/appmanager_builder.goLength of output: 299
Review details
Configuration used: .coderabbit.yml
Review profile: CHILL
Files selected for processing (9)
- server/grpc/gogoreflection/serverreflection.go (1 hunks)
- server/v2/api/grpc/gogoreflection/serverreflection.go (1 hunks)
- server/v2/appmanager/appmanager.go (3 hunks)
- server/v2/appmanager/appmanager_builder.go (1 hunks)
- server/v2/stf/branch/writer_map.go (1 hunks)
- x/accounts/defaults/lockup/continuous_locking_account_test.go (1 hunks)
- x/accounts/defaults/lockup/delayed_locking_account_test.go (1 hunks)
- x/accounts/defaults/lockup/periodic_locking_account_test.go (1 hunks)
- x/accounts/defaults/lockup/permanent_locking_account_test.go (1 hunks)
Files skipped from review due to trivial changes (5)
- server/v2/api/grpc/gogoreflection/serverreflection.go
- x/accounts/defaults/lockup/continuous_locking_account_test.go
- x/accounts/defaults/lockup/delayed_locking_account_test.go
- x/accounts/defaults/lockup/periodic_locking_account_test.go
- x/accounts/defaults/lockup/permanent_locking_account_test.go
Additional context used
Path-based instructions (4)
server/v2/appmanager/appmanager_builder.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.server/v2/stf/branch/writer_map.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.server/v2/appmanager/appmanager.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.server/grpc/gogoreflection/serverreflection.go (1)
Pattern
**/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
golangci-lint
server/grpc/gogoreflection/serverreflection.go
474-474: 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 (3)
server/v2/stf/branch/writer_map.go (1)
56-71
: Verify the correctness ofGetStateChanges
method after refactoring.The method is simplified by removing the recursive
recurseStateChanges
method and directly iterating overbranchedWriterState
. Verify that this change does not alter the intended behavior of the method.Verification successful
The
GetStateChanges
method after refactoring is correctly implemented.
- The method iterates over
branchedWriterState
and collects state changes.- The logic for error handling and state change collection aligns with the intended behavior.
The refactoring maintains the method's functionality while simplifying the code by removing the recursive
recurseStateChanges
method.
Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Verify the correctness of `GetStateChanges` method after refactoring. # Test: Ensure that the new implementation is correct and does not alter the intended behavior. rg --type go --pattern 'GetStateChanges' --context 10Length of output: 465
Script:
#!/bin/bash # Verify the correctness of `GetStateChanges` method after refactoring. # Test: Ensure that the new implementation is correct and does not alter the intended behavior. rg 'func (b WriterMap) GetStateChanges' -A 10Length of output: 47
Script:
#!/bin/bash # Verify the correctness of `GetStateChanges` method after refactoring. # Test: Ensure that the new implementation is correct and does not alter the intended behavior. rg 'GetStateChanges' -A 20Length of output: 7974
server/v2/appmanager/appmanager.go (2)
30-30
: Update the import path or type definition forStore
.The type of
db
has been changed fromstore.Store
toStore
, but the import path forStore
is not updated. Ensure thatStore
is correctly defined or imported.
Line range hint
53-87
:
Verify the correctness ofInitGenesis
method after refactoring.The method's logic involves initializing the genesis state and handling state changes. Ensure that the refactoring does not introduce any errors or change the intended behavior.
@@ -471,3 +471,4 @@ func (s *serverReflectionServer) ServerReflectionInfo(stream rpb.ServerReflectio | |||
} | |||
} | |||
} | |||
|
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.
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.
The file is not formatted according to the specified gci
rules. Ensure that the file is correctly formatted.
+ // Add an empty line to format the file according to `gci` rules.
Committable suggestion was skipped due to low confidence.
Tools
golangci-lint
474-474: 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)
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.
@testinginprod SGTM, it does simplify the API. Also I don't think WriterMap.ApplyStateChanges
was available when I implemented the recursive approach initially, which does indeed remove the need for it.
seems this broke something in system tests, not exactly sure how |
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
Bug Fixes
Refactor
Chores