diff --git a/crates/sui-benchmark/tests/simtest.rs b/crates/sui-benchmark/tests/simtest.rs index f0d1dfa5cbe88..c844a640df349 100644 --- a/crates/sui-benchmark/tests/simtest.rs +++ b/crates/sui-benchmark/tests/simtest.rs @@ -89,29 +89,6 @@ mod test { test_simulated_load(test_cluster, 60).await; } - // Ensure that with half the committee enabling v2 and half not, - // we still arrive at the same root state hash (we do not split brain - // fork). - #[sim_test(config = "test_config()")] - async fn test_simulated_load_with_accumulator_v2_partial_upgrade() { - sui_protocol_config::ProtocolConfig::poison_get_for_min_version(); - let test_cluster = init_test_cluster_builder(4, 1000) - .with_authority_overload_config(AuthorityOverloadConfig { - // Disable system overload checks for the test - during tests with crashes, - // it is possible for overload protection to trigger due to validators - // having queued certs which are missing dependencies. - check_system_overload_at_execution: false, - check_system_overload_at_signing: false, - ..Default::default() - }) - .with_submit_delay_step_override_millis(3000) - .with_state_accumulator_v2_enabled_callback(Arc::new(|idx| idx % 2 == 0)) - .build() - .await - .into(); - test_simulated_load(test_cluster, 60).await; - } - #[sim_test(config = "test_config()")] async fn test_simulated_load_with_reconfig_and_correlated_crashes() { sui_protocol_config::ProtocolConfig::poison_get_for_min_version(); diff --git a/crates/sui-core/src/authority/authority_per_epoch_store.rs b/crates/sui-core/src/authority/authority_per_epoch_store.rs index e9e10e17555fd..91e3370975d24 100644 --- a/crates/sui-core/src/authority/authority_per_epoch_store.rs +++ b/crates/sui-core/src/authority/authority_per_epoch_store.rs @@ -933,15 +933,6 @@ impl AuthorityPerEpochStore { self.parent_path.clone() } - pub fn state_accumulator_v2_enabled(&self) -> bool { - let flag = match self.get_chain_identifier().chain() { - Chain::Unknown | Chain::Testnet => EpochFlag::StateAccumulatorV2EnabledTestnet, - Chain::Mainnet => EpochFlag::StateAccumulatorV2EnabledMainnet, - }; - - self.epoch_start_configuration.flags().contains(&flag) - } - pub fn executed_in_epoch_table_enabled(&self) -> bool { *self.executed_in_epoch_table_enabled.get_or_init(|| { self.epoch_start_configuration diff --git a/crates/sui-core/src/authority/authority_test_utils.rs b/crates/sui-core/src/authority/authority_test_utils.rs index 07d91da570ddd..9a1ea9b61338b 100644 --- a/crates/sui-core/src/authority/authority_test_utils.rs +++ b/crates/sui-core/src/authority/authority_test_utils.rs @@ -92,8 +92,7 @@ pub async fn execute_certificate_with_execution_error( // for testing and regression detection. // We must do this before sending to consensus, otherwise consensus may already // lead to transaction execution and state change. - let state_acc = - StateAccumulator::new_for_tests(authority.get_accumulator_store().clone(), &epoch_store); + let state_acc = StateAccumulator::new_for_tests(authority.get_accumulator_store().clone()); let include_wrapped_tombstone = !authority .epoch_store_for_testing() .protocol_config() diff --git a/crates/sui-core/src/authority/epoch_start_configuration.rs b/crates/sui-core/src/authority/epoch_start_configuration.rs index 59c445f57218d..00f2767b3cf90 100644 --- a/crates/sui-core/src/authority/epoch_start_configuration.rs +++ b/crates/sui-core/src/authority/epoch_start_configuration.rs @@ -63,26 +63,23 @@ pub enum EpochFlag { // This flag was "burned" because it was deployed with a broken version of the code. The // new flags below are required to enable state accumulator v2 _StateAccumulatorV2EnabledDeprecated = 4, - StateAccumulatorV2EnabledTestnet = 5, - StateAccumulatorV2EnabledMainnet = 6, + _StateAccumulatorV2EnabledTestnetDeprecated = 5, + _StateAccumulatorV2EnabledMainnetDeprecated = 6, ExecutedInEpochTable = 7, } impl EpochFlag { pub fn default_flags_for_new_epoch(config: &NodeConfig) -> Vec { - Self::default_flags_impl(&config.execution_cache, config.state_accumulator_v2) + Self::default_flags_impl(&config.execution_cache) } /// For situations in which there is no config available (e.g. setting up a downloaded snapshot). pub fn default_for_no_config() -> Vec { - Self::default_flags_impl(&Default::default(), true) + Self::default_flags_impl(&Default::default()) } - fn default_flags_impl( - cache_config: &ExecutionCacheConfig, - enable_state_accumulator_v2: bool, - ) -> Vec { + fn default_flags_impl(cache_config: &ExecutionCacheConfig) -> Vec { let mut new_flags = vec![EpochFlag::ExecutedInEpochTable]; if matches!( @@ -92,11 +89,6 @@ impl EpochFlag { new_flags.push(EpochFlag::WritebackCacheEnabled); } - if enable_state_accumulator_v2 { - new_flags.push(EpochFlag::StateAccumulatorV2EnabledTestnet); - new_flags.push(EpochFlag::StateAccumulatorV2EnabledMainnet); - } - new_flags } } @@ -119,11 +111,11 @@ impl fmt::Display for EpochFlag { write!(f, "StateAccumulatorV2EnabledDeprecated (DEPRECATED)") } EpochFlag::ExecutedInEpochTable => write!(f, "ExecutedInEpochTable"), - EpochFlag::StateAccumulatorV2EnabledTestnet => { - write!(f, "StateAccumulatorV2EnabledTestnet") + EpochFlag::_StateAccumulatorV2EnabledTestnetDeprecated => { + write!(f, "StateAccumulatorV2EnabledTestnet (DEPRECATED)") } - EpochFlag::StateAccumulatorV2EnabledMainnet => { - write!(f, "StateAccumulatorV2EnabledMainnet") + EpochFlag::_StateAccumulatorV2EnabledMainnetDeprecated => { + write!(f, "StateAccumulatorV2EnabledMainnet (DEPRECATED)") } } } diff --git a/crates/sui-core/src/checkpoints/checkpoint_executor/mod.rs b/crates/sui-core/src/checkpoints/checkpoint_executor/mod.rs index b1872a9f21723..6f0654eca7708 100644 --- a/crates/sui-core/src/checkpoints/checkpoint_executor/mod.rs +++ b/crates/sui-core/src/checkpoints/checkpoint_executor/mod.rs @@ -693,7 +693,6 @@ impl CheckpointExecutor { .expect("Failed to accumulate running root"); self.accumulator .accumulate_epoch(epoch_store.clone(), *checkpoint.sequence_number()) - .await .expect("Accumulating epoch cannot fail"); self.bump_highest_executed_checkpoint(checkpoint); diff --git a/crates/sui-core/src/checkpoints/checkpoint_executor/tests.rs b/crates/sui-core/src/checkpoints/checkpoint_executor/tests.rs index 544d08d11e778..65e365a840c05 100644 --- a/crates/sui-core/src/checkpoints/checkpoint_executor/tests.rs +++ b/crates/sui-core/src/checkpoints/checkpoint_executor/tests.rs @@ -391,11 +391,10 @@ async fn init_executor_test( let (checkpoint_sender, _): (Sender, Receiver) = broadcast::channel(buffer_size); - let epoch_store = state.epoch_store_for_testing(); - let accumulator = - StateAccumulator::new_for_tests(state.get_accumulator_store().clone(), &epoch_store); - let accumulator = Arc::new(accumulator); + let accumulator = Arc::new(StateAccumulator::new_for_tests( + state.get_accumulator_store().clone(), + )); let executor = CheckpointExecutor::new_for_tests( checkpoint_sender.subscribe(), diff --git a/crates/sui-core/src/checkpoints/mod.rs b/crates/sui-core/src/checkpoints/mod.rs index 2bf1dfaca8fcd..81f4fe16039a4 100644 --- a/crates/sui-core/src/checkpoints/mod.rs +++ b/crates/sui-core/src/checkpoints/mod.rs @@ -1452,9 +1452,7 @@ impl CheckpointBuilder { state_acc .accumulate_running_root(&self.epoch_store, sequence_number, Some(acc)) .await?; - state_acc - .digest_epoch(self.epoch_store.clone(), sequence_number) - .await? + state_acc.digest_epoch(self.epoch_store.clone(), sequence_number)? }; self.metrics.highest_accumulated_epoch.set(epoch as i64); info!("Epoch {epoch} root state hash digest: {root_state_digest:?}"); @@ -2516,7 +2514,6 @@ mod tests { let accumulator = Arc::new(StateAccumulator::new_for_tests( state.get_accumulator_store().clone(), - &epoch_store, )); let (checkpoint_service, _exit) = CheckpointService::spawn( diff --git a/crates/sui-core/src/state_accumulator.rs b/crates/sui-core/src/state_accumulator.rs index 8fc00b183c536..cbf94f24a8b28 100644 --- a/crates/sui-core/src/state_accumulator.rs +++ b/crates/sui-core/src/state_accumulator.rs @@ -43,18 +43,7 @@ impl StateAccumulatorMetrics { Arc::new(this) } } - -pub enum StateAccumulator { - V1(StateAccumulatorV1), - V2(StateAccumulatorV2), -} - -pub struct StateAccumulatorV1 { - store: Arc, - metrics: Arc, -} - -pub struct StateAccumulatorV2 { +pub struct StateAccumulator { store: Arc, metrics: Arc, } @@ -384,287 +373,12 @@ fn accumulate_effects_v3(effects: Vec) -> Accumulator { } impl StateAccumulator { - pub fn new( - store: Arc, - epoch_store: &Arc, - metrics: Arc, - ) -> Self { - if epoch_store.state_accumulator_v2_enabled() { - StateAccumulator::V2(StateAccumulatorV2::new(store, metrics)) - } else { - StateAccumulator::V1(StateAccumulatorV1::new(store, metrics)) - } - } - - pub fn new_for_tests( - store: Arc, - epoch_store: &Arc, - ) -> Self { - Self::new( - store, - epoch_store, - StateAccumulatorMetrics::new(&Registry::new()), - ) - } - - pub fn metrics(&self) -> Arc { - match self { - StateAccumulator::V1(impl_v1) => impl_v1.metrics.clone(), - StateAccumulator::V2(impl_v2) => impl_v2.metrics.clone(), - } - } - - pub fn set_inconsistent_state(&self, is_inconsistent_state: bool) { - match self { - StateAccumulator::V1(impl_v1) => &impl_v1.metrics, - StateAccumulator::V2(impl_v2) => &impl_v2.metrics, - } - .inconsistent_state - .set(is_inconsistent_state as i64); - } - - /// Accumulates the effects of a single checkpoint and persists the accumulator. - pub fn accumulate_checkpoint( - &self, - effects: Vec, - checkpoint_seq_num: CheckpointSequenceNumber, - epoch_store: &Arc, - ) -> SuiResult { - let _scope = monitored_scope("AccumulateCheckpoint"); - if let Some(acc) = epoch_store.get_state_hash_for_checkpoint(&checkpoint_seq_num)? { - return Ok(acc); - } - - let acc = self.accumulate_effects(effects, epoch_store.protocol_config()); - - epoch_store.insert_state_hash_for_checkpoint(&checkpoint_seq_num, &acc)?; - debug!("Accumulated checkpoint {}", checkpoint_seq_num); - - epoch_store - .checkpoint_state_notify_read - .notify(&checkpoint_seq_num, &acc); - - Ok(acc) - } - - pub async fn accumulate_running_root( - &self, - epoch_store: &AuthorityPerEpochStore, - checkpoint_seq_num: CheckpointSequenceNumber, - checkpoint_acc: Option, - ) -> SuiResult { - match self { - StateAccumulator::V1(_) => { - // V1 does not have a running root accumulator - Ok(()) - } - StateAccumulator::V2(impl_v2) => { - impl_v2 - .accumulate_running_root(epoch_store, checkpoint_seq_num, checkpoint_acc) - .await - } - } - } - - pub async fn accumulate_epoch( - &self, - epoch_store: Arc, - last_checkpoint_of_epoch: CheckpointSequenceNumber, - ) -> SuiResult { - match self { - StateAccumulator::V1(impl_v1) => { - impl_v1 - .accumulate_epoch(epoch_store, last_checkpoint_of_epoch) - .await - } - StateAccumulator::V2(impl_v2) => { - impl_v2.accumulate_epoch(epoch_store, last_checkpoint_of_epoch) - } - } - } - - pub fn accumulate_cached_live_object_set_for_testing( - &self, - include_wrapped_tombstone: bool, - ) -> Accumulator { - match self { - StateAccumulator::V1(impl_v1) => Self::accumulate_live_object_set_impl( - impl_v1 - .store - .iter_cached_live_object_set_for_testing(include_wrapped_tombstone), - ), - StateAccumulator::V2(impl_v2) => Self::accumulate_live_object_set_impl( - impl_v2 - .store - .iter_cached_live_object_set_for_testing(include_wrapped_tombstone), - ), - } - } - - /// Returns the result of accumulating the live object set, without side effects - pub fn accumulate_live_object_set(&self, include_wrapped_tombstone: bool) -> Accumulator { - match self { - StateAccumulator::V1(impl_v1) => Self::accumulate_live_object_set_impl( - impl_v1 - .store - .iter_live_object_set(include_wrapped_tombstone), - ), - StateAccumulator::V2(impl_v2) => Self::accumulate_live_object_set_impl( - impl_v2 - .store - .iter_live_object_set(include_wrapped_tombstone), - ), - } - } - - /// Accumulates given effects and returns the accumulator without side effects. - pub fn accumulate_effects( - &self, - effects: Vec, - protocol_config: &ProtocolConfig, - ) -> Accumulator { - match self { - StateAccumulator::V1(impl_v1) => impl_v1.accumulate_effects(effects, protocol_config), - StateAccumulator::V2(impl_v2) => impl_v2.accumulate_effects(effects, protocol_config), - } - } - - fn accumulate_live_object_set_impl(iter: impl Iterator) -> Accumulator { - let mut acc = Accumulator::default(); - iter.for_each(|live_object| { - Self::accumulate_live_object(&mut acc, &live_object); - }); - acc - } - - pub fn accumulate_live_object(acc: &mut Accumulator, live_object: &LiveObject) { - match live_object { - LiveObject::Normal(object) => { - acc.insert(object.compute_object_reference().2); - } - LiveObject::Wrapped(key) => { - acc.insert( - bcs::to_bytes(&WrappedObject::new(key.0, key.1)) - .expect("Failed to serialize WrappedObject"), - ); - } - } - } - - pub fn digest_live_object_set( - &self, - include_wrapped_tombstone: bool, - ) -> ECMHLiveObjectSetDigest { - let acc = self.accumulate_live_object_set(include_wrapped_tombstone); - acc.digest().into() - } - - pub async fn digest_epoch( - &self, - epoch_store: Arc, - last_checkpoint_of_epoch: CheckpointSequenceNumber, - ) -> SuiResult { - Ok(self - .accumulate_epoch(epoch_store, last_checkpoint_of_epoch) - .await? - .digest() - .into()) - } -} - -impl StateAccumulatorV1 { pub fn new(store: Arc, metrics: Arc) -> Self { Self { store, metrics } } - /// Unions all checkpoint accumulators at the end of the epoch to generate the - /// root state hash and persists it to db. This function is idempotent. Can be called on - /// non-consecutive epochs, e.g. to accumulate epoch 3 after having last - /// accumulated epoch 1. - pub async fn accumulate_epoch( - &self, - epoch_store: Arc, - last_checkpoint_of_epoch: CheckpointSequenceNumber, - ) -> SuiResult { - let _scope = monitored_scope("AccumulateEpochV1"); - let epoch = epoch_store.epoch(); - if let Some((_checkpoint, acc)) = self.store.get_root_state_accumulator_for_epoch(epoch)? { - return Ok(acc); - } - - // Get the next checkpoint to accumulate (first checkpoint of the epoch) - // by adding 1 to the highest checkpoint of the previous epoch - let (_highest_epoch, (next_to_accumulate, mut root_state_accumulator)) = self - .store - .get_root_state_accumulator_for_highest_epoch()? - .map(|(epoch, (checkpoint, acc))| { - ( - epoch, - ( - checkpoint - .checked_add(1) - .expect("Overflowed u64 for epoch ID"), - acc, - ), - ) - }) - .unwrap_or((0, (0, Accumulator::default()))); - - debug!( - "Accumulating epoch {} from checkpoint {} to checkpoint {} (inclusive)", - epoch, next_to_accumulate, last_checkpoint_of_epoch - ); - - let (checkpoints, mut accumulators) = epoch_store - .get_accumulators_in_checkpoint_range(next_to_accumulate, last_checkpoint_of_epoch)? - .into_iter() - .unzip::<_, _, Vec<_>, Vec<_>>(); - - let remaining_checkpoints: Vec<_> = (next_to_accumulate..=last_checkpoint_of_epoch) - .filter(|seq_num| !checkpoints.contains(seq_num)) - .collect(); - - if !remaining_checkpoints.is_empty() { - debug!( - "Awaiting accumulation of checkpoints {:?} for epoch {} accumulation", - remaining_checkpoints, epoch - ); - } - - let mut remaining_accumulators = epoch_store - .notify_read_checkpoint_state_digests(remaining_checkpoints) - .await - .expect("Failed to notify read checkpoint state digests"); - - accumulators.append(&mut remaining_accumulators); - - assert!(accumulators.len() == (last_checkpoint_of_epoch - next_to_accumulate + 1) as usize); - - for acc in accumulators { - root_state_accumulator.union(&acc); - } - - self.store.insert_state_accumulator_for_epoch( - epoch, - &last_checkpoint_of_epoch, - &root_state_accumulator, - )?; - - Ok(root_state_accumulator) - } - - pub fn accumulate_effects( - &self, - effects: Vec, - protocol_config: &ProtocolConfig, - ) -> Accumulator { - accumulate_effects(&*self.store, effects, protocol_config) - } -} - -impl StateAccumulatorV2 { - pub fn new(store: Arc, metrics: Arc) -> Self { - Self { store, metrics } + pub fn new_for_tests(store: Arc) -> Self { + Self::new(store, StateAccumulatorMetrics::new(&Registry::new())) } pub async fn accumulate_running_root( @@ -761,7 +475,7 @@ impl StateAccumulatorV2 { epoch_store: Arc, last_checkpoint_of_epoch: CheckpointSequenceNumber, ) -> SuiResult { - let _scope = monitored_scope("AccumulateEpochV2"); + let _scope = monitored_scope("AccumulateEpoch"); let running_root = epoch_store .get_running_root_accumulator(&last_checkpoint_of_epoch)? .expect("Expected running root accumulator to exist up to last checkpoint of epoch"); @@ -786,4 +500,96 @@ impl StateAccumulatorV2 { ) -> Accumulator { accumulate_effects(&*self.store, effects, protocol_config) } + + pub fn metrics(&self) -> Arc { + self.metrics.clone() + } + + pub fn set_inconsistent_state(&self, is_inconsistent_state: bool) { + self.metrics + .inconsistent_state + .set(is_inconsistent_state as i64); + } + + /// Accumulates the effects of a single checkpoint and persists the accumulator. + pub fn accumulate_checkpoint( + &self, + effects: Vec, + checkpoint_seq_num: CheckpointSequenceNumber, + epoch_store: &Arc, + ) -> SuiResult { + let _scope = monitored_scope("AccumulateCheckpoint"); + if let Some(acc) = epoch_store.get_state_hash_for_checkpoint(&checkpoint_seq_num)? { + return Ok(acc); + } + + let acc = self.accumulate_effects(effects, epoch_store.protocol_config()); + + epoch_store.insert_state_hash_for_checkpoint(&checkpoint_seq_num, &acc)?; + debug!("Accumulated checkpoint {}", checkpoint_seq_num); + + epoch_store + .checkpoint_state_notify_read + .notify(&checkpoint_seq_num, &acc); + + Ok(acc) + } + + pub fn accumulate_cached_live_object_set_for_testing( + &self, + include_wrapped_tombstone: bool, + ) -> Accumulator { + Self::accumulate_live_object_set_impl( + self.store + .iter_cached_live_object_set_for_testing(include_wrapped_tombstone), + ) + } + + /// Returns the result of accumulating the live object set, without side effects + pub fn accumulate_live_object_set(&self, include_wrapped_tombstone: bool) -> Accumulator { + Self::accumulate_live_object_set_impl( + self.store.iter_live_object_set(include_wrapped_tombstone), + ) + } + + fn accumulate_live_object_set_impl(iter: impl Iterator) -> Accumulator { + let mut acc = Accumulator::default(); + iter.for_each(|live_object| { + Self::accumulate_live_object(&mut acc, &live_object); + }); + acc + } + + pub fn accumulate_live_object(acc: &mut Accumulator, live_object: &LiveObject) { + match live_object { + LiveObject::Normal(object) => { + acc.insert(object.compute_object_reference().2); + } + LiveObject::Wrapped(key) => { + acc.insert( + bcs::to_bytes(&WrappedObject::new(key.0, key.1)) + .expect("Failed to serialize WrappedObject"), + ); + } + } + } + + pub fn digest_live_object_set( + &self, + include_wrapped_tombstone: bool, + ) -> ECMHLiveObjectSetDigest { + let acc = self.accumulate_live_object_set(include_wrapped_tombstone); + acc.digest().into() + } + + pub fn digest_epoch( + &self, + epoch_store: Arc, + last_checkpoint_of_epoch: CheckpointSequenceNumber, + ) -> SuiResult { + Ok(self + .accumulate_epoch(epoch_store, last_checkpoint_of_epoch)? + .digest() + .into()) + } } diff --git a/crates/sui-core/src/test_utils.rs b/crates/sui-core/src/test_utils.rs index 190e30caedd60..a18cc9427906a 100644 --- a/crates/sui-core/src/test_utils.rs +++ b/crates/sui-core/src/test_utils.rs @@ -79,8 +79,7 @@ pub async fn send_and_confirm_transaction( // // We also check the incremental effects of the transaction on the live object set against StateAccumulator // for testing and regression detection - let state_acc = - StateAccumulator::new_for_tests(authority.get_accumulator_store().clone(), &epoch_store); + let state_acc = StateAccumulator::new_for_tests(authority.get_accumulator_store().clone()); let include_wrapped_tombstone = !authority .epoch_store_for_testing() .protocol_config() diff --git a/crates/sui-core/src/unit_tests/narwhal_manager_tests.rs b/crates/sui-core/src/unit_tests/narwhal_manager_tests.rs index 5f6e52ebfd15e..2ebba6bb79985 100644 --- a/crates/sui-core/src/unit_tests/narwhal_manager_tests.rs +++ b/crates/sui-core/src/unit_tests/narwhal_manager_tests.rs @@ -72,7 +72,6 @@ pub fn checkpoint_service_for_testing(state: Arc) -> Arc(10); diff --git a/crates/sui-node/src/lib.rs b/crates/sui-node/src/lib.rs index e42d0eb6e9035..19be0553a59bf 100644 --- a/crates/sui-node/src/lib.rs +++ b/crates/sui-node/src/lib.rs @@ -739,7 +739,6 @@ impl SuiNode { let accumulator = Arc::new(StateAccumulator::new( cache_traits.accumulator_store.clone(), - &epoch_store, StateAccumulatorMetrics::new(&prometheus_registry), )); @@ -1673,7 +1672,6 @@ impl SuiNode { .metrics(); let new_accumulator = Arc::new(StateAccumulator::new( self.state.get_accumulator_store().clone(), - &new_epoch_store, accumulator_metrics, )); let weak_accumulator = Arc::downgrade(&new_accumulator); @@ -1727,7 +1725,6 @@ impl SuiNode { .metrics(); let new_accumulator = Arc::new(StateAccumulator::new( self.state.get_accumulator_store().clone(), - &new_epoch_store, accumulator_metrics, )); let weak_accumulator = Arc::downgrade(&new_accumulator); diff --git a/crates/sui-single-node-benchmark/src/single_node.rs b/crates/sui-single-node-benchmark/src/single_node.rs index 5bea4521f65bc..0e58e77027130 100644 --- a/crates/sui-single-node-benchmark/src/single_node.rs +++ b/crates/sui-single-node-benchmark/src/single_node.rs @@ -277,7 +277,6 @@ impl SingleValidator { validator.clone(), Arc::new(StateAccumulator::new_for_tests( validator.get_accumulator_store().clone(), - self.get_epoch_store(), )), ); (checkpoint_executor, ckpt_sender) diff --git a/crates/sui-swarm-config/src/network_config_builder.rs b/crates/sui-swarm-config/src/network_config_builder.rs index a1ca29d1391a8..5d5a92a81551d 100644 --- a/crates/sui-swarm-config/src/network_config_builder.rs +++ b/crates/sui-swarm-config/src/network_config_builder.rs @@ -75,7 +75,6 @@ pub struct ConfigBuilder { firewall_config: Option, max_submit_position: Option, submit_delay_step_override_millis: Option, - state_accumulator_v2_enabled_config: Option, } impl ConfigBuilder { @@ -96,7 +95,6 @@ impl ConfigBuilder { firewall_config: None, max_submit_position: None, submit_delay_step_override_millis: None, - state_accumulator_v2_enabled_config: None, } } @@ -214,29 +212,6 @@ impl ConfigBuilder { self } - pub fn with_state_accumulator_v2_enabled(mut self, enabled: bool) -> Self { - self.state_accumulator_v2_enabled_config = - Some(StateAccumulatorV2EnabledConfig::Global(enabled)); - self - } - - pub fn with_state_accumulator_v2_enabled_callback( - mut self, - func: StateAccumulatorV2EnabledCallback, - ) -> Self { - self.state_accumulator_v2_enabled_config = - Some(StateAccumulatorV2EnabledConfig::PerValidator(func)); - self - } - - pub fn with_state_accumulator_v2_enabled_config( - mut self, - c: StateAccumulatorV2EnabledConfig, - ) -> Self { - self.state_accumulator_v2_enabled_config = Some(c); - self - } - pub fn with_authority_overload_config(mut self, c: AuthorityOverloadConfig) -> Self { self.authority_overload_config = Some(c); self @@ -282,7 +257,6 @@ impl ConfigBuilder { firewall_config: self.firewall_config, max_submit_position: self.max_submit_position, submit_delay_step_override_millis: self.submit_delay_step_override_millis, - state_accumulator_v2_enabled_config: self.state_accumulator_v2_enabled_config, } } @@ -463,14 +437,6 @@ impl ConfigBuilder { }; builder = builder.with_supported_protocol_versions(supported_versions); } - if let Some(acc_v2_config) = &self.state_accumulator_v2_enabled_config { - let state_accumulator_v2_enabled: bool = match acc_v2_config { - StateAccumulatorV2EnabledConfig::Global(enabled) => *enabled, - StateAccumulatorV2EnabledConfig::PerValidator(func) => func(idx), - }; - builder = - builder.with_state_accumulator_v2_enabled(state_accumulator_v2_enabled); - } if let Some(num_unpruned_validators) = self.num_unpruned_validators { if idx < num_unpruned_validators { builder = builder.with_unpruned_checkpoints(); diff --git a/crates/sui-swarm-config/src/node_config_builder.rs b/crates/sui-swarm-config/src/node_config_builder.rs index 59293909d7217..c37566e13c4a0 100644 --- a/crates/sui-swarm-config/src/node_config_builder.rs +++ b/crates/sui-swarm-config/src/node_config_builder.rs @@ -110,11 +110,6 @@ impl ValidatorConfigBuilder { self } - pub fn with_state_accumulator_v2_enabled(mut self, enabled: bool) -> Self { - self.state_accumulator_v2 = enabled; - self - } - pub fn build( self, validator: ValidatorGenesisConfig, diff --git a/crates/sui-swarm/src/memory/swarm.rs b/crates/sui-swarm/src/memory/swarm.rs index d6a4cb2c7911b..c894f5d7e3900 100644 --- a/crates/sui-swarm/src/memory/swarm.rs +++ b/crates/sui-swarm/src/memory/swarm.rs @@ -23,8 +23,7 @@ use sui_protocol_config::ProtocolVersion; use sui_swarm_config::genesis_config::{AccountConfig, GenesisConfig, ValidatorGenesisConfig}; use sui_swarm_config::network_config::NetworkConfig; use sui_swarm_config::network_config_builder::{ - CommitteeConfig, ConfigBuilder, ProtocolVersionsConfig, StateAccumulatorV2EnabledConfig, - SupportedProtocolVersionsCallback, + CommitteeConfig, ConfigBuilder, ProtocolVersionsConfig, SupportedProtocolVersionsCallback, }; use sui_swarm_config::node_config_builder::FullnodeConfigBuilder; use sui_types::base_types::AuthorityName; @@ -57,7 +56,6 @@ pub struct SwarmBuilder { fullnode_fw_config: Option, max_submit_position: Option, submit_delay_step_override_millis: Option, - state_accumulator_v2_enabled_config: StateAccumulatorV2EnabledConfig, } impl SwarmBuilder { @@ -85,7 +83,6 @@ impl SwarmBuilder { fullnode_fw_config: None, max_submit_position: None, submit_delay_step_override_millis: None, - state_accumulator_v2_enabled_config: StateAccumulatorV2EnabledConfig::Global(true), } } } @@ -115,7 +112,6 @@ impl SwarmBuilder { fullnode_fw_config: self.fullnode_fw_config, max_submit_position: self.max_submit_position, submit_delay_step_override_millis: self.submit_delay_step_override_millis, - state_accumulator_v2_enabled_config: self.state_accumulator_v2_enabled_config, } } @@ -224,14 +220,6 @@ impl SwarmBuilder { self } - pub fn with_state_accumulator_v2_enabled_config( - mut self, - c: StateAccumulatorV2EnabledConfig, - ) -> Self { - self.state_accumulator_v2_enabled_config = c; - self - } - pub fn with_fullnode_supported_protocol_versions_config( mut self, c: ProtocolVersionsConfig, @@ -351,9 +339,6 @@ impl SwarmBuilder { .with_supported_protocol_versions_config( self.supported_protocol_versions_config.clone(), ) - .with_state_accumulator_v2_enabled_config( - self.state_accumulator_v2_enabled_config.clone(), - ) .build() }); diff --git a/crates/test-cluster/src/lib.rs b/crates/test-cluster/src/lib.rs index 8740c39577349..41a6f3de5d97a 100644 --- a/crates/test-cluster/src/lib.rs +++ b/crates/test-cluster/src/lib.rs @@ -49,8 +49,7 @@ use sui_swarm_config::genesis_config::{ }; use sui_swarm_config::network_config::NetworkConfig; use sui_swarm_config::network_config_builder::{ - ProtocolVersionsConfig, StateAccumulatorV2EnabledCallback, StateAccumulatorV2EnabledConfig, - SupportedProtocolVersionsCallback, + ProtocolVersionsConfig, SupportedProtocolVersionsCallback, }; use sui_swarm_config::node_config_builder::{FullnodeConfigBuilder, ValidatorConfigBuilder}; use sui_test_transaction_builder::TestTransactionBuilder; @@ -912,7 +911,6 @@ pub struct TestClusterBuilder { max_submit_position: Option, submit_delay_step_override_millis: Option, - validator_state_accumulator_v2_enabled_config: StateAccumulatorV2EnabledConfig, } impl TestClusterBuilder { @@ -939,9 +937,6 @@ impl TestClusterBuilder { fullnode_fw_config: None, max_submit_position: None, submit_delay_step_override_millis: None, - validator_state_accumulator_v2_enabled_config: StateAccumulatorV2EnabledConfig::Global( - true, - ), } } @@ -1064,15 +1059,6 @@ impl TestClusterBuilder { self } - pub fn with_state_accumulator_v2_enabled_callback( - mut self, - func: StateAccumulatorV2EnabledCallback, - ) -> Self { - self.validator_state_accumulator_v2_enabled_config = - StateAccumulatorV2EnabledConfig::PerValidator(func); - self - } - pub fn with_validator_candidates( mut self, addresses: impl IntoIterator, @@ -1388,9 +1374,6 @@ impl TestClusterBuilder { .with_supported_protocol_versions_config( self.validator_supported_protocol_versions_config.clone(), ) - .with_state_accumulator_v2_enabled_config( - self.validator_state_accumulator_v2_enabled_config.clone(), - ) .with_fullnode_count(1) .with_fullnode_supported_protocol_versions_config( self.fullnode_supported_protocol_versions_config