cosmos-sdk: nextKey is not returned when calling GetTxsEvent
Summary of Bug
It appears that the pagination does not work properly when calling QueryClient.queryUnverified(). There are two issues I found in the response:
- nextKey is always an empty array.
- offset and limit keys don’t work correctly. When I passed offset=4, limit=7, it just returned the result from the beginning. The response had the transactions of indexes 0-6.
Version
v0.44
Steps to Reproduce
Here’s the code snippet I used to get the transactions history.
import { Tendermint34Client } from "@cosmjs/tendermint-rpc"
import { QueryClient } from "@cosmjs/stargate"
import { GetTxsEventRequest } from "cosmjs-types/cosmos/tx/v1beta1/service"
const client = QueryClient.withExtensions(
await Tendermint34Client.connect({rpc_endpoint}),
)
client.queryUnverified("/cosmos.tx.v1beta1.Service/GetTxsEvent", GetTxsEventRequest.encode({
events: [
"message.action='delegate'",
"delegate.validator='{validator_address}'",
],
pagination: {
countTotal: true,
key: new Uint8Array(),
offset: Long.fromNumber(0, true),
limit: Long.fromNumber(5, true),
reverse: false,
},
orderBy: OrderBy.ORDER_BY_ASC,
}).finish())
For Admin Use
- Not duplicate issue
- Appropriate labels applied
- Appropriate contributors tagged
- Contributor assigned/self-assigned
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 19 (12 by maintainers)
Commits related to this issue
- fix: GetTxsEvent pagination (#12261) ## Description Closes: https://github.com/cosmos/cosmos-sdk/issues/11538 Also see thread after https://github.com/cosmos/cosmos-sdk/issues/11538#issuecomment-115... — committed to cosmos/cosmos-sdk by blushi 2 years ago
- fix: GetTxsEvent pagination (#12261) ## Description Closes: https://github.com/cosmos/cosmos-sdk/issues/11538 Also see thread after https://github.com/cosmos/cosmos-sdk/issues/11538#issuecomment-115... — committed to cosmos/cosmos-sdk by blushi 2 years ago
- fix: GetTxsEvent pagination (backport #12261) (#12280) * fix: GetTxsEvent pagination (#12261) ## Description Closes: https://github.com/cosmos/cosmos-sdk/issues/11538 Also see thread after htt... — committed to cosmos/cosmos-sdk by mergify[bot] 2 years ago
- Update master (#2) * chore: Buildjet pr (#12231) * use buildjet 4vcpu, 16gb runners * Delete .gitpod.yml * Update lint-pr.yml * Update clean-artifacts.yml * Update proto-docker.yml ... — committed to arhamchordia/cosmos-sdk by arhamchordia 2 years ago
Yes, this seems reasonable to me. It should not accept and return those parameters 👍
@facundomedica or @julienrbrt would you have some bandwidth to look into pagination?