Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
qezz opened this issue Mar 22, 2024 · 2 comments

Comments

@qezz
Copy link

qezz commented Mar 22, 2024

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

/// Lists all the proposals that have been cast in this
/// module.
#[returns(crate::query::ProposalListResponse)]
ListProposals {
/// The proposal ID to start listing proposals after. For
/// example, if this is set to 2 proposals with IDs 3 and
/// higher will be returned.
start_after: Option<u64>,
/// The maximum number of proposals to return as part of this
/// query. If no limit is set a max of 30 proposals will be
/// returned.
limit: Option<u64>,
},

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
Copy link
Author

qezz commented Mar 22, 2024

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
Copy link
Contributor

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

let limit = limit.unwrap_or(DEFAULT_LIMIT);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants