-
Notifications
You must be signed in to change notification settings - Fork 161
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(uibc): handle params.ics20_hooks switch #2461
Conversation
This reverts commit ceb0aa7.
WalkthroughThe updates introduce a new feature for toggling ICS20 hooks, enabling enhanced control over inter-blockchain communication. This includes the addition of a 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 Configration 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.
Pre Approving
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.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files ignored due to path filters (4)
swagger/swagger.yaml
is excluded by:!**/*.yaml
x/uibc/events.pb.go
is excluded by:!**/*.pb.go
x/uibc/quota.pb.go
is excluded by:!**/*.pb.go
x/uibc/tx.pb.go
is excluded by:!**/*.pb.go
Files selected for processing (12)
- proto/umee/uibc/v1/events.proto (1 hunks)
- proto/umee/uibc/v1/quota.proto (1 hunks)
- proto/umee/uibc/v1/tx.proto (2 hunks)
- tests/tcheckers/error.go (1 hunks)
- x/uibc/gmp/gmp_middleware.go (1 hunks)
- x/uibc/msg.go (2 hunks)
- x/uibc/msg_test.go (3 hunks)
- x/uibc/quota/msg_server.go (1 hunks)
- x/uibc/quota/params.go (1 hunks)
- x/uibc/uics20/ibc_module.go (1 hunks)
- x/uibc/uics20/memo_handler.go (3 hunks)
- x/uibc/uics20/memo_handler_test.go (2 hunks)
Additional comments: 17
tests/tcheckers/error.go (1)
- 9-14: The implementation of
ErrorContains
is correct and follows good practices for error checking in tests. Utilizinggotest.tools/v3/assert
for assertions is appropriate, and includingtestName
in the assertion messages enhances test readability and debuggability.proto/umee/uibc/v1/events.proto (1)
- 23-26: The
EventICS20Hooks
message is well-defined and follows protobuf best practices. The use of a boolean field to indicate the status of ICS20 hooks is appropriate for the intended functionality.x/uibc/gmp/gmp_middleware.go (1)
- 18-20: The early return in the
OnRecvPacket
method whenmemo
is empty is a good performance optimization. It correctly handles an edge case and follows Go's best practices for such checks.x/uibc/quota/params.go (1)
- 74-76: The implementation of
SetICS20HooksStatus
correctly updates theIcs20Hooks
status in the module parameters. The use ofGetParams
andSetParams
ensures atomic and consistent updates.x/uibc/quota/msg_server.go (1)
- 66-85: The
GovToggleICS20Hooks
function is correctly implemented, following best practices for message handling in blockchain modules. It properly checks for authority, updates the ICS20 hooks status, and emits an event to ensure transparency and traceability.proto/umee/uibc/v1/quota.proto (1)
- 51-52: The addition of the
ics20_hooks
field to theParams
message is well-defined and follows protobuf best practices. The use of a boolean type for this field is appropriate for representing the binary status of ICS20 hooks.x/uibc/msg.go (1)
- 92-118: The
MsgGovToggleICS20Hooks
message and its associated methods are correctly implemented, following the established patterns for messages in the Cosmos SDK. The validation, signer retrieval, and legacy message type implementations are appropriately handled.x/uibc/msg_test.go (1)
- 7-9: The refactoring to use
tcheckers.ErrorContains
for error validation and the addition of theTestMsgGovToggleICS20Hooks
function are well-implemented. These changes enhance the readability and maintainability of the test code, and the new test function adequately covers the functionality of theMsgGovToggleICS20Hooks
message.Also applies to: 76-76, 123-124, 127-172
proto/umee/uibc/v1/tx.proto (3)
- 24-25: The addition of the
GovToggleICS20Hooks
RPC is correctly implemented and follows the protobuf conventions. Good job on maintaining consistency with the existing RPC definitions.- 109-124: The definition of
MsgGovToggleICS20Hooks
is well-structured and follows the conventions used throughout the protobuf file. The use of options and field annotations is consistent and appropriate.- 126-127: The
MsgGovToggleICS20HooksResponse
message type is correctly defined and follows the conventions for response message types in protobuf. It's good practice to have explicit response types even when they don't contain any fields.x/uibc/uics20/memo_handler.go (3)
- 19-26: The addition of specific error messages enhances the clarity and debuggability of the code. It's good practice to have clear, descriptive error messages for different failure conditions.
- 32-32: The addition of the
executeEnabled
field to theMemoHandler
struct is a practical approach for controlling the execution based on the ICS20 hooks status. This allows for flexible configuration and enhances the modularity of the code.- 102-104: The conditional execution logic in the
execute
method, based on theexecuteEnabled
field, is correctly implemented. This approach provides flexibility and ensures that execution only occurs when enabled, enhancing the security and configurability of the system.x/uibc/uics20/memo_handler_test.go (2)
- 6-6: The addition of the
storetypes
import is appropriate for the unit tests that require a context with a memory store. This is a common pattern in Go testing, especially for testing components that interact with the store.- 165-192: The
TestMemoExecute
function is a well-structured and comprehensive test for theMemoHandler
'sexecute
method, covering various scenarios based on theexecuteEnabled
andisGMP
fields. This addition significantly enhances the test coverage and ensures the functionality behaves as expected under different configurations.x/uibc/uics20/ibc_module.go (1)
- 66-73: The initialization of the
MemoHandler
struct with theexecuteEnabled
parameter based on theparams.Ics20Hooks
value is correctly implemented. This change ensures that theMemoHandler
can conditionally execute based on the ICS20 hooks status, aligning with the overall goal of enhancing governance and flexibility in cross-chain interactions.
Co-authored-by: Sai Kumar <17549398+gsk967@users.noreply.github.com>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2461 +/- ##
==========================================
- Coverage 75.38% 68.94% -6.45%
==========================================
Files 100 184 +84
Lines 8025 10858 +2833
==========================================
+ Hits 6050 7486 +1436
- Misses 1589 2761 +1172
- Partials 386 611 +225
|
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.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (2)
- CHANGELOG.md (1 hunks)
- x/uibc/uics20/memo_handler.go (3 hunks)
Files skipped from review as they are similar to previous changes (1)
- x/uibc/uics20/memo_handler.go
Additional comments: 1
CHANGELOG.md (1)
- 51-51: The changelog entry accurately reflects the addition of functionality to handle the
params.ics20_hooks
switch in the UIBC module. Well-documented and clear.
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.
Review Status
Actionable comments generated: 0
Configuration used: CodeRabbit UI
Files selected for processing (1)
- x/uibc/uics20/memo_handler_test.go (2 hunks)
Files skipped from review as they are similar to previous changes (1)
- x/uibc/uics20/memo_handler_test.go
Description
Summary by CodeRabbit
New Features
Enhancements
Params
message to include a new field for ICS20 hooks status.Tests