Skip to content

Commit

Permalink
Make EpochFlag values explicit to avoid mistakes when cherry picking (M…
Browse files Browse the repository at this point in the history
…ystenLabs#18683)

This is intended to prevent mistakes such as the one being fixed by
MystenLabs#18682
  • Loading branch information
mystenmark authored and tx-tomcat committed Jul 29, 2024
1 parent fd9cb55 commit 800c111
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions crates/sui-core/src/authority/epoch_start_configuration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,24 +41,32 @@ pub trait EpochStartConfigTrait {
}
}

// IMPORTANT: Assign explicit values to each variant to ensure that the values are stable.
// When cherry-picking changes from one branch to another, the value of variants must never
// change.
//
// Unlikely: If you cherry pick a change from one branch to another, and there is a collision
// in the value of some variant, the branch which has been released should take precedence.
// In this case, the picked-from branch is inconsistent with the released branch, and must
// be fixed.
#[derive(Clone, Debug, Serialize, Deserialize, Eq, PartialEq)]
pub enum EpochFlag {
// The deprecated flags have all been in production for long enough that
// we can have deleted the old code paths they were guarding.
// We retain them here in order not to break deserialization.
_InMemoryCheckpointRootsDeprecated,
_PerEpochFinalizedTransactionsDeprecated,
_ObjectLockSplitTablesDeprecated,
_InMemoryCheckpointRootsDeprecated = 0,
_PerEpochFinalizedTransactionsDeprecated = 1,
_ObjectLockSplitTablesDeprecated = 2,

WritebackCacheEnabled,
WritebackCacheEnabled = 3,

// 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,
StateAccumulatorV2EnabledTestnet,
StateAccumulatorV2EnabledMainnet,
_StateAccumulatorV2EnabledDeprecated = 4,
StateAccumulatorV2EnabledTestnet = 5,
StateAccumulatorV2EnabledMainnet = 6,

ExecutedInEpochTable,
ExecutedInEpochTable = 7,
}

impl EpochFlag {
Expand Down

0 comments on commit 800c111

Please sign in to comment.