Skip to content

Commit 14b472e

Browse files
committed
Keep protocol config overrides through epoch changes in simulacrum
1 parent 2303d21 commit 14b472e

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

crates/simulacrum/src/epoch_state.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,17 @@ pub struct EpochState {
3939

4040
impl EpochState {
4141
pub fn new(system_state: SuiSystemState) -> Self {
42+
let protocol_config =
43+
ProtocolConfig::get_for_version(system_state.protocol_version().into(), Chain::Unknown);
44+
Self::new_with_protocol_config(system_state, protocol_config)
45+
}
46+
47+
pub fn new_with_protocol_config(
48+
system_state: SuiSystemState,
49+
protocol_config: ProtocolConfig,
50+
) -> Self {
4251
let epoch_start_state = system_state.into_epoch_start_state();
4352
let committee = epoch_start_state.get_sui_committee();
44-
let protocol_config =
45-
ProtocolConfig::get_for_version(epoch_start_state.protocol_version(), Chain::Unknown);
4653
let registry = prometheus::Registry::new();
4754
let limits_metrics = Arc::new(LimitsMetrics::new(&registry));
4855
let bytecode_verifier_metrics = Arc::new(BytecodeVerifierMetrics::new(&registry));

crates/simulacrum/src/lib.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,10 @@ impl<R, S: store::SimulatorStore> Simulacrum<R, S> {
378378
self.execute_transaction(tx.into())
379379
.expect("advancing the epoch cannot fail");
380380

381-
let new_epoch_state = EpochState::new(self.store.get_system_state());
381+
let new_epoch_state = EpochState::new_with_protocol_config(
382+
self.store.get_system_state(),
383+
self.epoch_state.protocol_config().clone(),
384+
);
382385
let end_of_epoch_data = EndOfEpochData {
383386
next_epoch_committee: new_epoch_state.committee().voting_rights.clone(),
384387
next_epoch_protocol_version,

0 commit comments

Comments
 (0)