Skip to content

fix ordering in list-action query#102

Merged
mateeullahmalik merged 4 commits intomasterfrom
fix/list-actions-query
Mar 3, 2026
Merged

fix ordering in list-action query#102
mateeullahmalik merged 4 commits intomasterfrom
fix/list-actions-query

Conversation

@mateeullahmalik
Copy link
Contributor

No description provided.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes an ordering issue in the list-action query where reverse pagination was using lexical ordering instead of numeric ordering for action IDs. This caused issues on mainnet where action ID "99999" would appear before "123611" in reverse order (lexically correct but numerically incorrect).

Changes:

  • Added numeric ordering logic for reverse pagination when no filters are applied
  • Added test case to verify numeric ordering behavior with reverse pagination
  • Swapped import order of testify and gomock in test file

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 8 comments.

File Description
x/action/v1/keeper/query_list_actions_test.go Swapped import order and added test for numeric reverse pagination
x/action/v1/keeper/query_list_actions.go Added helper functions for numeric sorting and custom pagination logic for reverse queries

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@roomote
Copy link

roomote bot commented Mar 3, 2026

Rooviewer Clock   See task

Both items from previous reviews are now addressed. The offset+key guard in paginateActionSlice rejects the invalid combination, and the deduplication refactor keeps the three reverse-ordering branches sharing common helpers. No new issues found.

  • paginateActionSlice should reject requests where both Offset and Key are set, matching the behavior of FilteredPaginate in the non-reverse path
  • Extract the repeated materialize-sort-reverse-paginate sequence (duplicated across state-index, type-index, and no-filter branches) into a shared helper
Previous reviews

Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues.

@mateeullahmalik mateeullahmalik merged commit 8b7706b into master Mar 3, 2026
7 of 8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants