Skip to content

sdk: stop the private document page walk from starting chunk fetches past a read's page budget #6071

Open

Description

@QuantumExplorer

Basic explanation

Sdk::private_document_pages walks a private type's store with private_document_page_walk. Once a proof sets the chunk size, whole_chunk_pages fetches the remaining chunks through .buffered(max_concurrent), which starts a new fetch each time one is yielded. A caller that takes only max_pages pages (IdentityWallet::read_private_document_entries from #6052) drops the stream afterwards. By then up to min(max_pages, 16) - 1 fetches have already started, and their proofs are thrown away. An 8-page read can start 14 chunk fetches and use 7.

Suggested change

Give private_document_page_walk and whole_chunk_pages an optional page limit applied to the chunk starts (starts.take(n)). Pass no limit from private_document_pages_with_heights, which the DashPay sync and the shielded coordinator use, so they are unchanged. Pass the read's budget from private_document_pages. Test the started positions with the existing InFlight helper.

This costs traffic and node work, not correctness. Raised in the review of #6052.

🤖 Generated with Claude Code

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions