Skip to main content

sync

Function sync 

Source
pub async fn sync<DB, R>(
    config: Config<DB, R>,
) -> Result<DB, Error<DB::Family, R::Error, DB::Digest>>
where DB: Database, R: CompactDbResolver<DB>,
Expand description

Create/open a compact-storage database and initialize it from compact authenticated state.

Unlike streaming sync, compact sync jumps directly to target.leaf_count. This path authenticates the final commit and frontier state for the target root rather than replaying a retained operation range.

Verification order:

  1. Fetch the proposed compact state for target.
  2. Verify the final commit proof against target.root.
  3. Rebuild the compact frontier in memory and compare its root against target.root.
  4. Build the compact db from that already-validated state.
  5. Assert the db root still matches and persist the state.

Any failure leaves the local compact db unopened or unchanged on disk.