CosmWasm / wasmd

Basic cosmos-sdk app with web assembly smart contracts
Other
366 stars 398 forks source link

offset and count queries not supported #1759

Open 99Kies opened 9 months ago

99Kies commented 9 months ago

this is my cosmwasm version:

    github.com/CosmWasm/wasmd v0.43.0
    github.com/CosmWasm/wasmvm v1.5.0 // indirect
    github.com/cometbft/cometbft v0.37.2
    github.com/cometbft/cometbft-db v0.8.0
    github.com/cosmos/cosmos-sdk v0.47.5

url: https://vota-testnet-rest.dorafactory.org/cosmwasm/wasm/v1/code?pagination.limit=20&pagination.count_total=true

error log:

{
  "code": 3,
  "message": "offset and count queries not supported",
  "details": [

  ]
}
99Kies commented 9 months ago

I found that I need to remove the pagination for the query to succeed, why is that? (This is not consistent with the parameter requirements of the other rest methods)

https://vota-testnet-rest.dorafactory.org/cosmwasm/wasm/v1/code?limit=20&count_total=true

alpe commented 9 months ago

The offset/ count implementations are very inefficient in the SDK. Just use the normal token pagination

99Kies commented 9 months ago

image @alpe But I found that this paging function is not working, why is that?

alpe commented 9 months ago

when the next key is null, then you have reached the last page.

99Kies commented 9 months ago

@alpe But I set the limit, it still return all 6 records. and the total data also is wrong. right?