Skip to content

Commit 8078644

Browse files
committed
Fix and future-proof test_epoch_flag_upgrade
1 parent 8013ee9 commit 8078644

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

crates/sui-core/src/authority/epoch_start_configuration.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ pub enum EpochFlag {
6868
// This flag indicates whether data quarantining has been enabled from the
6969
// beginning of the epoch.
7070
DataQuarantineFromBeginningOfEpoch = 9,
71+
72+
// Used for `test_epoch_flag_upgrade`.
73+
#[cfg(msim)]
74+
DummyFlag = 10,
7175
}
7276

7377
impl EpochFlag {
@@ -77,6 +81,16 @@ impl EpochFlag {
7781
Self::default_flags_impl()
7882
}
7983

84+
// Return flags that are mandatory for the current version of the code. This is used
85+
// so that `test_epoch_flag_upgrade` can still work correctly even when there are no
86+
// optional flags.
87+
pub fn mandatory_flags() -> Vec<Self> {
88+
vec![
89+
EpochFlag::UseVersionAssignmentTablesV3,
90+
EpochFlag::DataQuarantineFromBeginningOfEpoch,
91+
]
92+
}
93+
8094
/// For situations in which there is no config available (e.g. setting up a downloaded snapshot).
8195
pub fn default_for_no_config() -> Vec<Self> {
8296
Self::default_flags_impl()
@@ -86,6 +100,8 @@ impl EpochFlag {
86100
vec![
87101
EpochFlag::UseVersionAssignmentTablesV3,
88102
EpochFlag::DataQuarantineFromBeginningOfEpoch,
103+
#[cfg(msim)]
104+
EpochFlag::DummyFlag,
89105
]
90106
}
91107
}
@@ -124,6 +140,10 @@ impl fmt::Display for EpochFlag {
124140
EpochFlag::DataQuarantineFromBeginningOfEpoch => {
125141
write!(f, "DataQuarantineFromBeginningOfEpoch")
126142
}
143+
#[cfg(msim)]
144+
EpochFlag::DummyFlag => {
145+
write!(f, "DummyFlag")
146+
}
127147
}
128148
}
129149
}

crates/sui-e2e-tests/tests/reconfiguration_tests.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -739,8 +739,7 @@ async fn test_epoch_flag_upgrade() {
739739
return None;
740740
}
741741

742-
// start with only UseVersionAssignmentTablesV3
743-
let flags: Vec<EpochFlag> = vec![EpochFlag::UseVersionAssignmentTablesV3];
742+
let flags: Vec<EpochFlag> = EpochFlag::mandatory_flags();
744743
Some(flags)
745744
});
746745

0 commit comments

Comments
 (0)