From f1242ea6bcef9dd7fce9ec1305ce0df43830f173 Mon Sep 17 00:00:00 2001 From: Ashwin Sekar Date: Tue, 9 Apr 2024 18:46:29 +0000 Subject: [PATCH] consensus: add dev-context-only-utils to tower --- Cargo.lock | 1 + accounts-cluster-bench/Cargo.toml | 2 +- bench-tps/Cargo.toml | 7 +++++-- core/src/consensus.rs | 1 + dos/Cargo.toml | 5 +++++ local-cluster/Cargo.toml | 5 +++++ scripts/check-dev-context-only-utils.sh | 1 + transaction-dos/Cargo.toml | 2 ++ 8 files changed, 21 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5b55f3b0ba5..60055dabdf6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6078,6 +6078,7 @@ dependencies = [ "solana-quic-client", "solana-rpc", "solana-rpc-client", + "solana-runtime", "solana-sdk", "solana-streamer", "solana-tpu-client", diff --git a/accounts-cluster-bench/Cargo.toml b/accounts-cluster-bench/Cargo.toml index 3d8c8c721ca..8ff7cc12b26 100644 --- a/accounts-cluster-bench/Cargo.toml +++ b/accounts-cluster-bench/Cargo.toml @@ -33,7 +33,7 @@ spl-token = { workspace = true, features = ["no-entrypoint"] } [dev-dependencies] solana-accounts-db = { workspace = true } -solana-core = { workspace = true } +solana-core = { workspace = true, features = ["dev-context-only-utils"] } solana-local-cluster = { workspace = true } solana-runtime = { workspace = true, features = ["dev-context-only-utils"] } solana-test-validator = { workspace = true } diff --git a/bench-tps/Cargo.toml b/bench-tps/Cargo.toml index 80a09fc8048..afa927073dc 100644 --- a/bench-tps/Cargo.toml +++ b/bench-tps/Cargo.toml @@ -23,7 +23,7 @@ solana-clap-utils = { workspace = true } solana-cli-config = { workspace = true } solana-client = { workspace = true } solana-connection-cache = { workspace = true } -solana-core = { workspace = true } +solana-core = { workspace = true, features = ["dev-context-only-utils"] } solana-faucet = { workspace = true } solana-genesis = { workspace = true } solana-gossip = { workspace = true } @@ -36,7 +36,7 @@ solana-rpc = { workspace = true } solana-rpc-client = { workspace = true } solana-rpc-client-api = { workspace = true } solana-rpc-client-nonce-utils = { workspace = true } -solana-runtime = { workspace = true } +solana-runtime = { workspace = true, features = ["dev-context-only-utils"] } solana-sdk = { workspace = true } solana-streamer = { workspace = true } solana-tpu-client = { workspace = true } @@ -54,3 +54,6 @@ tempfile = { workspace = true } [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] + +[features] +dev-context-only-utils = [] diff --git a/core/src/consensus.rs b/core/src/consensus.rs index b9a65160328..c5c0bd90eb7 100644 --- a/core/src/consensus.rs +++ b/core/src/consensus.rs @@ -642,6 +642,7 @@ impl Tower { } } + #[cfg(feature = "dev-context-only-utils")] pub fn record_vote(&mut self, slot: Slot, hash: Hash) -> Option { self.record_bank_vote_and_update_lockouts(slot, hash) } diff --git a/dos/Cargo.toml b/dos/Cargo.toml index 0d7c76b007c..344f1bbc1da 100644 --- a/dos/Cargo.toml +++ b/dos/Cargo.toml @@ -38,4 +38,9 @@ solana-version = { workspace = true } targets = ["x86_64-unknown-linux-gnu"] [dev-dependencies] +solana-core = { workspace = true, features = ["dev-context-only-utils"] } solana-local-cluster = { workspace = true } +solana-runtime = { workspace = true, features = ["dev-context-only-utils"] } + +[features] +dev-context-only-utils = [] diff --git a/local-cluster/Cargo.toml b/local-cluster/Cargo.toml index 07b30030295..0d72a867c60 100644 --- a/local-cluster/Cargo.toml +++ b/local-cluster/Cargo.toml @@ -45,8 +45,13 @@ assert_matches = { workspace = true } fs_extra = { workspace = true } gag = { workspace = true } serial_test = { workspace = true } +solana-core = { workspace = true, features = ["dev-context-only-utils"] } solana-download-utils = { workspace = true } solana-ledger = { workspace = true, features = ["dev-context-only-utils"] } +solana-runtime = { workspace = true, features = ["dev-context-only-utils"] } [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] + +[features] +dev-context-only-utils = [] diff --git a/scripts/check-dev-context-only-utils.sh b/scripts/check-dev-context-only-utils.sh index 6a4f798c633..7f54b38c8ef 100755 --- a/scripts/check-dev-context-only-utils.sh +++ b/scripts/check-dev-context-only-utils.sh @@ -32,6 +32,7 @@ declare tainted_packages=( solana-accounts-bench solana-banking-bench agave-ledger-tool + solana-bench-tps ) # convert to comma separeted (ref: https://stackoverflow.com/a/53839433) diff --git a/transaction-dos/Cargo.toml b/transaction-dos/Cargo.toml index 58821a1b953..1a112b2ff34 100644 --- a/transaction-dos/Cargo.toml +++ b/transaction-dos/Cargo.toml @@ -31,7 +31,9 @@ solana-transaction-status = { workspace = true } solana-version = { workspace = true } [dev-dependencies] +solana-core = { workspace = true, features = ["dev-context-only-utils"] } solana-local-cluster = { workspace = true } +solana-runtime = { workspace = true, features = ["dev-context-only-utils"] } [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"]