Map enumeration asks for more keys than Substrate allows, and swallows the error #4
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
/heisenberg/reversiblereports 0 pending. The chain has 2.PENDING_LIMITis 1,600 andstate_getKeysPagedcapscountat 1,000:The route then does
.unwrap_or_default(), so the error becomes an empty page.It does not look broken — it looks like a chain with nothing in flight, which is
exactly what mainnet legitimately looks like. This would have shipped and stayed
wrong indefinitely.
Found only because
ReversibleTransfers::NextTransactionIdis a plain counterand reads
5on Heisenberg, which contradicted the page.Why it did not show up in testing
GENESIS_LIMITis 500, under the cap, so genesis enumeration worked and gavefalse confidence in the machinery. The
System::Accountverification also useda small count. Every path that was checked happened to be under 1,000.
Fix
countinstorage_keys_paged— 1,000 is a protocol limit, not acaller's preference, so it belongs in the one place that knows about the RPC
rather than in each caller's constant.
A chain whose runtime lacks the pallet already returns 404, so a failure here
is a real fault and should say so.
1,000 entries is complete rather than quietly cut off.
Note
The same silent shape is worth grepping for:
unwrap_or_default()on anythingthat talks to a node turns "could not ask" into "the answer is nothing", and the
two are never the same.