/// Verify the state root hash of all blocks is in state and if not,
/// reconstruct the missing state. Assumes that there are no "holes" in
/// state, ie starting from genesis, state is present for all blocks up to some
/// point and then not at all.
Verify the state root hash of all blocks is in state and if not,
reconstruct the missing state. Assumes that there are no "holes" in
state, ie starting from genesis, state is present for all blocks up to some
point and then not at all.
Verify the state root hash of all blocks is in state and if not reconstruct the missing state . Assumes that there are no " holes " in state ie starting from genesis state is present for all blocks up to some point and then not at all .
pub fn verify_state(
    commit_store: &CommitStore,
    state_view_factory: &StateViewFactory,
    initial_state_root: &str,
    execution_task_submitter: &ExecutionTaskSubmitter,
    merkle_state: &CborMerkleState,
    scheduler_factory: &dyn SchedulerFactory,
) -> Result<(), StateVerificationError> {
    // check if we should do state verification
    let start =
        search_for_present_state_root(commit_store, state_view_factory, initial_state_root)?;
    let (start_block, prev_state_root) = match start {
        Some((block, state_root)) => (block, state_root),
        None => {
            info!("Skipping state verification: chain head's state root is present");
            return Ok(());
        }
    };
    info!(
        "Recomputing missing state from block {}",
        start_block.header().block_num()
    );
    let blocks = commit_store.get_block_by_height_iter(
        Some(start_block.header().block_num()),
        ByHeightDirection::Increasing,
    );
    process_blocks(
        &prev_state_root,
        blocks,
        execution_task_submitter,
        merkle_state,
        state_view_factory,
        scheduler_factory,
    )
}
pub fn verify_state ( commit_store : & CommitStore , state_view_factory : & StateViewFactory , initial_state_root : & str , execution_task_submitter : & ExecutionTaskSubmitter , merkle_state : & CborMerkleState , scheduler_factory : & dyn SchedulerFactory , ) -> Result < ( ) , StateVerificationError > { // check if we should do state verification let start = search_for_present_state_root ( commit_store , state_view_factory , initial_state_root ) ? ; let ( start_block , prev_state_root ) = match start { Some ( ( block , state_root ) ) => ( block , state_root ) , None => { info ! ( " " ) ; return Ok ( ( ) ) ; } } ; info ! ( " " start_block header ( ) block_num ( ) ) ; let blocks = commit_store . get_block_by_height_iter ( Some ( start_block . header ( ) . block_num ( ) ) , ByHeightDirection :: Increasing , ) ; process_blocks ( & prev_state_root , blocks , execution_task_submitter , merkle_state , state_view_factory , scheduler_factory , ) }
Verify the state root hash of all blocks is in state and if not,
reconstruct the missing state.
Verify the state root hash of all blocks is in state and if not reconstruct the missing state .
commit_store
&CommitStore
state_view_factory
&StateViewFactory
initial_state_root
&str
execution_task_submitter
&ExecutionTaskSubmitter
merkle_state
&CborMerkleState
scheduler_factory
&dyn SchedulerFactory