PSE Allocation Schedule Query#28
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds a new gRPC query endpoint AllocationSchedule to the PSE module that allows clients to retrieve all future allocation schedules sorted by timestamp. The implementation includes protocol buffer definitions, server/client implementations, comprehensive tests, and updated documentation.
- Added gRPC query
AllocationSchedulewith request/response types to retrieve future distribution schedules - Implemented query handler that returns sorted schedules using the existing keeper method
GetAllocationSchedule - Added extensive test coverage for empty schedules, multiple schedules, multiple allocations, and timestamp sorting
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| proto/tx/pse/v1/query.proto | Defines new QueryAllocationScheduleRequest and QueryAllocationScheduleResponse messages and adds RPC endpoint |
| x/pse/types/query.pb.go | Auto-generated protobuf Go code for new query types, client/server interfaces, and marshaling logic |
| x/pse/types/query.pb.gw.go | Auto-generated gRPC-gateway HTTP handlers for the new query endpoint |
| x/pse/keeper/grpc.go | Implements AllocationSchedule query handler that returns schedules from keeper |
| x/pse/keeper/distribution.go | Adds documentation comment clarifying that only future schedules are returned |
| x/pse/keeper/grpc_query_test.go | Adds comprehensive tests covering empty schedules, multiple schedules, allocations, and sorting |
| docs/api.md | Updates API documentation with new query request/response types and REST endpoint |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
ysv
left a comment
There was a problem hiding this comment.
@ysv reviewed 7 of 7 files at r1, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @masihyeganeh and @miladz68)
proto/tx/pse/v1/query.proto line 70 at r1 (raw file):
// schedules contains all future distribution schedules sorted by timestamp in ascending order. // Past schedules are automatically removed after processing, so all returned schedules are future schedules. repeated ScheduledDistribution schedules = 1 [
I think it should be schedule (singular).
I
TxCorpi0x
left a comment
There was a problem hiding this comment.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @masihyeganeh, @miladz68, and @ysv)
proto/tx/pse/v1/query.proto line 70 at r1 (raw file):
Previously, ysv (Yaroslav Savchuk) wrote…
I think it should be schedule (singular).
I
Done
ysv
left a comment
There was a problem hiding this comment.
@ysv reviewed 5 of 5 files at r2, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @masihyeganeh and @miladz68)
miladz68
left a comment
There was a problem hiding this comment.
@miladz68 reviewed 2 of 7 files at r1, 4 of 5 files at r2, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @masihyeganeh)
proto/tx/pse/v1/query.proto line 68 at r2 (raw file):
// QueryAllocationScheduleResponse defines the response type for querying future allocation schedules. message QueryAllocationScheduleResponse { // schedules contains all future distribution schedules sorted by timestamp in ascending order.
plural is left in the comment.
proto/tx/pse/v1/query.proto line 72 at r2 (raw file):
repeated ScheduledDistribution schedule = 1 [ (gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"schedules\""
plural is left in yaml.
fbe93a5 to
28e38e0
Compare
TxCorpi0x
left a comment
There was a problem hiding this comment.
Reviewable status: 1 of 7 files reviewed, 2 unresolved discussions (waiting on @masihyeganeh, @miladz68, and @ysv)
proto/tx/pse/v1/query.proto line 68 at r2 (raw file):
Previously, miladz68 (milad) wrote…
plural is left in the comment.
Done
proto/tx/pse/v1/query.proto line 72 at r2 (raw file):
Previously, miladz68 (milad) wrote…
plural is left in yaml.
Done
TxCorpi0x
left a comment
There was a problem hiding this comment.
@ysv The suggested renaming comments in the query (in other PR) has been addressed here
Reviewable status: 0 of 11 files reviewed, 2 unresolved discussions (waiting on @masihyeganeh, @miladz68, and @ysv)
miladz68
left a comment
There was a problem hiding this comment.
@miladz68 reviewed 11 of 11 files at r4, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @masihyeganeh)
ysv
left a comment
There was a problem hiding this comment.
@ysv reviewed 11 of 11 files at r4, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @masihyeganeh)
miladz68
left a comment
There was a problem hiding this comment.
@miladz68 reviewed 10 of 10 files at r5, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @masihyeganeh)
miladz68
left a comment
There was a problem hiding this comment.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @masihyeganeh)
proto/tx/pse/v1/query.proto line 29 at r5 (raw file):
// ScheduledDistributions queries all future scheduled distributions. rpc ScheduledDistributions(QueryScheduledDistributionsRequest) returns (QueryScheduledDistributionsResponse) { option (cosmos.query.v1.module_query_safe) = true;
can we remove the safe query, just as a pre-caution ?
TxCorpi0x
left a comment
There was a problem hiding this comment.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @masihyeganeh and @miladz68)
proto/tx/pse/v1/query.proto line 29 at r5 (raw file):
Previously, miladz68 (milad) wrote…
can we remove the safe query, just as a pre-caution ?
Don't we need it to be queried cross-module? Or from Wasm smart contracts?
TxCorpi0x
left a comment
There was a problem hiding this comment.
Reviewable status: 9 of 11 files reviewed, 1 unresolved discussion (waiting on @masihyeganeh and @miladz68)
proto/tx/pse/v1/query.proto line 29 at r5 (raw file):
Previously, TxCorpi0x wrote…
Don't we need it to be queried cross-module? Or from Wasm smart contracts?
As decided in the call, it has been removed
miladz68
left a comment
There was a problem hiding this comment.
@miladz68 reviewed 2 of 2 files at r6, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @masihyeganeh)
ysv
left a comment
There was a problem hiding this comment.
@ysv reviewed 8 of 10 files at r5, 2 of 2 files at r6, all commit messages.
Reviewable status:complete! all files reviewed, all discussions resolved (waiting on @masihyeganeh)
Description
This pull request introduces a new gRPC query endpoint for retrieving all future allocation schedules in the PSE module. The changes add protocol definitions, server and client implementations, documentation, and comprehensive tests to ensure the schedules are correctly returned and sorted.
API additions
AllocationScheduleto the service definition inquery.proto, including its request and response messages. The response contains all future distribution schedules sorted by timestamp.docs/api.md) to describe the new request/response types and the REST endpoint/tx/pse/v1/allocation_schedule.Server and client implementation
AllocationSchedulequery handler in the keeper (x/pse/keeper/grpc.go), which returns all future schedules using the keeper'sGetAllocationSchedulemethod.query.pb.gw.goto support both server-side and client-side HTTP requests for the new endpoint.Testing
grpc_query_test.go, covering empty schedules, multiple schedules, multiple allocations, and correct sorting by timestamp.Internal documentation
Reviewers checklist:
Authors checklist
This change is