solana-test-validator now supports the --rpc-pubsub-enable-vote-subscription
flag
(cherry picked from commit 75658e2a96
)
This commit is contained in:
@ -14,7 +14,7 @@ use {
|
|||||||
},
|
},
|
||||||
solana_ledger::{blockstore::create_new_ledger, create_new_tmp_ledger},
|
solana_ledger::{blockstore::create_new_ledger, create_new_tmp_ledger},
|
||||||
solana_net_utils::PortRange,
|
solana_net_utils::PortRange,
|
||||||
solana_rpc::rpc::JsonRpcConfig,
|
solana_rpc::{rpc::JsonRpcConfig, rpc_pubsub_service::PubSubConfig},
|
||||||
solana_runtime::{
|
solana_runtime::{
|
||||||
genesis_utils::create_genesis_config_with_leader_ex,
|
genesis_utils::create_genesis_config_with_leader_ex,
|
||||||
hardened_unpack::MAX_GENESIS_ARCHIVE_UNPACKED_SIZE, snapshot_config::SnapshotConfig,
|
hardened_unpack::MAX_GENESIS_ARCHIVE_UNPACKED_SIZE, snapshot_config::SnapshotConfig,
|
||||||
@ -91,6 +91,7 @@ pub struct TestValidatorGenesis {
|
|||||||
tower_storage: Option<Arc<dyn TowerStorage>>,
|
tower_storage: Option<Arc<dyn TowerStorage>>,
|
||||||
pub rent: Rent,
|
pub rent: Rent,
|
||||||
rpc_config: JsonRpcConfig,
|
rpc_config: JsonRpcConfig,
|
||||||
|
pubsub_config: PubSubConfig,
|
||||||
rpc_ports: Option<(u16, u16)>, // (JsonRpc, JsonRpcPubSub), None == random ports
|
rpc_ports: Option<(u16, u16)>, // (JsonRpc, JsonRpcPubSub), None == random ports
|
||||||
warp_slot: Option<Slot>,
|
warp_slot: Option<Slot>,
|
||||||
no_bpf_jit: bool,
|
no_bpf_jit: bool,
|
||||||
@ -143,6 +144,11 @@ impl TestValidatorGenesis {
|
|||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn pubsub_config(&mut self, pubsub_config: PubSubConfig) -> &mut Self {
|
||||||
|
self.pubsub_config = pubsub_config;
|
||||||
|
self
|
||||||
|
}
|
||||||
|
|
||||||
pub fn rpc_port(&mut self, rpc_port: u16) -> &mut Self {
|
pub fn rpc_port(&mut self, rpc_port: u16) -> &mut Self {
|
||||||
self.rpc_ports = Some((rpc_port, rpc_port + 1));
|
self.rpc_ports = Some((rpc_port, rpc_port + 1));
|
||||||
self
|
self
|
||||||
@ -566,6 +572,7 @@ impl TestValidator {
|
|||||||
),
|
),
|
||||||
)),
|
)),
|
||||||
rpc_config: config.rpc_config.clone(),
|
rpc_config: config.rpc_config.clone(),
|
||||||
|
pubsub_config: config.pubsub_config.clone(),
|
||||||
accounts_hash_interval_slots: 100,
|
accounts_hash_interval_slots: 100,
|
||||||
account_paths: vec![ledger_path.join("accounts")],
|
account_paths: vec![ledger_path.join("accounts")],
|
||||||
poh_verify: false, // Skip PoH verification of ledger on startup for speed
|
poh_verify: false, // Skip PoH verification of ledger on startup for speed
|
||||||
|
@ -11,7 +11,7 @@ use {
|
|||||||
solana_client::rpc_client::RpcClient,
|
solana_client::rpc_client::RpcClient,
|
||||||
solana_core::tower_storage::FileTowerStorage,
|
solana_core::tower_storage::FileTowerStorage,
|
||||||
solana_faucet::faucet::{run_local_faucet_with_port, FAUCET_PORT},
|
solana_faucet::faucet::{run_local_faucet_with_port, FAUCET_PORT},
|
||||||
solana_rpc::rpc::JsonRpcConfig,
|
solana_rpc::{rpc::JsonRpcConfig, rpc_pubsub_service::PubSubConfig},
|
||||||
solana_sdk::{
|
solana_sdk::{
|
||||||
account::AccountSharedData,
|
account::AccountSharedData,
|
||||||
clock::Slot,
|
clock::Slot,
|
||||||
@ -154,6 +154,12 @@ fn main() {
|
|||||||
.validator(solana_validator::port_validator)
|
.validator(solana_validator::port_validator)
|
||||||
.help("Enable JSON RPC on this port, and the next port for the RPC websocket"),
|
.help("Enable JSON RPC on this port, and the next port for the RPC websocket"),
|
||||||
)
|
)
|
||||||
|
.arg(
|
||||||
|
Arg::with_name("rpc_pubsub_enable_vote_subscription")
|
||||||
|
.long("rpc-pubsub-enable-vote-subscription")
|
||||||
|
.takes_value(false)
|
||||||
|
.help("Enable the unstable RPC PubSub `voteSubscribe` subscription"),
|
||||||
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::with_name("bpf_program")
|
Arg::with_name("bpf_program")
|
||||||
.long("bpf-program")
|
.long("bpf-program")
|
||||||
@ -395,6 +401,7 @@ fn main() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
let rpc_port = value_t_or_exit!(matches, "rpc_port", u16);
|
let rpc_port = value_t_or_exit!(matches, "rpc_port", u16);
|
||||||
|
let enable_vote_subscription = matches.is_present("rpc_pubsub_enable_vote_subscription");
|
||||||
let faucet_port = value_t_or_exit!(matches, "faucet_port", u16);
|
let faucet_port = value_t_or_exit!(matches, "faucet_port", u16);
|
||||||
let slots_per_epoch = value_t!(matches, "slots_per_epoch", Slot).ok();
|
let slots_per_epoch = value_t!(matches, "slots_per_epoch", Slot).ok();
|
||||||
let gossip_host = matches.value_of("gossip_host").map(|gossip_host| {
|
let gossip_host = matches.value_of("gossip_host").map(|gossip_host| {
|
||||||
@ -601,6 +608,10 @@ fn main() {
|
|||||||
faucet_addr,
|
faucet_addr,
|
||||||
..JsonRpcConfig::default()
|
..JsonRpcConfig::default()
|
||||||
})
|
})
|
||||||
|
.pubsub_config(PubSubConfig {
|
||||||
|
enable_vote_subscription,
|
||||||
|
..PubSubConfig::default()
|
||||||
|
})
|
||||||
.bpf_jit(!matches.is_present("no_bpf_jit"))
|
.bpf_jit(!matches.is_present("no_bpf_jit"))
|
||||||
.rpc_port(rpc_port)
|
.rpc_port(rpc_port)
|
||||||
.add_programs_with_path(&programs_to_load)
|
.add_programs_with_path(&programs_to_load)
|
||||||
|
Reference in New Issue
Block a user