Skip to main content

check_checkpoint_range

Function check_checkpoint_range 

Source
pub fn check_checkpoint_range(
    request: &ListPackageVersionsRequest,
    highest_indexed: u64,
) -> Result<()>
Expand description

Check the checkpoint range of a ListPackageVersions request against highest_indexed, the highest checkpoint the server has indexed, before the listing reads anything. Validate the request with validate_request first, and, for a package the server knows, check that its page token or cursors name the package’s lineage with PackageVersionsQuery::new, so a malformed request is refused as such whatever its range. Public so other implementors of MovePackageService refuse the same requests.

A descending listing that reaches past the highest indexed checkpoint is OUT_OF_RANGE (ABOVE_LATEST_AVAILABLE), as ListTransactions refuses it: an end_checkpoint above the checkpoint after it, or, with end_checkpoint unset, a start_checkpoint at or above that checkpoint. A descending listing starts at its range’s high end, so answering from this server’s view would skip the versions published between its tip and that end. An ascending listing is never refused for its range: it lists through the highest indexed checkpoint and ends with LEDGER_TIP (see PackageVersionsQuery::end_reason).