-
Notifications
You must be signed in to change notification settings - Fork 18
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
delete CHAIN_TYPE prefix from batch info chain type #128
Conversation
WalkthroughThis pull request includes significant changes to the Changes
Possibly related PRs
Suggested reviewers
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
CodeRabbit Configuration File (
|
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #128 +/- ##
==========================================
- Coverage 49.43% 49.41% -0.03%
==========================================
Files 57 57
Lines 4262 4256 -6
==========================================
- Hits 2107 2103 -4
+ Misses 1722 1720 -2
Partials 433 433
|
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 (2)
x/ophost/keeper/bridge_test.go (1)
20-20
: LGTM! Consider adding negative test cases.The enum value updates from
BatchInfo_CHAIN_TYPE_INITIA
toBatchInfo_INITIA
are consistent across all test cases.Consider adding test cases to verify handling of invalid chain types to ensure proper validation:
func Test_InvalidBridgeConfig(t *testing.T) { ctx, input := createDefaultTestInput(t) config := types.BridgeConfig{ // ... other fields ... BatchInfo: types.BatchInfo{ Submitter: addrsStr[0], ChainType: types.BatchInfo_UNSPECIFIED, // or invalid value }, } err := input.OPHostKeeper.SetBridgeConfig(ctx, 1, config) require.Error(t, err) require.Contains(t, err.Error(), "invalid chain type") }Also applies to: 37-37, 46-46
x/ophost/keeper/querier_test.go (1)
22-22
: LGTM! Consider adding edge case tests.The BatchInfo.ChainType enum value changes are consistently applied across all query tests. While the current coverage is good, consider adding edge cases:
- Invalid chain type values
- Chain type conversion errors
- Empty/nil chain type handling
Also applies to: 49-49, 58-58, 192-192, 268-268, 274-274
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
x/ophost/types/types.pb.go
is excluded by!**/*.pb.go
📒 Files selected for processing (18)
api/opinit/ophost/v1/types.pulsar.go
(3 hunks)contrib/launchtools/config.go
(1 hunks)contrib/launchtools/config_test.go
(1 hunks)contrib/launchtools/utils/address.go
(1 hunks)proto/opinit/ophost/v1/types.proto
(1 hunks)x/opchild/keeper/genesis_test.go
(1 hunks)x/opchild/keeper/msg_server_test.go
(2 hunks)x/opchild/keeper/querier_test.go
(1 hunks)x/ophost/keeper/batch_info_test.go
(5 hunks)x/ophost/keeper/bridge_test.go
(3 hunks)x/ophost/keeper/genesis_test.go
(6 hunks)x/ophost/keeper/msg_server.go
(2 hunks)x/ophost/keeper/msg_server_test.go
(11 hunks)x/ophost/keeper/output_test.go
(3 hunks)x/ophost/keeper/querier_test.go
(5 hunks)x/ophost/types/bridge_config.go
(4 hunks)x/ophost/types/bridge_config_test.go
(3 hunks)x/ophost/types/tx.go
(1 hunks)
✅ Files skipped from review due to trivial changes (1)
- x/ophost/keeper/msg_server.go
🔇 Additional comments (17)
contrib/launchtools/config_test.go (1)
20-20
: LGTM! Verify other enum usages.
The enum value update from BatchInfo_CHAIN_TYPE_CELESTIA
to BatchInfo_CELESTIA
is consistent with the PR objective.
Let's verify that all enum usages have been updated consistently:
✅ Verification successful
All enum usages have been updated correctly
The search results confirm that all usages of the BatchInfo enum are using the new CELESTIA
value without the CHAIN_TYPE_
prefix. This includes:
- Proto-generated code in
types.pb.go
- Test files across different packages
- Configuration and utility code
- API definitions
No instances of the old CHAIN_TYPE_CELESTIA
enum value were found, indicating the update has been applied consistently throughout the codebase.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Search for any remaining CHAIN_TYPE prefixes in enum values
rg -i "CHAIN_TYPE_" --type go
Length of output: 29
Script:
#!/bin/bash
# Let's first find all files that might contain BatchInfo enum definitions or usages
rg -l "BatchInfo" --type go
# Then let's look for any enum values with CELESTIA to see the context
rg "CELESTIA" --type go
Length of output: 3684
x/opchild/keeper/genesis_test.go (1)
44-44
: LGTM! Genesis state handling is preserved.
The enum value update from BatchInfo_CHAIN_TYPE_INITIA
to BatchInfo_INITIA
is consistent with the PR objective and the genesis state handling remains correct.
contrib/launchtools/utils/address.go (1)
50-52
: LGTM! Enum values correctly updated
The switch cases have been properly updated to use the new enum values without the "CHAIN_TYPE_" prefix, maintaining the same functionality.
x/ophost/keeper/batch_info_test.go (1)
15-15
: LGTM! Test cases properly updated
All BatchInfo struct initializations have been consistently updated to use the new enum values without the "CHAIN_TYPE_" prefix. The test cases maintain their original functionality and coverage.
Also applies to: 28-28, 41-41, 54-54, 67-67
x/ophost/types/bridge_config.go (2)
22-22
: LGTM! Validation logic properly updated
The validation methods have been correctly updated to use the new enum value BatchInfo_UNSPECIFIED
. The additional validation for chain type values remains intact.
Also applies to: 54-57
81-81
: LGTM! JSON handling simplified
The JSON marshaling and unmarshaling have been streamlined:
- Using standard String() method for marshaling
- Simplified unmarshaling by directly using the uppercase string value
Also applies to: 92-97
proto/opinit/ophost/v1/types.proto (1)
70-74
: LGTM! Enum values simplified for better readability
The removal of the "CHAIN_TYPE_" prefix from enum values improves code clarity while maintaining the same functionality. The numeric values and descriptions remain unchanged.
x/ophost/types/bridge_config_test.go (1)
23-23
: LGTM! Test cases updated consistently
All references to chain type enums have been updated to use the new simplified names while maintaining the same test coverage and validation logic.
Also applies to: 44-44, 51-51, 84-84
x/opchild/keeper/querier_test.go (1)
63-63
: LGTM! Chain type reference updated consistently
The enum reference has been updated to use the new simplified name while maintaining the same test functionality.
x/ophost/keeper/output_test.go (1)
93-93
: LGTM! Verify enum usage consistency.
The BatchInfo.ChainType enum value changes are consistent across all test functions, maintaining test coverage and correctness.
Also applies to: 152-152, 199-199
✅ Verification successful
Enum usage is consistent across the codebase
The verification confirms that:
- No instances of old enum values (
BatchInfo_CHAIN_TYPE_
) were found - The new enum value (
BatchInfo_INITIA
) is consistently used across all relevant files:- Test files in x/ophost module
- Generated protobuf files
- Child module (x/opchild) references
- Launch tools configuration
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify consistent usage of new enum values across the codebase
# Expect: Only new enum values (BatchInfo_INITIA) should be found, no old values (BatchInfo_CHAIN_TYPE_INITIA)
# Check for any remaining old enum values
rg "BatchInfo_CHAIN_TYPE_"
# Verify consistent usage of new enum values
rg "BatchInfo_INITIA"
Length of output: 5284
x/ophost/keeper/genesis_test.go (1)
22-22
: LGTM! Genesis state handling remains intact.
The BatchInfo.ChainType enum value changes are consistently applied across genesis export and import/export tests. The tests continue to verify correct state handling with both INITIA and CELESTIA chain types.
Also applies to: 31-31, 70-72, 103-105, 170-172
✅ Verification successful
LGTM! The BatchInfo.ChainType changes are consistently tested
The verification shows comprehensive test coverage for both BatchInfo_INITIA
and BatchInfo_CELESTIA
chain types across multiple test files:
- Genesis tests properly verify state import/export with both chain types
- Message server tests cover chain type updates and validations
- Bridge configuration tests include both chain types
- Batch info tests verify handling of both chain types
- Test coverage spans across different packages (ophost, opchild)
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Description: Verify test coverage for genesis state handling
# Expect: Test cases should cover both chain types
# Check test coverage for both chain types
rg -B 2 -A 2 "BatchInfo_INITIA|BatchInfo_CELESTIA" --type go
Length of output: 19356
x/ophost/types/tx.go (1)
374-374
: LGTM: Enum value renamed correctly
The change from BatchInfo_CHAIN_TYPE_UNSPECIFIED
to BatchInfo_UNSPECIFIED
is consistent with the PR objective of removing the CHAIN_TYPE
prefix while maintaining the same validation logic.
contrib/launchtools/config.go (1)
140-149
: LGTM: Enum values renamed consistently
The changes align with the PR objective of removing the CHAIN_TYPE
prefix:
BatchInfo_UNSPECIFIED
for unspecified chain typeBatchInfo_CELESTIA
for Celestia chain typeBatchInfo_INITIA
for Initia chain type
The interactive prompt logic remains unchanged.
x/ophost/keeper/msg_server_test.go (1)
42-42
: LGTM: Test cases updated consistently
All test cases have been updated to use the new enum values without the CHAIN_TYPE
prefix. The changes maintain the same test coverage and functionality while using the simplified enum names.
Also applies to: 67-67, 105-105, 168-168, 196-196, 268-268, 318-318, 368-368, 380-380, 393-393, 400-400, 408-408, 430-430, 475-475
x/opchild/keeper/msg_server_test.go (2)
295-297
: LGTM! Enum value correctly updated
The change from BatchInfo_CHAIN_TYPE_INITIA
to BatchInfo_INITIA
aligns with the simplified enum naming convention while maintaining the same functionality.
347-349
: LGTM! Enum value correctly updated
The change from BatchInfo_CHAIN_TYPE_INITIA
to BatchInfo_INITIA
is consistent with the simplified enum naming convention.
api/opinit/ophost/v1/types.pulsar.go (1)
3485-3489
: LGTM! Enum values consistently renamed
The BatchInfo_ChainType enum values have been simplified by removing the redundant "CHAIN_TYPE_" prefix. The changes are consistent across all definitions and references, including:
- Enum value definitions
- Name/value mapping tables
- Default value reference
This improves code readability while maintaining the same functionality.
Also applies to: 3495-3502, 3714-3714
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.
LGTM, but good to test this update does not affect any client programs like initia.js or launch cmd or weavecli before merging this.
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 have checked, it does not affect to client side.
Summary by CodeRabbit
New Features
BatchInfo
chain types to enhance clarity and consistency.Bug Fixes
ChainType
in various message structures to reflect new naming conventions.Tests
BatchInfo
chain type constants, ensuring consistency across the test suite.Chores
BatchInfo_ChainType
, removing unnecessary complexity.