MCPcopy Create free account
hub / github.com/SeismicSystems/summit / create_checkpoint_initial_state

Function create_checkpoint_initial_state

finalizer/src/tests/syncing.rs:132–148  ·  view source on GitHub ↗

Create an initial state that looks like it came from a checkpoint at a non-zero height.

(
    checkpoint_hash: [u8; 32],
    height: u64,
    epoch: u64,
    epoch_length: NonZeroU64,
)

Source from the content-addressed store, hash-verified

130
131/// Create an initial state that looks like it came from a checkpoint at a non-zero height.
132fn create_checkpoint_initial_state(
133 checkpoint_hash: [u8; 32],
134 height: u64,
135 epoch: u64,
136 epoch_length: NonZeroU64,
137) -> ConsensusState {
138 let mut state = create_test_initial_state(checkpoint_hash, epoch_length);
139 state.set_latest_height(height);
140 state.set_view(height);
141 state.set_epoch(epoch);
142 state.set_forkchoice(ForkchoiceState {
143 head_block_hash: checkpoint_hash.into(),
144 safe_block_hash: checkpoint_hash.into(),
145 finalized_block_hash: checkpoint_hash.into(),
146 });
147 state
148}
149
150fn default_protocol_consts() -> ProtocolConsts {
151 ProtocolConsts {

Calls 5

set_forkchoiceMethod · 0.80
set_latest_heightMethod · 0.45
set_viewMethod · 0.45
set_epochMethod · 0.45

Tested by

no test coverage detected