test-validator: Display genesis hash in dashboard (backport #17216) (#17225)

* rpc: plumb shred_version through RpcContactInfo

(cherry picked from commit 67e6a3106f)

* test-validator: Display more cluster info in dash

(cherry picked from commit 754c708473)

Co-authored-by: Trent Nelson <trent@solana.com>
This commit is contained in:
mergify[bot]
2021-05-14 09:56:27 +00:00
committed by GitHub
parent 802c5fcb00
commit a08a6d55fa
4 changed files with 17 additions and 3 deletions

View File

@ -206,6 +206,8 @@ pub struct RpcContactInfo {
pub version: Option<String>, pub version: Option<String>,
/// First 4 bytes of the FeatureSet identifier /// First 4 bytes of the FeatureSet identifier
pub feature_set: Option<u32>, pub feature_set: Option<u32>,
/// Shred version
pub shred_version: Option<u16>,
} }
/// Map of leader base58 identity pubkeys to the slot indices relative to the first epoch slot /// Map of leader base58 identity pubkeys to the slot indices relative to the first epoch slot

View File

@ -2844,6 +2844,7 @@ pub mod rpc_full {
rpc: valid_address_or_none(&contact_info.rpc), rpc: valid_address_or_none(&contact_info.rpc),
version, version,
feature_set, feature_set,
shred_version: Some(my_shred_version),
}) })
} else { } else {
None // Exclude spy nodes None // Exclude spy nodes
@ -3921,7 +3922,7 @@ pub mod tests {
.expect("actual response deserialization"); .expect("actual response deserialization");
let expected = format!( let expected = format!(
r#"{{"jsonrpc":"2.0","result":[{{"pubkey": "{}", "gossip": "127.0.0.1:1235", "tpu": "127.0.0.1:1234", "rpc": "127.0.0.1:{}", "version": null, "featureSet": null}}],"id":1}}"#, r#"{{"jsonrpc":"2.0","result":[{{"pubkey": "{}", "gossip": "127.0.0.1:1235", "shredVersion": 0, "tpu": "127.0.0.1:1234", "rpc": "127.0.0.1:{}", "version": null, "featureSet": null}}],"id":1}}"#,
leader_pubkey, leader_pubkey,
rpc_port::DEFAULT_RPC_PORT rpc_port::DEFAULT_RPC_PORT
); );

View File

@ -37,7 +37,9 @@ See [Appendix I](#appendix-i-status-output) for details
Ledger location: test-ledger Ledger location: test-ledger
Log: test-ledger/validator.log Log: test-ledger/validator.log
Identity: EPhgPANa5Rh2wa4V2jxt7YbtWa3Uyw4sTeZ13cQjDDB8 Identity: EPhgPANa5Rh2wa4V2jxt7YbtWa3Uyw4sTeZ13cQjDDB8
Genesis Hash: 4754oPEMhAKy14CZc8GzQUP93CB4ouELyaTs4P8ittYn
Version: 1.6.7 Version: 1.6.7
Shred Version: 13286
Gossip Address: 127.0.0.1:1024 Gossip Address: 127.0.0.1:1024
TPU Address: 127.0.0.1:1027 TPU Address: 127.0.0.1:1027
JSON RPC URL: http://127.0.0.1:8899 JSON RPC URL: http://127.0.0.1:8899
@ -59,8 +61,10 @@ solana config set --url http://127.0.0.1:8899
#### Verify the CLI Tool Suite configuration #### Verify the CLI Tool Suite configuration
``` ```
solana cluster-version solana genesis-hash
``` ```
* **NOTE:** The result should match the `Genesis Hash:` field in the
`solana-test-validator` status output
#### Check the wallet balance #### Check the wallet balance
``` ```

View File

@ -87,13 +87,20 @@ impl Dashboard {
continue; continue;
} }
}; };
println_name_value("Identity:", &identity.to_string()); println_name_value("Identity:", &identity.to_string());
if let Ok(genesis_hash) = rpc_client.get_genesis_hash() {
println_name_value("Genesis Hash:", &genesis_hash.to_string());
}
if let Some(contact_info) = get_contact_info(&rpc_client, &identity) { if let Some(contact_info) = get_contact_info(&rpc_client, &identity) {
println_name_value( println_name_value(
"Version:", "Version:",
&contact_info.version.unwrap_or_else(|| "?".to_string()), &contact_info.version.unwrap_or_else(|| "?".to_string()),
); );
if let Some(shred_version) = contact_info.shred_version {
println_name_value("Shred Version:", &shred_version.to_string());
}
if let Some(gossip) = contact_info.gossip { if let Some(gossip) = contact_info.gossip {
println_name_value("Gossip Address:", &gossip.to_string()); println_name_value("Gossip Address:", &gossip.to_string());
} }