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 6455f0696f4924..b26748a786d75a 100644 --- a/crates/sui-core/src/authority/authority_per_epoch_store.rs +++ b/crates/sui-core/src/authority/authority_per_epoch_store.rs @@ -925,9 +925,12 @@ impl AuthorityPerEpochStore { } pub fn state_accumulator_v2_enabled(&self) -> bool { - self.epoch_start_configuration - .flags() - .contains(&EpochFlag::StateAccumulatorV2Enabled) + 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 { diff --git a/crates/sui-core/src/authority/epoch_start_configuration.rs b/crates/sui-core/src/authority/epoch_start_configuration.rs index 19fa7ec2035cec..ba93d31ba312dc 100644 --- a/crates/sui-core/src/authority/epoch_start_configuration.rs +++ b/crates/sui-core/src/authority/epoch_start_configuration.rs @@ -57,7 +57,8 @@ pub enum EpochFlag { _StateAccumulatorV2EnabledDeprecated, ExecutedInEpochTable, - StateAccumulatorV2Enabled, + StateAccumulatorV2EnabledTestnet, + StateAccumulatorV2EnabledMainnet, } impl EpochFlag { @@ -84,7 +85,9 @@ impl EpochFlag { } if enable_state_accumulator_v2 { - new_flags.push(EpochFlag::StateAccumulatorV2Enabled); + new_flags.push(EpochFlag::StateAccumulatorV2EnabledTestnet); + // TODO: enable on mainnet + // new_flags.push(EpochFlag::StateAccumulatorV2EnabledMainnet); } new_flags @@ -109,7 +112,7 @@ impl fmt::Display for EpochFlag { write!(f, "StateAccumulatorV2EnabledDeprecated (DEPRECATED)") } EpochFlag::ExecutedInEpochTable => write!(f, "ExecutedInEpochTable"), - EpochFlag::StateAccumulatorV2Enabled => write!(f, "StateAccumulatorV2Enabled"), + EpochFlag::StateAccumulatorV2EnabledTestnet => write!(f, "StateAccumulatorV2Enabled"), } } } diff --git a/crates/sui-core/src/state_accumulator.rs b/crates/sui-core/src/state_accumulator.rs index 8ec3b5f184b6d6..ae594e4be3270c 100644 --- a/crates/sui-core/src/state_accumulator.rs +++ b/crates/sui-core/src/state_accumulator.rs @@ -389,9 +389,7 @@ impl StateAccumulator { epoch_store: &Arc, metrics: Arc, ) -> Self { - if epoch_store.state_accumulator_v2_enabled() - && epoch_store.get_chain_identifier().chain() != Chain::Mainnet - { + if epoch_store.state_accumulator_v2_enabled() { StateAccumulator::V2(StateAccumulatorV2::new(store, metrics)) } else { StateAccumulator::V1(StateAccumulatorV1::new(store, metrics))