Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test that epoch flags are respected at epoch boundary without requiring a restart #18295

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions crates/sui-core/src/authority/authority_per_epoch_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -726,6 +726,7 @@ impl AuthorityPerEpochStore {
epoch_id
);
let epoch_start_configuration = Arc::new(epoch_start_configuration);
info!("epoch flags: {:?}", epoch_start_configuration.flags());
metrics.current_epoch.set(epoch_id as i64);
metrics
.current_voting_right
Expand Down
4 changes: 4 additions & 0 deletions crates/sui-core/src/state_accumulator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -629,6 +629,10 @@ impl StateAccumulatorV2 {
checkpoint_acc: Option<Accumulator>,
) -> SuiResult {
let _scope = monitored_scope("AccumulateRunningRoot");
tracing::info!(
"accumulating running root for checkpoint {}",
checkpoint_seq_num
);

// For the last checkpoint of the epoch, this function will be called once by the
// checkpoint builder, and again by checkpoint executor.
Expand Down
67 changes: 66 additions & 1 deletion crates/sui-e2e-tests/tests/reconfiguration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use futures::future::join_all;
use rand::rngs::OsRng;
use std::collections::{BTreeSet, HashSet};
use std::sync::Arc;
use std::sync::{Arc, Mutex};
use std::time::Duration;
use sui_core::consensus_adapter::position_submit_certificate;
use sui_json_rpc_types::SuiTransactionBlockEffectsAPI;
Expand Down Expand Up @@ -710,6 +710,71 @@ async fn do_test_reconfig_with_committee_change_stress() {
}
}

#[cfg(msim)]
#[sim_test]
async fn test_epoch_flag_upgrade() {
use std::any;

use sui_core::authority::epoch_start_configuration::EpochFlag;
use sui_core::authority::epoch_start_configuration::EpochStartConfigTrait;
use sui_macros::register_fail_point_arg;

let initial_flags_nodes = Arc::new(Mutex::new(HashSet::new()));
register_fail_point_arg("initial_epoch_flags", move || {
// only alter flags on each node once
let current_node = sui_simulator::current_simnode_id();

// override flags on up to 2 nodes.
let mut initial_flags_nodes = initial_flags_nodes.lock().unwrap();
if initial_flags_nodes.len() >= 2 || !initial_flags_nodes.insert(current_node) {
return None;
}

// start with no flags set
Some(Vec::<EpochFlag>::new())
});

let test_cluster = TestClusterBuilder::new()
.with_epoch_duration_ms(30000)
.build()
.await;

let mut any_empty = false;
for node in test_cluster.all_node_handles() {
any_empty = any_empty
|| node.with(|node| {
node.state()
.epoch_store_for_testing()
.epoch_start_config()
.flags()
.is_empty()
});
}
assert!(any_empty);

test_cluster.wait_for_epoch_all_nodes(1).await;

let mut any_empty = false;
for node in test_cluster.all_node_handles() {
any_empty = any_empty
|| node.with(|node| {
node.state()
.epoch_store_for_testing()
.epoch_start_config()
.flags()
.is_empty()
});
}
assert!(!any_empty);

sleep(Duration::from_secs(15)).await;

test_cluster.stop_all_validators().await;
test_cluster.start_all_validators().await;

test_cluster.wait_for_epoch_all_nodes(2).await;
}

#[cfg(msim)]
#[sim_test]
async fn safe_mode_reconfig_test() {
Expand Down
Loading