Skip to content

Commit

Permalink
remove --full-rpc-api as default in startup_scripts.rs (#56)
Browse files Browse the repository at this point in the history
* remove --full-rpc-api as default in startup_scripts.rs for all validators

* fix load balance issue with bootstrap not running rpc
  • Loading branch information
gregcusack authored Jul 29, 2024
1 parent 8192c40 commit 97c6fd0
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 15 deletions.
5 changes: 5 additions & 0 deletions src/k8s_helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,11 @@ pub fn create_service(
name: Some("faucet-port".to_string()),
..Default::default()
},
ServicePort {
port: 8900, // WS Port
name: Some("ws-port".to_string()),
..Default::default()
},
]),
..Default::default()
}),
Expand Down
5 changes: 5 additions & 0 deletions src/kubernetes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ impl<'a> Kubernetes<'a> {
}
}

pub fn validator_supports_full_rpc(&self) -> bool {
self.validator_config.enable_full_rpc
}

pub fn set_shred_version(&mut self, shred_version: u16) {
self.validator_config.shred_version = Some(shred_version);
}
Expand Down Expand Up @@ -296,6 +300,7 @@ impl<'a> Kubernetes<'a> {
fn generate_full_rpc_flags(flags: &mut Vec<String>) {
flags.push("--enable-rpc-transaction-history".to_string());
flags.push("--enable-extended-tx-metadata-storage".to_string());
flags.push("--full-rpc-api".to_string());
}

fn generate_command_flags(&self, flags: &mut Vec<String>) {
Expand Down
16 changes: 11 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,10 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
known_validators: vec![],
};

if num_rpc_nodes == 0 && !validator_config.enable_full_rpc {
return Err("Must have at least one RPC node and/or enable full RPC services `--full-rpc`. Exiting...".into());
}

let pod_requests = PodRequests::new(
matches.value_of("cpu_requests").unwrap().to_string(),
matches.value_of("memory_requests").unwrap().to_string(),
Expand Down Expand Up @@ -689,11 +693,13 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
read_keypair_file(identity_path).expect("Failed to read bootstrap keypair file");
kub_controller.add_known_validator(bootstrap_keypair.pubkey());

bootstrap_validator.add_label(
"load-balancer/name",
"load-balancer-selector",
LabelType::Service,
);
if kub_controller.validator_supports_full_rpc() {
bootstrap_validator.add_label(
"load-balancer/name",
"load-balancer-selector",
LabelType::Service,
);
}
bootstrap_validator.add_label(
"service/name",
"bootstrap-validator-selector",
Expand Down
22 changes: 12 additions & 10 deletions src/startup_scripts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ while [[ -n $1 ]]; do
elif [[ $1 = --no-rocksdb-compaction ]]; then # not enabled in net.sh
args+=("$1")
shift
elif [[ $1 = --enable-rpc-transaction-history ]]; then # enabled through full-rpc
elif [[ $1 = --enable-rpc-transaction-history ]]; then
args+=("$1")
shift
elif [[ $1 = --rpc-pubsub-enable-block-subscription ]]; then # not enabled in net.sh
Expand All @@ -83,7 +83,10 @@ while [[ -n $1 ]]; do
elif [[ $1 = --enable-cpi-and-log-storage ]]; then # not enabled in net.sh
args+=("$1")
shift
elif [[ $1 = --enable-extended-tx-metadata-storage ]]; then # enabled through full-rpc
elif [[ $1 = --full-rpc-api ]]; then
args+=("$1")
shift
elif [[ $1 = --enable-extended-tx-metadata-storage ]]; then
args+=("$1")
shift
elif [[ $1 = --enable-rpc-bigtable-ledger-storage ]]; then
Expand Down Expand Up @@ -161,9 +164,7 @@ args+=(
--rpc-faucet-address "$MY_POD_IP":9900 \
--no-poh-speed-test \
--no-incremental-snapshots \
--full-rpc-api \
--allow-private-addr \
--enable-rpc-transaction-history
)
echo "Bootstrap Args"
Expand Down Expand Up @@ -361,6 +362,9 @@ while [[ -n $1 ]]; do
elif [[ $1 = --no-rocksdb-compaction ]]; then
args+=("$1")
shift
elif [[ $1 = --full-rpc-api ]]; then
args+=("$1")
shift
elif [[ $1 = --enable-rpc-transaction-history ]]; then
args+=("$1")
shift
Expand Down Expand Up @@ -465,12 +469,10 @@ default_arg --identity "$identity"
default_arg --vote-account "$vote_account"
default_arg --ledger "$ledger_dir"
default_arg --log -
default_arg --full-rpc-api
default_arg --no-incremental-snapshots
default_arg --allow-private-addr
default_arg --gossip-port 8001
default_arg --rpc-port 8899
default_arg --enable-rpc-transaction-history
PS4="$(basename "$0"): "
echo "PS4: $PS4"
Expand Down Expand Up @@ -727,6 +729,9 @@ while [[ -n $1 ]]; do
elif [[ $1 = --ledger ]]; then
ledger_dir=$2
shift 2
elif [[ $1 = --full-rpc-api ]]; then
args+=("$1")
shift
elif [[ $1 = --entrypoint ]]; then
gossip_entrypoint=$2
args+=("$1" "$2")
Expand Down Expand Up @@ -873,7 +878,6 @@ fi
default_arg --identity "$identity"
default_arg --ledger "$ledger_dir"
default_arg --log -
default_arg --full-rpc-api
default_arg --no-incremental-snapshots
default_arg --allow-private-addr
default_arg --gossip-port 8001
Expand Down Expand Up @@ -1018,8 +1022,6 @@ bench-tps)
fi
entrypointIp="${BOOTSTRAP_GOSSIP_ADDRESS:0:-5}"
url="$entrypointIp:8899"
args+=(--bind-address "$entrypointIp")
# use high staked node to get higher TPS
args+=(--client-node-id ./client-accounts/bootstrap-identity.json)
Expand Down Expand Up @@ -1053,7 +1055,7 @@ bench-tps)
solana-bench-tps \
$benchTpsExtraArgs \
--read-client-keys ./client-accounts.yml \
--url "http://$url"
--url "http://$LOAD_BALANCER_RPC_ADDRESS"
${args[*]} \
${runtime_args[*]} \
"
Expand Down

0 comments on commit 97c6fd0

Please sign in to comment.