From d23368047577fb0c6d50f153e924b0242d44d72a Mon Sep 17 00:00:00 2001 From: William Smith Date: Thu, 27 Jun 2024 11:09:22 -0700 Subject: [PATCH] [StateAccumulatorV2] Re-enable on testnet as per epoch component --- .../src/authority/epoch_start_configuration.rs | 2 +- crates/sui-core/src/state_accumulator.rs | 16 +++++++--------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/crates/sui-core/src/authority/epoch_start_configuration.rs b/crates/sui-core/src/authority/epoch_start_configuration.rs index 8c4947c350446..71b9906c61343 100644 --- a/crates/sui-core/src/authority/epoch_start_configuration.rs +++ b/crates/sui-core/src/authority/epoch_start_configuration.rs @@ -62,7 +62,7 @@ impl EpochFlag { /// 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(), false) + Self::default_flags_impl(&Default::default(), true) } fn default_flags_impl( diff --git a/crates/sui-core/src/state_accumulator.rs b/crates/sui-core/src/state_accumulator.rs index f67f150839721..8ec3b5f184b6d 100644 --- a/crates/sui-core/src/state_accumulator.rs +++ b/crates/sui-core/src/state_accumulator.rs @@ -5,7 +5,7 @@ use itertools::Itertools; use mysten_metrics::monitored_scope; use prometheus::{register_int_gauge_with_registry, IntGauge, Registry}; use serde::Serialize; -use sui_protocol_config::ProtocolConfig; +use sui_protocol_config::{Chain, ProtocolConfig}; use sui_types::base_types::{ObjectID, ObjectRef, SequenceNumber, VersionNumber}; use sui_types::committee::EpochId; use sui_types::digests::{ObjectDigest, TransactionDigest}; @@ -389,15 +389,13 @@ impl StateAccumulator { epoch_store: &Arc, metrics: Arc, ) -> Self { - if cfg!(msim) { - if epoch_store.state_accumulator_v2_enabled() { - return StateAccumulator::V2(StateAccumulatorV2::new(store, metrics)); - } else { - return StateAccumulator::V1(StateAccumulatorV1::new(store, metrics)); - } + if epoch_store.state_accumulator_v2_enabled() + && epoch_store.get_chain_identifier().chain() != Chain::Mainnet + { + StateAccumulator::V2(StateAccumulatorV2::new(store, metrics)) + } else { + StateAccumulator::V1(StateAccumulatorV1::new(store, metrics)) } - - StateAccumulator::V1(StateAccumulatorV1::new(store, metrics)) } pub fn new_for_tests(