Skip to content

Searching transactions returns last page when requested page greater than last page #4736

@alexanderbez

Description

@alexanderbez

@feri42 commented on Wed Jul 17 2019

Summary of Bug

When searching transactions using the gaia-lite GET /txs API, the last page is returned when requesting any page greater than the last.

Steps to Reproduce

Request example with the last page of results (page 3 at the time of writing):

curl -X GET "https://stargate.cosmos.network/txs?recipient=cosmos16qh8jr78hmpq6l8kca84ck2wxdv8qg4vrz9q7v&page=3&limit=5" -H  "accept: application/json"
[{"height":"1076154","txhash":"9C2FAFD33C626ECDAA511FE6EB747A6CA38569F692AA2244AC54E427FF28C106","raw_log":"[{\"msg_index\":\"0\",\"success\":true,\"log\":\"\"}]","logs":[{"msg_index":"0","success":true,"log":""}],"gas_wanted":"32066","gas_used":"27864","tags":[{"key":"action","value":"send"},{"key":"sender","value":"cosmos18xgyce245tqvqj24v9pesst6s3fpqzy9jmv9yy"},{"key":"recipient","value":"cosmos16qh8jr78hmpq6l8kca84ck2wxdv8qg4vrz9q7v"}],"tx":{"type":"auth/StdTx","value":{"msg":[{"type":"cosmos-sdk/MsgSend","value":{"from_address":"cosmos18xgyce245tqvqj24v9pesst6s3fpqzy9jmv9yy","to_address":"cosmos16qh8jr78hmpq6l8kca84ck2wxdv8qg4vrz9q7v","amount":[{"denom":"uatom","amount":"1000000"}]}}],"fee":{"amount":[{"denom":"uatom","amount":"5000"}],"gas":"32066"},"signatures":[{"pub_key":{"type":"tendermint/PubKeySecp256k1","value":"AvemriqNXK19XW9fFHRlWJ0i+5t2oFLNIPwxzdvmz3Tx"},"signature":"lDSLnkveqdv2uQYlzvbGYcc5rTqdGQ7617RwqUelvkM5Oj/u78kE20OFXch1Ef/RkRDdkFv1/FLVdBG8tx0CGA=="}],"memo":""}},"timestamp":"2019-07-17T13:32:05Z"}]

Request example for page 4, we get the same result set:

curl -X GET "https://stargate.cosmos.network/txs?recipient=cosmos16qh8jr78hmpq6l8kca84ck2wxdv8qg4vrz9q7v&page=4&limit=5" -H  "accept: application/json"
[{"height":"1076154","txhash":"9C2FAFD33C626ECDAA511FE6EB747A6CA38569F692AA2244AC54E427FF28C106","raw_log":"[{\"msg_index\":\"0\",\"success\":true,\"log\":\"\"}]","logs":[{"msg_index":"0","success":true,"log":""}],"gas_wanted":"32066","gas_used":"27864","tags":[{"key":"action","value":"send"},{"key":"sender","value":"cosmos18xgyce245tqvqj24v9pesst6s3fpqzy9jmv9yy"},{"key":"recipient","value":"cosmos16qh8jr78hmpq6l8kca84ck2wxdv8qg4vrz9q7v"}],"tx":{"type":"auth/StdTx","value":{"msg":[{"type":"cosmos-sdk/MsgSend","value":{"from_address":"cosmos18xgyce245tqvqj24v9pesst6s3fpqzy9jmv9yy","to_address":"cosmos16qh8jr78hmpq6l8kca84ck2wxdv8qg4vrz9q7v","amount":[{"denom":"uatom","amount":"1000000"}]}}],"fee":{"amount":[{"denom":"uatom","amount":"5000"}],"gas":"32066"},"signatures":[{"pub_key":{"type":"tendermint/PubKeySecp256k1","value":"AvemriqNXK19XW9fFHRlWJ0i+5t2oFLNIPwxzdvmz3Tx"},"signature":"lDSLnkveqdv2uQYlzvbGYcc5rTqdGQ7617RwqUelvkM5Oj/u78kE20OFXch1Ef/RkRDdkFv1/FLVdBG8tx0CGA=="}],"memo":""}},"timestamp":"2019-07-17T13:32:05Z"}]

Expected behaviour is to get an empty array or an error.


@alexanderbez commented on Thu Jul 18 2019

Can confirm this logic. This because we're not calling client.Paginate in QueryTxsByEventsRequestHandlerFn. Moving this issue to the SDK repo. Thanks @feri42!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions