Module zebrad::commands::copy_state

source ·
Expand description

copy-state subcommand - copies state from one directory to another (debug only)

Copying state helps Zebra developers modify and debug cached state formats.

In order to test a new state format, blocks must be identical when they are:

  • read from the old format,
  • written to the new format, and
  • read from the new format.

The “old” and “new” states can also use the same format. This tests the low-level state API’s performance.

§Command Structure

Copying cached state uses the following services and tasks:

Tasks:

  • Old to New Copy Task
    • queries the source state for blocks, copies those blocks to the target state, then reads the copied blocks from the target state.

Services:

  • Source Old State Service
    • fetches blocks from the best finalized chain from permanent storage, in the old format
  • Target New State Service
    • writes best finalized chain blocks to permanent storage, in the new format
    • only performs essential contextual verification of blocks, to make sure that block data hasn’t been corrupted by receiving blocks in the new format
    • fetches blocks from the best finalized chain from permanent storage, in the new format

Structs§

Constants§