Skip to content

Commit

Permalink
Switch block verification to the unified scheduler (#2653)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryoqun authored Aug 20, 2024
1 parent 7ae496a commit 9c6f4b7
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 12 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Release channels have their own copy of this changelog:
* `agave-validator`: Update PoH speed check to compare against current hash rate from a Bank (#2447)
* `solana-test-validator`: Add `--clone-feature-set` flag to mimic features from a target cluster (#2480)
* `solana-genesis`: the `--cluster-type` parameter now clones the feature set from the target cluster (#2587)
* `unified-scheduler` as default option for `--block-verification-method` (#2653)

## [2.0.0]
* Breaking
Expand Down
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 5 additions & 3 deletions core/src/validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ use {
time::{Duration, Instant},
},
strum::VariantNames,
strum_macros::{Display, EnumString, EnumVariantNames, IntoStaticStr},
strum_macros::{Display, EnumCount, EnumIter, EnumString, EnumVariantNames, IntoStaticStr},
thiserror::Error,
tokio::runtime::Runtime as TokioRuntime,
};
Expand All @@ -151,11 +151,13 @@ const WAIT_FOR_SUPERMAJORITY_THRESHOLD_PERCENT: u64 = 80;
const WAIT_FOR_WEN_RESTART_SUPERMAJORITY_THRESHOLD_PERCENT: u64 =
WAIT_FOR_SUPERMAJORITY_THRESHOLD_PERCENT;

#[derive(Clone, EnumString, EnumVariantNames, Default, IntoStaticStr, Display)]
#[derive(
Clone, EnumCount, EnumIter, EnumString, EnumVariantNames, Default, IntoStaticStr, Display,
)]
#[strum(serialize_all = "kebab-case")]
pub enum BlockVerificationMethod {
#[default]
BlockstoreProcessor,
#[default]
UnifiedScheduler,
}

Expand Down
1 change: 1 addition & 0 deletions local-cluster/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ solana-turbine = { workspace = true }
solana-vote = { workspace = true }
solana-vote-program = { workspace = true }
static_assertions = { workspace = true }
strum = { workspace = true, features = ["derive"] }
tempfile = { workspace = true }
trees = { workspace = true }

Expand Down
18 changes: 9 additions & 9 deletions local-cluster/tests/local_cluster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use {
gag::BufferRedirect,
itertools::Itertools,
log::*,
rand::seq::IteratorRandom,
rand::seq::SliceRandom,
serial_test::serial,
solana_accounts_db::{
hardened_unpack::open_genesis_config, utils::create_accounts_run_and_snapshot_dirs,
Expand Down Expand Up @@ -95,6 +95,7 @@ use {
thread::{sleep, Builder, JoinHandle},
time::{Duration, Instant},
},
strum::{EnumCount, IntoEnumIterator},
};

#[test]
Expand Down Expand Up @@ -5710,20 +5711,19 @@ fn test_randomly_mixed_block_verification_methods_between_bootstrap_and_not() {
info",
);

let num_nodes = 2;
let num_nodes = BlockVerificationMethod::COUNT;
let mut config = ClusterConfig::new_with_equal_stakes(
num_nodes,
DEFAULT_CLUSTER_LAMPORTS,
DEFAULT_NODE_STAKE,
);

// Randomly switch to use unified scheduler
config
.validator_configs
.iter_mut()
.choose(&mut rand::thread_rng())
.unwrap()
.block_verification_method = BlockVerificationMethod::UnifiedScheduler;
// Overwrite block_verification_method with shuffled variants
let mut methods = BlockVerificationMethod::iter().collect::<Vec<_>>();
methods.shuffle(&mut rand::thread_rng());
for (validator_config, method) in config.validator_configs.iter_mut().zip_eq(methods) {
validator_config.block_verification_method = method;
}

let local = LocalCluster::new(&mut config, SocketAddrSpace::Unspecified);
cluster_tests::spend_and_verify_all_nodes(
Expand Down

0 comments on commit 9c6f4b7

Please sign in to comment.