Skip to content

Commit

Permalink
Multiple entrypoint support
Browse files Browse the repository at this point in the history
  • Loading branch information
mvines committed Dec 23, 2020
1 parent 3373082 commit ace360a
Show file tree
Hide file tree
Showing 7 changed files with 249 additions and 184 deletions.
267 changes: 149 additions & 118 deletions core/src/cluster_info.rs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion core/src/test_validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,7 @@ impl TestValidator {
&ledger_path,
&validator_vote_account.pubkey(),
vec![Arc::new(validator_vote_account)],
None,
vec![],
&validator_config,
));

Expand Down
17 changes: 7 additions & 10 deletions core/src/validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ impl Validator {
ledger_path: &Path,
vote_account: &Pubkey,
mut authorized_voter_keypairs: Vec<Arc<Keypair>>,
cluster_entrypoint: Option<&ContactInfo>,
cluster_entrypoints: Vec<ContactInfo>,
config: &ValidatorConfig,
) -> Self {
let id = identity_keypair.pubkey();
Expand All @@ -241,7 +241,9 @@ impl Validator {
}
report_target_features();

info!("entrypoint: {:?}", cluster_entrypoint);
for cluster_entrypoint in &cluster_entrypoints {
info!("entrypoint: {:?}", cluster_entrypoint);
}

if solana_perf::perf_libs::api().is_some() {
info!("Initializing sigverify, this could take a while...");
Expand Down Expand Up @@ -492,6 +494,7 @@ impl Validator {
config.gossip_validators.clone(),
&exit,
);
cluster_info.set_entrypoints(cluster_entrypoints);

let serve_repair = Arc::new(RwLock::new(ServeRepair::new(cluster_info.clone())));
let serve_repair_service = ServeRepairService::new(
Expand All @@ -501,12 +504,6 @@ impl Validator {
&exit,
);

// Insert the entrypoint info, should only be None if this node
// is the bootstrap validator
if let Some(cluster_entrypoint) = cluster_entrypoint {
cluster_info.set_entrypoint(cluster_entrypoint.clone());
}

let (snapshot_packager_service, snapshot_config_and_package_sender) =
if let Some(snapshot_config) = config.snapshot_config.clone() {
if is_snapshot_config_invalid(
Expand Down Expand Up @@ -1287,7 +1284,7 @@ mod tests {
&validator_ledger_path,
&voting_keypair.pubkey(),
vec![voting_keypair.clone()],
Some(&leader_node.info),
vec![leader_node.info],
&config,
);
validator.close();
Expand Down Expand Up @@ -1357,7 +1354,7 @@ mod tests {
&validator_ledger_path,
&vote_account_keypair.pubkey(),
vec![Arc::new(vote_account_keypair)],
Some(&leader_node.info),
vec![leader_node.info.clone()],
&config,
)
})
Expand Down
8 changes: 6 additions & 2 deletions docs/src/clusters.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ Currently, rewards and inflation are disabled.
- Note: If you are using a non-command-line wallet such as
[Solflare](wallet-guide/solflare.md),
the wallet will always be connecting to Mainnet Beta.
- Gossip entrypoint for Mainnet Beta: `mainnet-beta.solana.com:8001`
- Gossip entrypoint for Mainnet Beta: `entrypoint.mainnet-beta.solana.com:8001`
- Metrics environment variable for Mainnet Beta:
```bash
export SOLANA_METRICS_CONFIG="host=https://metrics.solana.com:8086,db=mainnet-beta,u=mainnet-beta_write,p=password"
Expand Down Expand Up @@ -147,7 +147,11 @@ $ solana-validator \
--rpc-port 8899 \
--private-rpc \
--dynamic-port-range 8000-8010 \
--entrypoint mainnet-beta.solana.com:8001 \
--entrypoint entrypoint.mainnet-beta.solana.com:8001 \
--entrypoint entrypoint2.mainnet-beta.solana.com:8001 \
--entrypoint entrypoint3.mainnet-beta.solana.com:8001 \
--entrypoint entrypoint4.mainnet-beta.solana.com:8001 \
--entrypoint entrypoint5.mainnet-beta.solana.com:8001 \
--expected-genesis-hash 5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpKuc147dw2N9d \
--wal-recovery-mode skip_any_corrupted_record \
--limit-ledger-size
Expand Down
8 changes: 5 additions & 3 deletions local-cluster/src/local_cluster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ impl LocalCluster {
&leader_ledger_path,
&leader_vote_keypair.pubkey(),
vec![leader_vote_keypair.clone()],
None,
vec![],
&leader_config,
);

Expand Down Expand Up @@ -348,7 +348,7 @@ impl LocalCluster {
&ledger_path,
&voting_keypair.pubkey(),
vec![voting_keypair.clone()],
Some(&self.entry_point_info),
vec![self.entry_point_info.clone()],
&config,
);

Expand Down Expand Up @@ -660,7 +660,9 @@ impl Cluster for LocalCluster {
&validator_info.ledger_path,
&validator_info.voting_keypair.pubkey(),
vec![validator_info.voting_keypair.clone()],
entry_point_info.as_ref(),
entry_point_info
.map(|entry_point_info| vec![entry_point_info])
.unwrap_or_default(),
&cluster_validator_info.config,
);
cluster_validator_info.validator = Some(restarted_node);
Expand Down
4 changes: 2 additions & 2 deletions net-utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ fn do_verify_reachable_ports(
udp_retry_count: usize,
) -> bool {
info!(
"Checking that tcp ports {:?} from {:?}",
"Checking that tcp ports {:?} are reachable from {:?}",
tcp_listeners, ip_echo_server_addr
);

Expand Down Expand Up @@ -334,7 +334,7 @@ pub fn is_host(string: String) -> Result<(), String> {
pub fn parse_host_port(host_port: &str) -> Result<SocketAddr, String> {
let addrs: Vec<_> = host_port
.to_socket_addrs()
.map_err(|err| err.to_string())?
.map_err(|err| format!("Unable to resolve host {}: {}", host_port, err))?
.collect();
if addrs.is_empty() {
Err(format!("Unable to resolve host: {}", host_port))
Expand Down
Loading

0 comments on commit ace360a

Please sign in to comment.