Skip to content

Commit

Permalink
[core] Force enable state accumulator v2 (#19231)
Browse files Browse the repository at this point in the history
## Description 

We have removed the ability to disable state accumulator v2 previously
by ignoring the config parameter
(#18786), however if a node that
had v2 disabled has been running since before this change without
shutting down, the old config would still be stored in memory. This PR
forces enabling of v2. Once we have reached the epoch change after all
nodes are running this code, we can safely merge
#18764.

## Test plan 

Existing tests

---

## Release notes

Check each box that your changes affect. If none of the boxes relate to
your changes, release notes aren't required.

For each box you select, include information after the relevant heading
that describes the impact of your changes that a user might notice and
any actions they must take to implement updates.

- [ ] Protocol: 
- [ ] Nodes (Validators and Full nodes): 
- [ ] Indexer: 
- [ ] JSON-RPC: 
- [ ] GraphQL: 
- [ ] CLI: 
- [ ] Rust SDK:
- [ ] REST API:
  • Loading branch information
williampsmith authored Sep 6, 2024
1 parent 26afa0c commit 072ebd9
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions crates/sui-core/src/authority/epoch_start_configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,19 +71,20 @@ pub enum EpochFlag {

impl EpochFlag {
pub fn default_flags_for_new_epoch(config: &NodeConfig) -> Vec<Self> {
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> {
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<Self> {
let mut new_flags = vec![EpochFlag::ExecutedInEpochTable];
fn default_flags_impl(cache_config: &ExecutionCacheConfig) -> Vec<Self> {
let mut new_flags = vec![
EpochFlag::ExecutedInEpochTable,
EpochFlag::StateAccumulatorV2EnabledTestnet,
EpochFlag::StateAccumulatorV2EnabledMainnet,
];

if matches!(
choose_execution_cache(cache_config),
Expand All @@ -92,11 +93,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
}
}
Expand Down

0 comments on commit 072ebd9

Please sign in to comment.