substrate
substrate copied to clipboard
Expose `STORAGE_KEYS_PAGED_MAX_COUNT` for usage in clients
Is there an existing issue?
- [X] I have searched the existing issues
Experiencing problems? Have you tried our Stack Exchange first?
- [X] This is not a support question.
Description of bug
If a client wants to get storage keys, it makes sense for the client to know the maximum page size for a query without: a) having to read the node source code and then hardcoding the value or b) getting a query failure on the first query.
Steps to reproduce
No response
WDYT of removing the error and making the STORAGE_KEYS_PAGED_MAX_COUNT implicit. Aka if you request more than that, you will automatically in max STORAGE_KEYS_PAGED_MAX_COUNT
Hmm, when reading the client code removing the error would be a bit misleading. e.g. if for some application the developer knows they can only have a max of 3000 items in their storage so they do two two queries of 1500, it reads as though they will get all 3000, but in reality, it'll "fail" silently after getting 2000. So I'm probably in favour of keeping the error.
I think either exporting the const and/or having a "max_keys_per_page_count" rpc to query for the max would make client code a little nicer/more explicit.
Could we actually make this a CLI flag? That would help with the try-runtime runner when scrapping the whole state from a local node.