DA0-DA0 / dao-contracts

CosmWasm smart contracts for Interchain DAOs.
https://docs.daodao.zone
BSD 3-Clause "New" or "Revised" License
202 stars 132 forks source link

`list_proposals` without limit expected to return all proposals, but returns only 30 #811

Open qezz opened 3 months ago

qezz commented 3 months ago

If I look at the correct line, it says that it should return all proposals

https://github.com/DA0-DA0/dao-contracts/blob/ef21c637de7069e84f6221094dea22872930fd9a/contracts/proposal/dao-proposal-single/src/msg.rs#L158-L170

Lists all the proposals

But, when I query /cosmwasm/wasm/v1/contract/neutron1436kxs0w2es6xlqpp9rd35e3d0cjnw4sv8j3a7483sgks29jqwgshlt6zh/smart/eyJsaXN0X3Byb3Bvc2FscyI6IHt9fQ== it returns only 30 early proposals.

This is unexpected.

The smart contract method is as following:

    method: Dict[str, Any] = {
        "list_proposals": {},
    }

    s = json.dumps(method).encode("utf-8")
    encoded = base64.standard_b64encode(s)
    encoded_utf8 = encoded.decode("utf-8")

    print(encoded_utf8)
$ echo 'eyJsaXN0X3Byb3Bvc2FscyI6IHt9fQ==' | base64 -d
{"list_proposals": {}}
qezz commented 3 months ago

As a side note, there's no way to figure out if /cosmwasm/wasm/v1/contract/neutron1436kxs0w2es6xlqpp9rd35e3d0cjnw4sv8j3a7483sgks29jqwgshlt6zh/smart/eyJsaXN0X3Byb3Bvc2FscyI6IHt9fQ== returned all props or just some of them.

ismellike commented 2 months ago

Please see the comment for the limit parameter. The data is meant to be paginated.

https://github.com/DA0-DA0/dao-contracts/blob/ef21c637de7069e84f6221094dea22872930fd9a/contracts/proposal/dao-proposal-single/src/contract.rs#L878