-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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(indexer): add to modules and implement proto fields #22544
Conversation
📝 Walkthrough📝 WalkthroughWalkthroughThe pull request introduces several updates across multiple files, primarily focusing on enhancing error handling, updating dependencies, and implementing new functionalities related to codec and schema management. Key changes include improved error handling in Changes
Sequence Diagram(s)sequenceDiagram
participant A as Application
participant B as Streaming Manager
participant C as Listener
A->>C: Start Listener
C->>A: Execute Listener
alt Error Occurs
C->>B: Check StopNodeOnErr
alt StopNodeOnErr is true
B->>A: Shutdown Application
end
else No Error
A->>C: Continue Processing
end
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
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.
Looks like a good direction generally
collections/codec/indexing.go
Outdated
@@ -77,7 +77,9 @@ func FallbackSchemaCodec[T any]() SchemaCodec[T] { | |||
Kind: kind, | |||
}}, | |||
// these can be nil because T maps directly to a schema value for this kind | |||
ToSchemaType: nil, | |||
ToSchemaType: func(t T) (any, error) { |
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.
Instead can we just have the nil
case be handled properly?
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.
Done, it was already there for keys
if c.Name == "" { | ||
return fmt.Errorf("field name cannot be empty, might be missing the named key codec") | ||
} | ||
|
||
if !ValidateName(c.Name) { |
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.
Does ValidateName not handle this case?
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.
Yes, it does handle it but I thought it was nice to have a more descriptive error for the empty case which would be the most common while implementing
The linter is ignoring |
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 two comments on the error handling in baseapp but approving already
Additionally, could you do the follow-up PR about the replace removal?
app.logger.Error("ListenFinalizeBlock listening hook failed", "height", req.Height, "err", err) | ||
if app.streamingManager.StopNodeOnErr { | ||
// if StopNodeOnErr is set, we should return the streamErr in order to stop the node | ||
err = streamErr |
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.
doesn't this get override line 937? Shouldn't we return the error as the comment says?
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.
This is inside a defer, so it will replace the one we are returning
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 see yeah, so I suppose we should join it too right?
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)
tests/integration/v2/services.go (3)
131-131
: Consider adding documentation for BranchServiceThe
BranchService
struct would benefit from godoc comments explaining its purpose in integration tests and any specific behaviors or requirements.Add documentation like:
+// BranchService is a custom implementation of branch.Service for integration tests. +// It provides execution isolation and gas metering capabilities. type BranchService struct{}
Line range hint
132-190
: Consider thread safety and error handling improvementsA few suggestions to enhance the router implementation:
- The
handlers
map is not thread-safe. Consider using sync.Map or adding mutex protection if concurrent access is possible.- Consider adding a method to unregister handlers to prevent memory leaks.
- The error messages in
CanInvoke
andInvoke
are duplicated.Here's a suggested improvement:
type RouterService struct { + sync.RWMutex handlers map[string]routerHandler } +var errNoHandler = func(typeUrl string) error { + return fmt.Errorf("no handler for typeURL %s", typeUrl) +} func (rs *RouterService) RegisterHandler(handler routerHandler, typeUrl string) { + rs.Lock() + defer rs.Unlock() rs.handlers[typeUrl] = handler } +func (rs *RouterService) UnregisterHandler(typeUrl string) { + rs.Lock() + defer rs.Unlock() + delete(rs.handlers, typeUrl) +} func (rs RouterService) CanInvoke(ctx context.Context, typeUrl string) error { + rs.RLock() + defer rs.RUnlock() if rs.handlers[typeUrl] == nil { - return fmt.Errorf("no handler for typeURL %s", typeUrl) + return errNoHandler(typeUrl) } return nil }
Missing test coverage for RouterService implementation
The RouterService implementation lacks dedicated test coverage. While the service is used in the test setup (
auth/app_test.go
), there are no direct tests that verify:
- Handler registration functionality
- CanInvoke method behavior
- Error handling for missing handlers
- Invoke method functionality
Required test cases:
- Test handler registration and retrieval
- Test CanInvoke with registered and unregistered handlers
- Test Invoke with valid and invalid message types
- Test error scenarios
🔗 Analysis chain
Line range hint
132-190
: Verify test coverage for RouterServiceSince this is in the integration test package, we should ensure comprehensive test coverage for the RouterService implementation.
Let me check the actual test coverage by examining the test file content.
Let me check for actual test cases that exercise the RouterService functionality.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Check for test files covering RouterService rg -l "RouterService" tests/integration/v2/ | grep "_test.go" # Check for specific test coverage ast-grep --pattern 'func Test$_($_, $_) { $$$ RouterService $$$ }'Length of output: 172
Script:
#!/bin/bash # Check the content of the test file that mentions RouterService cat tests/integration/v2/auth/app_test.go # Search for any other tests that might use RouterService rg -A 5 "RouterService" tests/integration/v2/Length of output: 9603
Script:
#!/bin/bash # Look for test functions in auth/app_test.go that might exercise RouterService rg -A 10 "func Test" tests/integration/v2/auth/app_test.go # Look for actual usage of bank send handler and query handler rg -A 5 "MsgSend|AccountNumberRequest" tests/integration/v2/auth/app_test.goLength of output: 908
📜 Review details
Configuration used: .coderabbit.yml
Review profile: CHILL
⛔ Files ignored due to path filters (12)
server/v2/cometbft/go.sum
is excluded by!**/*.sum
simapp/go.sum
is excluded by!**/*.sum
x/circuit/go.sum
is excluded by!**/*.sum
x/consensus/go.sum
is excluded by!**/*.sum
x/epochs/go.sum
is excluded by!**/*.sum
x/evidence/go.sum
is excluded by!**/*.sum
x/mint/go.sum
is excluded by!**/*.sum
x/nft/go.sum
is excluded by!**/*.sum
x/params/go.sum
is excluded by!**/*.sum
x/protocolpool/go.sum
is excluded by!**/*.sum
x/slashing/go.sum
is excluded by!**/*.sum
x/upgrade/go.sum
is excluded by!**/*.sum
📒 Files selected for processing (31)
client/v2/go.mod
(1 hunks)collections/CHANGELOG.md
(1 hunks)go.mod
(1 hunks)server/v2/cometbft/go.mod
(1 hunks)simapp/go.mod
(2 hunks)simapp/v2/go.mod
(1 hunks)tests/go.mod
(1 hunks)tests/integration/v2/auth/app_test.go
(1 hunks)tests/integration/v2/services.go
(1 hunks)x/accounts/defaults/base/go.mod
(1 hunks)x/accounts/defaults/lockup/go.mod
(1 hunks)x/accounts/defaults/multisig/go.mod
(1 hunks)x/accounts/go.mod
(1 hunks)x/authz/go.mod
(1 hunks)x/bank/go.mod
(1 hunks)x/circuit/go.mod
(3 hunks)x/consensus/go.mod
(2 hunks)x/distribution/go.mod
(2 hunks)x/distribution/keeper/keeper.go
(2 hunks)x/epochs/go.mod
(3 hunks)x/evidence/go.mod
(2 hunks)x/feegrant/go.mod
(1 hunks)x/gov/go.mod
(1 hunks)x/group/go.mod
(1 hunks)x/mint/go.mod
(3 hunks)x/nft/go.mod
(2 hunks)x/params/go.mod
(2 hunks)x/protocolpool/go.mod
(2 hunks)x/slashing/go.mod
(2 hunks)x/staking/go.mod
(2 hunks)x/upgrade/go.mod
(2 hunks)
✅ Files skipped from review due to trivial changes (1)
- tests/integration/v2/auth/app_test.go
🚧 Files skipped from review as they are similar to previous changes (29)
- client/v2/go.mod
- collections/CHANGELOG.md
- go.mod
- server/v2/cometbft/go.mod
- simapp/go.mod
- simapp/v2/go.mod
- tests/go.mod
- x/accounts/defaults/base/go.mod
- x/accounts/defaults/lockup/go.mod
- x/accounts/defaults/multisig/go.mod
- x/accounts/go.mod
- x/authz/go.mod
- x/bank/go.mod
- x/circuit/go.mod
- x/consensus/go.mod
- x/distribution/go.mod
- x/distribution/keeper/keeper.go
- x/epochs/go.mod
- x/evidence/go.mod
- x/feegrant/go.mod
- x/gov/go.mod
- x/group/go.mod
- x/mint/go.mod
- x/nft/go.mod
- x/params/go.mod
- x/protocolpool/go.mod
- x/slashing/go.mod
- x/staking/go.mod
- x/upgrade/go.mod
🧰 Additional context used
📓 Path-based instructions (1)
tests/integration/v2/services.go (2)
Pattern **/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
Pattern tests/**/*
: "Assess the integration and e2e test code assessing sufficient code coverage for the changes associated in the pull request"
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 (4)
tests/integration/v2/services.go (4)
Line range hint
131-163
: Enhance error messages and gas consumption descriptionThe implementation is solid, but could benefit from more descriptive error messages and gas consumption reason:
Consider applying these improvements:
- return errors.New("context is not an integration context") + return errors.New("invalid context type: expected integrationContext") - return 0, errors.New("context is not an integration context") + return 0, errors.New("invalid context type: expected integrationContext") - _ = iCtx.gasMeter.Consume(gasUsed, "execute-with-gas-limit") + _ = iCtx.gasMeter.Consume(gasUsed, "branch-execution-overhead")
Line range hint
182-186
: Add concurrent access protectionThe handlers map could be accessed concurrently by multiple goroutines during tests, which might lead to race conditions.
Consider adding mutex protection:
type RouterService struct { + mu sync.RWMutex handlers map[string]routerHandler }
Line range hint
188-192
: Validate handler function during registrationThe RegisterHandler method should validate that the handler function is not nil to prevent potential panics.
func (rs *RouterService) RegisterHandler(handler routerHandler, typeUrl string) { + if handler == nil { + panic("handler function cannot be nil") + } rs.handlers[typeUrl] = handler }
Line range hint
194-207
: Reduce code duplication in error handlingThe error message for missing handlers is duplicated in both CanInvoke and Invoke methods.
Consider extracting the error message to a constant:
+const errNoHandler = "no handler for typeURL %s" func (rs RouterService) CanInvoke(ctx context.Context, typeUrl string) error { if rs.handlers[typeUrl] == nil { - return fmt.Errorf("no handler for typeURL %s", typeUrl) + return fmt.Errorf(errNoHandler, typeUrl) } return nil } func (rs RouterService) Invoke(ctx context.Context, req transaction.Msg) (transaction.Msg, error) { typeUrl := msgTypeURL(req) if rs.handlers[typeUrl] == nil { - return nil, fmt.Errorf("no handler for typeURL %s", typeUrl) + return nil, fmt.Errorf(errNoHandler, typeUrl) } return rs.handlers[typeUrl](ctx, req) }
📜 Review details
Configuration used: .coderabbit.yml
Review profile: CHILL
⛔ Files ignored due to path filters (12)
server/v2/cometbft/go.sum
is excluded by!**/*.sum
simapp/go.sum
is excluded by!**/*.sum
x/circuit/go.sum
is excluded by!**/*.sum
x/consensus/go.sum
is excluded by!**/*.sum
x/epochs/go.sum
is excluded by!**/*.sum
x/evidence/go.sum
is excluded by!**/*.sum
x/mint/go.sum
is excluded by!**/*.sum
x/nft/go.sum
is excluded by!**/*.sum
x/params/go.sum
is excluded by!**/*.sum
x/protocolpool/go.sum
is excluded by!**/*.sum
x/slashing/go.sum
is excluded by!**/*.sum
x/upgrade/go.sum
is excluded by!**/*.sum
📒 Files selected for processing (31)
client/v2/go.mod
(1 hunks)collections/CHANGELOG.md
(1 hunks)go.mod
(1 hunks)server/v2/cometbft/go.mod
(1 hunks)simapp/go.mod
(2 hunks)simapp/v2/go.mod
(1 hunks)tests/go.mod
(1 hunks)tests/integration/v2/auth/app_test.go
(1 hunks)tests/integration/v2/services.go
(1 hunks)x/accounts/defaults/base/go.mod
(1 hunks)x/accounts/defaults/lockup/go.mod
(1 hunks)x/accounts/defaults/multisig/go.mod
(1 hunks)x/accounts/go.mod
(1 hunks)x/authz/go.mod
(1 hunks)x/bank/go.mod
(1 hunks)x/circuit/go.mod
(3 hunks)x/consensus/go.mod
(2 hunks)x/distribution/go.mod
(2 hunks)x/distribution/keeper/keeper.go
(2 hunks)x/epochs/go.mod
(3 hunks)x/evidence/go.mod
(2 hunks)x/feegrant/go.mod
(1 hunks)x/gov/go.mod
(1 hunks)x/group/go.mod
(1 hunks)x/mint/go.mod
(3 hunks)x/nft/go.mod
(2 hunks)x/params/go.mod
(2 hunks)x/protocolpool/go.mod
(2 hunks)x/slashing/go.mod
(2 hunks)x/staking/go.mod
(2 hunks)x/upgrade/go.mod
(2 hunks)
✅ Files skipped from review due to trivial changes (1)
- tests/integration/v2/auth/app_test.go
🚧 Files skipped from review as they are similar to previous changes (29)
- client/v2/go.mod
- collections/CHANGELOG.md
- go.mod
- server/v2/cometbft/go.mod
- simapp/go.mod
- simapp/v2/go.mod
- tests/go.mod
- x/accounts/defaults/base/go.mod
- x/accounts/defaults/lockup/go.mod
- x/accounts/defaults/multisig/go.mod
- x/accounts/go.mod
- x/authz/go.mod
- x/bank/go.mod
- x/circuit/go.mod
- x/consensus/go.mod
- x/distribution/go.mod
- x/distribution/keeper/keeper.go
- x/epochs/go.mod
- x/evidence/go.mod
- x/feegrant/go.mod
- x/gov/go.mod
- x/group/go.mod
- x/mint/go.mod
- x/nft/go.mod
- x/params/go.mod
- x/protocolpool/go.mod
- x/slashing/go.mod
- x/staking/go.mod
- x/upgrade/go.mod
🧰 Additional context used
📓 Path-based instructions (1)
tests/integration/v2/services.go (2)
Pattern **/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
Pattern tests/**/*
: "Assess the integration and e2e test code assessing sufficient code coverage for the changes associated in the pull request"
🔇 Additional comments (1)
tests/integration/v2/services.go (1)
Line range hint 1-207
: Implementation provides good test coverage with room for improvement
The integration test services are well-implemented with good coverage of router and branch functionality. The suggested improvements around concurrent access protection, error handling, and validation will enhance the robustness of the test infrastructure.
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 (5)
tests/integration/v2/services.go (5)
131-131
: LGTM! Consider enhancing error messagesThe BranchService implementation is well-structured with proper context validation. However, the error message could be more descriptive to aid in debugging.
Consider enhancing the error message:
- return errors.New("context is not an integration context") + return errors.New("invalid context type: expected *integrationContext")Also applies to: 132-146
Line range hint
147-166
: Consider documenting gas consumption reasonThe ExecuteWithGasLimit implementation correctly handles gas metering, but the hardcoded gas consumption reason could be more meaningful.
Consider making the gas consumption reason more descriptive:
- _ = iCtx.gasMeter.Consume(gasUsed, "execute-with-gas-limit") + _ = iCtx.gasMeter.Consume(gasUsed, "branch-execution-overhead")
Line range hint
176-182
: Consider adding thread safety to handler registrationThe RouterService implementation is clean and well-structured. However, the handlers map could face race conditions in concurrent scenarios.
Consider adding mutex protection:
type RouterService struct { + mu sync.RWMutex handlers map[string]routerHandler } func (rs *RouterService) RegisterHandler(handler routerHandler, typeUrl string) { + rs.mu.Lock() + defer rs.mu.Unlock() rs.handlers[typeUrl] = handler }Also applies to: 183-187
Line range hint
189-204
: Enhance error handling consistencyThe error handling in CanInvoke and Invoke methods is good but contains duplicate error message construction.
Consider extracting the error message to a constant:
+const errNoHandler = "no handler for typeURL %s" func (rs RouterService) CanInvoke(ctx context.Context, typeUrl string) error { if rs.handlers[typeUrl] == nil { - return fmt.Errorf("no handler for typeURL %s", typeUrl) + return fmt.Errorf(errNoHandler, typeUrl) } return nil } func (rs RouterService) Invoke(ctx context.Context, req transaction.Msg) (transaction.Msg, error) { typeUrl := msgTypeURL(req) if rs.handlers[typeUrl] == nil { - return nil, fmt.Errorf("no handler for typeURL %s", typeUrl) + return nil, fmt.Errorf(errNoHandler, typeUrl) } return rs.handlers[typeUrl](ctx, req) }
Missing test coverage for integration services
The
BranchService
andRouterService
in the integration test package lack direct test coverage. While these services are used as dependencies in other test scenarios (e.g., inauth/app_test.go
), they should have their own dedicated test cases to verify their behavior:
BranchService.Execute
andExecuteWithGasLimit
methods need test coverageRouterService.RegisterHandler
,CanInvoke
, andInvoke
methods need test coverage- Edge cases like invalid contexts and handler registration should be tested
Please add test cases for these services in
tests/integration/v2/services_test.go
.🔗 Analysis chain
Line range hint
131-204
: Verify test coverage for router and branch servicesAs this is an integration test file, we should ensure proper test coverage for the new services.
Let's check for existing tests:
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash # Description: Check for test coverage of the router and branch services # Look for test files that might cover these services # Search for test files that might cover these services echo "Searching for relevant test files..." fd -e go -e _test.go . | grep -i "router\|branch" # Search for specific test cases echo "Searching for router service tests..." rg -l "TestRouter" -g "*.go" echo "Searching for branch service tests..." rg -l "TestBranch" -g "*.go"Length of output: 1568
Script:
#!/bin/bash # Let's examine the content of the test files to verify coverage # Check core_branch_service_test.go for BranchService test coverage echo "=== Checking BranchService test coverage ===" rg "BranchService" "server/v2/stf/core_branch_service_test.go" -C 5 echo -e "\n=== Checking RouterService test coverage ===" # Check stf_router_test.go for RouterService test coverage rg "RouterService" "server/v2/stf/stf_router_test.go" -C 5Length of output: 947
Script:
#!/bin/bash # Let's check for test coverage in integration tests directory specifically echo "=== Checking integration tests for RouterService ===" rg -A 10 "func Test.*Router" "tests/integration/v2/" echo -e "\n=== Checking integration tests for BranchService ===" rg -A 10 "func Test.*Branch" "tests/integration/v2/" # Let's also check if these services are used in test scenarios echo -e "\n=== Checking usage of services in tests ===" rg "NewRouterService|RouterService|BranchService" "tests/integration/v2/" -C 2Length of output: 6556
📜 Review details
Configuration used: .coderabbit.yml
Review profile: CHILL
⛔ Files ignored due to path filters (12)
server/v2/cometbft/go.sum
is excluded by!**/*.sum
simapp/go.sum
is excluded by!**/*.sum
x/circuit/go.sum
is excluded by!**/*.sum
x/consensus/go.sum
is excluded by!**/*.sum
x/epochs/go.sum
is excluded by!**/*.sum
x/evidence/go.sum
is excluded by!**/*.sum
x/mint/go.sum
is excluded by!**/*.sum
x/nft/go.sum
is excluded by!**/*.sum
x/params/go.sum
is excluded by!**/*.sum
x/protocolpool/go.sum
is excluded by!**/*.sum
x/slashing/go.sum
is excluded by!**/*.sum
x/upgrade/go.sum
is excluded by!**/*.sum
📒 Files selected for processing (31)
client/v2/go.mod
(1 hunks)collections/CHANGELOG.md
(1 hunks)go.mod
(1 hunks)server/v2/cometbft/go.mod
(1 hunks)simapp/go.mod
(2 hunks)simapp/v2/go.mod
(1 hunks)tests/go.mod
(1 hunks)tests/integration/v2/auth/app_test.go
(1 hunks)tests/integration/v2/services.go
(1 hunks)x/accounts/defaults/base/go.mod
(1 hunks)x/accounts/defaults/lockup/go.mod
(1 hunks)x/accounts/defaults/multisig/go.mod
(1 hunks)x/accounts/go.mod
(1 hunks)x/authz/go.mod
(1 hunks)x/bank/go.mod
(1 hunks)x/circuit/go.mod
(3 hunks)x/consensus/go.mod
(2 hunks)x/distribution/go.mod
(2 hunks)x/distribution/keeper/keeper.go
(2 hunks)x/epochs/go.mod
(3 hunks)x/evidence/go.mod
(2 hunks)x/feegrant/go.mod
(1 hunks)x/gov/go.mod
(1 hunks)x/group/go.mod
(1 hunks)x/mint/go.mod
(3 hunks)x/nft/go.mod
(2 hunks)x/params/go.mod
(2 hunks)x/protocolpool/go.mod
(2 hunks)x/slashing/go.mod
(2 hunks)x/staking/go.mod
(2 hunks)x/upgrade/go.mod
(2 hunks)
✅ Files skipped from review due to trivial changes (1)
- tests/integration/v2/auth/app_test.go
🚧 Files skipped from review as they are similar to previous changes (28)
- client/v2/go.mod
- collections/CHANGELOG.md
- go.mod
- server/v2/cometbft/go.mod
- simapp/v2/go.mod
- tests/go.mod
- x/accounts/defaults/base/go.mod
- x/accounts/defaults/lockup/go.mod
- x/accounts/defaults/multisig/go.mod
- x/accounts/go.mod
- x/authz/go.mod
- x/bank/go.mod
- x/circuit/go.mod
- x/consensus/go.mod
- x/distribution/go.mod
- x/distribution/keeper/keeper.go
- x/epochs/go.mod
- x/evidence/go.mod
- x/feegrant/go.mod
- x/gov/go.mod
- x/group/go.mod
- x/mint/go.mod
- x/nft/go.mod
- x/params/go.mod
- x/protocolpool/go.mod
- x/slashing/go.mod
- x/staking/go.mod
- x/upgrade/go.mod
🧰 Additional context used
📓 Path-based instructions (1)
tests/integration/v2/services.go (2)
Pattern **/*.go
: Review the Golang code for conformity with the Uber Golang style guide, highlighting any deviations.
Pattern tests/**/*
: "Assess the integration and e2e test code assessing sufficient code coverage for the changes associated in the pull request"
🔇 Additional comments (2)
simapp/go.mod (2)
283-284
: Local module paths specified in replace directives are not found
The verification revealed that both referenced local module paths are missing:
../indexer/postgres
directory does not exist../schema
directory does not exist
This indicates a setup issue that needs to be addressed before the changes can work properly.
3-3
:
Invalid Go version specified
The Go version 1.23.3 specified in the file does not exist yet. The latest stable version of Go is 1.22.1 (as of March 2024).
Apply this diff to fix the version:
-go 1.23.3
+go 1.22.1
Likely invalid or redundant comment.
(cherry picked from commit bd76b47) # Conflicts: # collections/CHANGELOG.md # collections/go.mod # collections/go.sum # collections/indexing.go # collections/protocodec/collections.go # collections/protocodec/collections_test.go # indexer/postgres/create_table.go # indexer/postgres/enum.go # indexer/postgres/listener.go # indexer/postgres/tests/testdata/init_schema.txt # indexer/postgres/tests/testdata/init_schema_no_retain_delete.txt # math/legacy_dec_test.go # schema/appdata/async.go # schema/field.go # schema/field_test.go # schema/state_object.go # schema/state_object_test.go # server/v2/cometbft/go.mod # server/v2/cometbft/go.sum # simapp/go.mod # simapp/go.sum # store/cachekv/branch_bench_test.go # tests/integration/v2/auth/app_test.go # tests/integration/v2/services.go # x/bank/keeper/view.go # x/circuit/go.mod # x/circuit/go.sum # x/consensus/go.mod # x/consensus/go.sum # x/distribution/go.mod # x/epochs/go.mod # x/epochs/go.sum # x/evidence/go.mod # x/evidence/go.sum # x/mint/go.mod # x/mint/go.sum # x/nft/go.mod # x/nft/go.sum # x/params/go.mod # x/params/go.sum # x/protocolpool/go.mod # x/protocolpool/go.sum # x/slashing/go.mod # x/slashing/go.sum # x/staking/go.mod # x/upgrade/go.mod # x/upgrade/go.sum
…2544) (#22676) Co-authored-by: Facundo Medica <[email protected]> Co-authored-by: Facundo <[email protected]> Co-authored-by: Julien Robert <[email protected]>
Description
Implement necessary methods and named keys in:
Changed some default key codecs to be
NameableKeyCodec
(TimeKey, LengthPrefixedBytesKey, LengthPrefixedAddressKey)Improve error messages in schema
Fixed AsyncListener in schema to avoid hanging on unprocessed packets
In baseapp, check for
app.streamingManager.StopNodeOnErr
so the indexer can crash the node if needed. Also the call to the store's Commit() was moved to after the streaming listener, so in case that something fails in the indexer we can stop the node before it commits. Otherwise when restarting the indexer would have skipped a block.In codec:
The following is a bit hacky:
In collections, for ModuleCodec, we use the value decoder to obtain an empty message (so this assumes that value decoders will return an empty struct and not a nil when passing an empty byte slice). This is used to optionally get a proto message which is then used to register any existing enums in the used messages.
We also adapt the full enum name to not use periods, otherwise it will fail somewhere else (
Name: strings.ReplaceAll(string(enum.FullName()), ".", "_"), // make it compatible with schema
).The goal of this is so then the indexer can register the enum in the DB, which need to be registered before starting to write data.
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
Release Notes
New Features
ModuleCodec
methods in multiple modules to support schema management and indexing.collections
module.RouterService
for structured message handling in integration tests.Bug Fixes
Dependencies
Chores