Skip to content

fix(x/auth/tx): honor deprecated Pagination in GetTxsEvent#26399

Open
ozpool wants to merge 1 commit intocosmos:mainfrom
ozpool:fix/getrxsevent-honor-deprecated-pagination
Open

fix(x/auth/tx): honor deprecated Pagination in GetTxsEvent#26399
ozpool wants to merge 1 commit intocosmos:mainfrom
ozpool:fix/getrxsevent-honor-deprecated-pagination

Conversation

@ozpool
Copy link
Copy Markdown
Contributor

@ozpool ozpool commented May 8, 2026

Description

Closes #25886.

GetTxsEvent only reads the top-level page, limit, and order_by fields on GetTxsEventRequest and silently drops req.pagination. REST clients hitting the gRPC-gateway endpoint typically populate pagination.limit, pagination.offset, and pagination.reverse (as in the report's URLs against /cosmos/tx/v1beta1/txs), so each request collapsed to DefaultLimit=100 ascending results regardless of the values supplied. That is the most likely explanation for the reporter seeing the same address turn up by hash / tx.height but not by transfer.recipient once the matching set exceeds 100 — they were always reading page 1 in ascending order and never reaching the missing tx.

This change keeps the deprecation in place but stops dropping the values:

  • limit falls back to req.Pagination.Limit when the top-level limit is zero.
  • page is derived from req.Pagination.Offset / effectiveLimit + 1, returning InvalidArgument if Offset is not a multiple of Limit (CometBFT's TxSearch is page-based).
  • OrderBy_UNSPECIFIED + Pagination.Reverse=true maps to OrderBy_DESC.
  • Top-level fields always win when both are populated, so existing v0.50+ clients are unaffected.

GetBlockWithTxs already reads req.Pagination directly, so this also brings GetTxsEvent in line with the sibling RPC.

Testing

New x/auth/tx/service_test.go plugs a recording TxSearch client into MockClient and exercises:

  • deprecated limit honored when top-level limit is zero
  • deprecated offset translated to page
  • deprecated reverse mapped to desc
  • top-level page/limit precedence over deprecated fields
  • non-multiple offset rejected with InvalidArgument
go test ./x/auth/tx/...
ok  	github.com/cosmos/cosmos-sdk/x/auth/tx	0.661s

Author Checklist

  • included the correct type prefix in the PR title
  • confirmed ! in the title if this is a breaking change — n/a, additive fallback
  • targeted the correct branch (main)
  • provided a link to the relevant issue or specification
  • reviewed "Files changed" and left comments if necessary — n/a
  • included the necessary unit tests

GetTxsEvent only consumed the top-level Page/Limit/OrderBy fields and
silently ignored req.Pagination. REST clients hitting the gRPC-gateway
endpoint with pagination.limit / pagination.offset / pagination.reverse
got DefaultLimit-sized ascending pages no matter what they passed,
which is what made paginated transfer.recipient queries appear to drop
matching txs.

Treat the deprecated fields as a fallback when the top-level fields are
unset: limit -> req.Pagination.Limit, page -> Offset/Limit + 1 (with an
InvalidArgument when Offset is not a multiple of Limit), and Reverse
maps to OrderBy_DESC. Top-level fields still win when both are set.

Adds a service_test.go with a recording TxSearch client covering each
fallback path plus the precedence rule.

Closes cosmos#25886
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 8, 2026

PR author is not in the allowed authors list.

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.

Missing claim reward txs on txs?query endpoint

1 participant