-
Notifications
You must be signed in to change notification settings - Fork 634
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: CosmWasm Pool raw state query #9006
Conversation
WalkthroughThe change introduces a new raw state query feature for CosmWasm Pools. It updates the changelog with a new feature entry and extends functionalities in the code by adding new RPC methods, Querier methods, and Keeper functions to support filtered state queries. Additionally, the interface for the WasmKeeper is enhanced with a new state iteration method, and corresponding test code is updated to incorporate these changes. Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant Querier
participant Keeper
participant WasmKeeper
Client->>Querier: PoolRawFilteredState Request
Querier->>Keeper: GetPoolRawFilteredState(poolId, keyFilter, valueFilter)
Keeper->>WasmKeeper: IterateContractState(ctx, contractAddress, callback)
WasmKeeper-->>Keeper: Return filtered state values
Keeper-->>Querier: Return PoolRawFilteredStateResponse
Querier-->>Client: PoolRawFilteredState Response
Suggested labels
Suggested reviewers
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
⏰ Context from checks skipped due to timeout of 90000ms (5)
🔇 Additional comments (3)
✨ Finishing Touches
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 (
|
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: 2
🧹 Nitpick comments (1)
x/cosmwasmpool/store.go (1)
76-105
: Consider performance optimizations for large state queriesThe current implementation may not be performant for contracts with large state:
- No pagination support means all matching results are loaded into memory
- Using
bytes.Contains
for every key/value pair may be inefficient for large datasetsConsider:
- Implementing pagination support
- Adding a limit parameter to cap result size
- Using more efficient filtering mechanisms
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (3)
proto/osmosis/cosmwasmpool/v1beta1/query.yml
is excluded by!**/*.yml
x/cosmwasmpool/client/queryproto/query.pb.go
is excluded by!**/*.pb.go
,!**/*.pb.go
x/cosmwasmpool/client/queryproto/query.pb.gw.go
is excluded by!**/*.pb.gw.go
,!**/*.pb.gw.go
📒 Files selected for processing (7)
CHANGELOG.md
(1 hunks)ingest/sqs/pools/transformer/alloy_transmuter_test.go
(2 hunks)proto/osmosis/cosmwasmpool/v1beta1/query.proto
(2 hunks)x/cosmwasmpool/client/grpc/grpc_query.go
(1 hunks)x/cosmwasmpool/client/query_proto_wrap.go
(1 hunks)x/cosmwasmpool/store.go
(2 hunks)x/cosmwasmpool/types/expected_keepers.go
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (6)
- GitHub Check: go (03)
- GitHub Check: go (02)
- GitHub Check: go (01)
- GitHub Check: go (00)
- GitHub Check: e2e
- GitHub Check: Summary
🔇 Additional comments (8)
CHANGELOG.md (1)
53-53
: New feature for CosmWasm Pool raw state query addedThe changelog entry properly documents the addition of the raw state query feature for CosmWasm Pools, connected to PR #9006. This is correctly placed in the "State Compatible" section since it adds functionality without breaking existing state.
x/cosmwasmpool/client/grpc/grpc_query.go (1)
34-42
: Implementation of gRPC handler for PoolRawFilteredState looks correctThe implementation follows the established pattern in the file for other query methods:
- Proper nil request validation
- Context unwrapping
- Delegation to the underlying querier
This is a clean implementation of the gRPC handler for the new raw state query feature.
x/cosmwasmpool/types/expected_keepers.go (1)
61-61
: New WasmKeeper interface method for iterating contract stateAdding
IterateContractState
to the interface provides the necessary functionality to implement the raw state query feature. The method signature correctly includes a callback function pattern that's commonly used for iterating collections in Go.x/cosmwasmpool/client/query_proto_wrap.go (1)
48-56
: Implementation of querier method for raw filtered stateThe method correctly delegates to the keeper's
GetPoolRawFilteredState
function, passing along the request parameters. The error handling and response construction follow the established pattern in the codebase.proto/osmosis/cosmwasmpool/v1beta1/query.proto (3)
31-35
: RPC method looks well-implementedThe new
PoolRawFilteredState
RPC method is properly defined with appropriate HTTP endpoint mapping.
70-80
: Request message well-structured with appropriate field annotationsThe
PoolRawFilteredStateRequest
message is well-defined with clear field descriptions and proper YAML annotations.
82-85
: Response message structure looks goodThe
PoolRawFilteredStateResponse
message properly uses a repeated bytes field to return values.x/cosmwasmpool/store.go (1)
92-93
: Address the TODO comment before finalizingThe TODO comment raises an important concern about handling cases where no filter is passed, which could potentially return large amounts of data. Consider implementing pagination or placing a reasonable limit on the number of returned items.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
* feat: orderbook orders raw grpc query * chore: comment * ref: generalised pool raw state query * fix: generate proto * fix: remove unused keeper * Generated protofile changes * chore: changelog * fix: readd query * Generated protofile changes * fix: register new grpc query * Update ingest/sqs/pools/transformer/alloy_transmuter_test.go Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --------- Co-authored-by: github-actions <github-actions@github.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> (cherry picked from commit c2f0905) # Conflicts: # CHANGELOG.md # ingest/sqs/pools/transformer/alloy_transmuter_test.go # x/cosmwasmpool/client/queryproto/query.pb.go
* feat: CosmWasm Pool raw state query (#9006) * feat: orderbook orders raw grpc query * chore: comment * ref: generalised pool raw state query * fix: generate proto * fix: remove unused keeper * Generated protofile changes * chore: changelog * fix: readd query * Generated protofile changes * fix: register new grpc query * Update ingest/sqs/pools/transformer/alloy_transmuter_test.go Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> --------- Co-authored-by: github-actions <github-actions@github.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> (cherry picked from commit c2f0905) # Conflicts: # CHANGELOG.md # ingest/sqs/pools/transformer/alloy_transmuter_test.go # x/cosmwasmpool/client/queryproto/query.pb.go * Generated protofile changes * fix: conflicts --------- Co-authored-by: Connor Barr <crnbarr@gmail.com> Co-authored-by: github-actions <github-actions@github.com>
What is the purpose of the change
These changes add a new query to the
x/cosmwasmpool
module that allows querying raw contract state. The query also accepts a filtering string for both key and/or value that will only return values that contain the string for the provided filters.Testing and Verifying
Documentation and Release Note
Unreleased
section ofCHANGELOG.md
?Where is the change documented?
x/{module}/README.md
)