Repository navigation
Conversation
The owner paths of the orders, bids and leases queries iterated every entry under the owner prefix and applied the dseq, gseq and oseq filters per entry. A query for one deployment therefore read everything the owner has in state, closed and lost entries included, so its cost grew with the owner's history rather than with the result. Extend the prefix with the dseq, gseq and oseq filters in key order. Results are unchanged since the filters are still applied per entry. A resume key that falls outside the narrowed prefix keeps the owner-wide prefix, as before. Signed-off-by: Maxime Beauchamp <15185355+baktun14@users.noreply.github.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (3)
Included review availability: This review used your included allowance. Your plan provides up to 5 included reviews per hour; 3 remain after this review. WalkthroughOwner-scoped order, bid, and lease queries now use request filters and resume keys to narrow primary-map scans. New tests check query gas use and pagination behavior. Test setup helpers now accept group identifiers. ChangesOwner-Scoped Market Queries
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Bug fix Suggested reviewers: Merge Risk: ⚪ Minimal · up to No identified issue blocks merging this query change after normal checks. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
A rabbit checks the order keys, Comment |
Description
Closes: N/A, no tracking issue
When
filters.owneris set, the orders, bids and leases queries walk every entry under the owner prefix and checkdseq,gseqandoseqon each one. A query for one deployment therefore reads everything the owner has in state, closed and lost entries included. Its cost follows the owner's history, not the size of the result.This extends the range prefix with the
dseq,gseqandoseqfilters in key order (ownerOrderPrefixinx/market/keeper/grpc_query.go). The filters are still applied per entry, so results don't change. A pagination key that falls outside the narrowed prefix keeps the owner-wide prefix, because that range would otherwise fail withcollections: invalid iterator.On mainnet today,
bids/list?filters.owner=...&filters.dseq=...takes about 1.1 s on a public API node for an owner with more than 10k bids in state (30 ms for an owner with none), and the same for a dseq that doesn't exist. Console polls this query while a deployment waits for bids, and one busy owner polling it was enough to push the shared API nodes past our proxy's timeout.Tests:
TestGRPCQueryOwnerFiltersReadOnlyMatchingEntriesmeasures store gas for owner queries filtered by dseq, by dseq+gseq and by the full order ID, before and after the owner gains 99 other deployments and a second group. The gas has to stay identical. Onmainthe dseq-filtered orders query goes from 4,674 to 282,903 gas.TestGRPCQueryOwnerResumeKeyOutsideDSeqFiltercovers the pagination fallback.This is a query-only change with no state or consensus impact. Could it go into a v2.1.x patch, so API node operators can roll it without an upgrade?
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...
!to the type prefix if API or client breaking change (not breaking)CHANGELOG.md(not updated per fix in recent PRs)