Skip to content

Commit

Permalink
[core] Make proper per epoch execution components
Browse files Browse the repository at this point in the history
  • Loading branch information
williampsmith committed Jun 16, 2024
1 parent 06c32a8 commit 1ab2f14
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions crates/sui-node/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1459,17 +1459,18 @@ impl SuiNode {
/// This function awaits the completion of checkpoint execution of the current epoch,
/// after which it iniitiates reconfiguration of the entire system.
pub async fn monitor_reconfiguration(self: Arc<Self>) -> Result<()> {
let mut checkpoint_executor = CheckpointExecutor::new(
self.state_sync_handle.subscribe_to_synced_checkpoints(),
self.checkpoint_store.clone(),
self.state.clone(),
self.accumulator.clone(),
self.config.checkpoint_executor_config.clone(),
&self.registry_service.default_registry(),
);

let run_with_range = self.config.run_with_range;
loop {
let mut checkpoint_executor = CheckpointExecutor::new(
self.state_sync_handle.subscribe_to_synced_checkpoints(),
self.checkpoint_store.clone(),
self.state.clone(),
self.accumulator.clone(),
self.config.checkpoint_executor_config.clone(),
&self.registry_service.default_registry(),
);

let run_with_range = self.config.run_with_range;

let cur_epoch_store = self.state.load_epoch_store_one_call_per_task();

// Advertise capabilities to committee, if we are a validator.
Expand Down Expand Up @@ -1568,6 +1569,7 @@ impl SuiNode {
// The following code handles 4 different cases, depending on whether the node
// was a validator in the previous epoch, and whether the node is a validator
// in the new epoch.

let new_validator_components = if let Some(ValidatorComponents {
validator_server_handle,
validator_overload_monitor_handle,
Expand All @@ -1594,6 +1596,10 @@ impl SuiNode {
&checkpoint_executor,
)
.await;
self.accumulator = Arc::new(StateAccumulator::new(
self.state.get_accumulator_store(),
&new_epoch_store,
));

consensus_epoch_data_remover
.remove_old_data(next_epoch - 1)
Expand Down

0 comments on commit 1ab2f14

Please sign in to comment.