Skip to content

Commit

Permalink
pr feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
segfaultdoc committed Nov 6, 2023
1 parent edc7367 commit 9a033ba
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 23 deletions.
34 changes: 17 additions & 17 deletions core/src/validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -486,17 +486,17 @@ impl Validator {
cluster_entrypoints: Vec<ContactInfo>,
config: &ValidatorConfig,
should_check_duplicate_instance: bool,
runtime_plugin_configs_and_request_rx: Option<(
Vec<PathBuf>,
Receiver<RuntimePluginManagerRpcRequest>,
)>,
rpc_to_plugin_manager_receiver: Option<Receiver<GeyserPluginManagerRequest>>,
start_progress: Arc<RwLock<ValidatorStartProgress>>,
socket_addr_space: SocketAddrSpace,
use_quic: bool,
tpu_connection_pool_size: usize,
tpu_enable_udp: bool,
admin_rpc_service_post_init: Arc<RwLock<Option<AdminRpcRequestMetadataPostInit>>>,
runtime_plugin_configs_and_request_rx: Option<(
Vec<PathBuf>,
Receiver<RuntimePluginManagerRpcRequest>,
)>,
) -> Result<Self, String> {
let id = identity_keypair.pubkey();
assert_eq!(&id, node.info.pubkey());
Expand Down Expand Up @@ -867,17 +867,6 @@ impl Validator {
drop(bank_forks_guard);
let block_commitment_cache = Arc::new(RwLock::new(block_commitment_cache));

if let Some((runtime_plugin_configs, request_rx)) = runtime_plugin_configs_and_request_rx {
RuntimePluginService::start(
&runtime_plugin_configs,
request_rx,
bank_forks.clone(),
block_commitment_cache.clone(),
exit.clone(),
)
.unwrap();
}

let optimistically_confirmed_bank =
OptimisticallyConfirmedBank::locked_from_bank_forks_root(&bank_forks);

Expand All @@ -893,6 +882,17 @@ impl Validator {
None,
));

if let Some((runtime_plugin_configs, request_rx)) = runtime_plugin_configs_and_request_rx {
RuntimePluginService::start(
&runtime_plugin_configs,
request_rx,
bank_forks.clone(),
block_commitment_cache.clone(),
exit.clone(),
)
.map_err(|e| format!("Failed to start runtime plugin service: {e:?}"))?;
}

let max_slots = Arc::new(MaxSlots::default());
let (completed_data_sets_sender, completed_data_sets_receiver) =
bounded(MAX_COMPLETED_DATA_SETS_IN_CHANNEL);
Expand Down Expand Up @@ -2387,14 +2387,14 @@ mod tests {
vec![LegacyContactInfo::try_from(&leader_node.info).unwrap()],
&config,
true, // should_check_duplicate_instance
None,
None, // rpc_to_plugin_manager_receiver
start_progress.clone(),
SocketAddrSpace::Unspecified,
DEFAULT_TPU_USE_QUIC,
DEFAULT_TPU_CONNECTION_POOL_SIZE,
DEFAULT_TPU_ENABLE_UDP,
Arc::new(RwLock::new(None)),
None,
)
.expect("assume successful validator start");
assert_eq!(
Expand Down Expand Up @@ -2487,14 +2487,14 @@ mod tests {
vec![LegacyContactInfo::try_from(&leader_node.info).unwrap()],
&config,
true, // should_check_duplicate_instance
None,
None, // rpc_to_plugin_manager_receiver
Arc::new(RwLock::new(ValidatorStartProgress::default())),
SocketAddrSpace::Unspecified,
DEFAULT_TPU_USE_QUIC,
DEFAULT_TPU_CONNECTION_POOL_SIZE,
DEFAULT_TPU_ENABLE_UDP,
Arc::new(RwLock::new(None)),
None,
)
.expect("assume successful validator start")
})
Expand Down
6 changes: 3 additions & 3 deletions local-cluster/src/local_cluster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,14 +272,14 @@ impl LocalCluster {
vec![],
&leader_config,
true, // should_check_duplicate_instance
None,
None, // rpc_to_plugin_manager_receiver
Arc::new(RwLock::new(ValidatorStartProgress::default())),
socket_addr_space,
DEFAULT_TPU_USE_QUIC,
DEFAULT_TPU_CONNECTION_POOL_SIZE,
DEFAULT_TPU_ENABLE_UDP,
Arc::new(RwLock::new(None)),
None,
)
.expect("assume successful validator start");

Expand Down Expand Up @@ -488,14 +488,14 @@ impl LocalCluster {
vec![LegacyContactInfo::try_from(&self.entry_point_info).unwrap()],
&config,
true, // should_check_duplicate_instance
None,
None, // rpc_to_plugin_manager_receiver
Arc::new(RwLock::new(ValidatorStartProgress::default())),
socket_addr_space,
DEFAULT_TPU_USE_QUIC,
DEFAULT_TPU_CONNECTION_POOL_SIZE,
DEFAULT_TPU_ENABLE_UDP,
Arc::new(RwLock::new(None)),
None,
)
.expect("assume successful validator start");

Expand Down Expand Up @@ -882,14 +882,14 @@ impl Cluster for LocalCluster {
.unwrap_or_default(),
&safe_clone_config(&cluster_validator_info.config),
true, // should_check_duplicate_instance
None,
None, // rpc_to_plugin_manager_receiver
Arc::new(RwLock::new(ValidatorStartProgress::default())),
socket_addr_space,
DEFAULT_TPU_USE_QUIC,
DEFAULT_TPU_CONNECTION_POOL_SIZE,
DEFAULT_TPU_ENABLE_UDP,
Arc::new(RwLock::new(None)),
None,
)
.expect("assume successful validator start");
cluster_validator_info.validator = Some(restarted_node);
Expand Down
4 changes: 3 additions & 1 deletion runtime-plugin/src/runtime_plugin_service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@ impl RuntimePluginService {
}

pub fn join(self) {
self.rpc_thread.join().unwrap();
if let Err(e) = self.rpc_thread.join() {
error!("error joining rpc thread: {e:?}");
}
self.plugin_manager.write().unwrap().unload_all_plugins();
}

Expand Down
2 changes: 1 addition & 1 deletion test-validator/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -969,14 +969,14 @@ impl TestValidator {
vec![],
&validator_config,
true, // should_check_duplicate_instance
None,
rpc_to_plugin_manager_receiver,
config.start_progress.clone(),
socket_addr_space,
DEFAULT_TPU_USE_QUIC,
DEFAULT_TPU_CONNECTION_POOL_SIZE,
config.tpu_enable_udp,
config.admin_rpc_service_post_init.clone(),
None,
)?);

// Needed to avoid panics in `solana-responder-gossip` in tests that create a number of
Expand Down
2 changes: 1 addition & 1 deletion validator/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2085,14 +2085,14 @@ pub fn main() {
cluster_entrypoints,
&validator_config,
should_check_duplicate_instance,
Some(runtime_plugin_config_and_rpc_rx),
rpc_to_plugin_manager_receiver,
start_progress,
socket_addr_space,
tpu_use_quic,
tpu_connection_pool_size,
tpu_enable_udp,
admin_service_post_init,
Some(runtime_plugin_config_and_rpc_rx),
)
.unwrap_or_else(|e| {
error!("Failed to start validator: {:?}", e);
Expand Down

0 comments on commit 9a033ba

Please sign in to comment.