fix(x/auth/tx): honor deprecated Pagination in GetTxsEvent#26399
Open
ozpool wants to merge 1 commit intocosmos:mainfrom
Open
fix(x/auth/tx): honor deprecated Pagination in GetTxsEvent#26399ozpool wants to merge 1 commit intocosmos:mainfrom
ozpool wants to merge 1 commit intocosmos:mainfrom
Conversation
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
Contributor
|
PR author is not in the allowed authors list. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Closes #25886.
GetTxsEventonly reads the top-levelpage,limit, andorder_byfields onGetTxsEventRequestand silently dropsreq.pagination. REST clients hitting the gRPC-gateway endpoint typically populatepagination.limit,pagination.offset, andpagination.reverse(as in the report's URLs against/cosmos/tx/v1beta1/txs), so each request collapsed toDefaultLimit=100ascending results regardless of the values supplied. That is the most likely explanation for the reporter seeing the same address turn up by hash /tx.heightbut not bytransfer.recipientonce 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:
limitfalls back toreq.Pagination.Limitwhen the top-level limit is zero.pageis derived fromreq.Pagination.Offset / effectiveLimit + 1, returningInvalidArgumentifOffsetis not a multiple ofLimit(CometBFT'sTxSearchis page-based).OrderBy_UNSPECIFIED+Pagination.Reverse=truemaps toOrderBy_DESC.GetBlockWithTxsalready readsreq.Paginationdirectly, so this also bringsGetTxsEventin line with the sibling RPC.Testing
New
x/auth/tx/service_test.goplugs a recordingTxSearchclient intoMockClientand exercises:limithonored when top-level limit is zerooffsettranslated topagereversemapped todescpage/limitprecedence over deprecated fieldsInvalidArgumentAuthor Checklist
!in the title if this is a breaking change — n/a, additive fallback