ledger-tool/: Include full validator voting history in fork-graph (#6756)
This commit is contained in:
parent
0c2bf022fa
commit
09e648f957
|
@ -578,9 +578,10 @@ impl ReplayStage {
|
||||||
};
|
};
|
||||||
|
|
||||||
info!(
|
info!(
|
||||||
"{} voted and reset PoH at tick height {}. {}",
|
"{} voted and reset PoH to tick {} (within slot {}). {}",
|
||||||
my_pubkey,
|
my_pubkey,
|
||||||
bank.tick_height(),
|
bank.tick_height(),
|
||||||
|
bank.slot(),
|
||||||
next_leader_msg,
|
next_leader_msg,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
@ -92,12 +92,14 @@ fn graph_forks(
|
||||||
for (_, (stake, vote_account)) in bank.vote_accounts() {
|
for (_, (stake, vote_account)) in bank.vote_accounts() {
|
||||||
let vote_state = VoteState::from(&vote_account).unwrap_or_default();
|
let vote_state = VoteState::from(&vote_account).unwrap_or_default();
|
||||||
if let Some(last_vote) = vote_state.votes.iter().last() {
|
if let Some(last_vote) = vote_state.votes.iter().last() {
|
||||||
let entry =
|
let entry = last_votes.entry(vote_state.node_pubkey).or_insert((
|
||||||
last_votes
|
last_vote.slot,
|
||||||
.entry(vote_state.node_pubkey)
|
vote_state.clone(),
|
||||||
.or_insert((0, None, 0, total_stake));
|
stake,
|
||||||
|
total_stake,
|
||||||
|
));
|
||||||
if entry.0 < last_vote.slot {
|
if entry.0 < last_vote.slot {
|
||||||
*entry = (last_vote.slot, vote_state.root_slot, stake, total_stake);
|
*entry = (last_vote.slot, vote_state, stake, total_stake);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -156,7 +158,7 @@ fn graph_forks(
|
||||||
match bank.parent() {
|
match bank.parent() {
|
||||||
None => {
|
None => {
|
||||||
if bank.slot() > 0 {
|
if bank.slot() > 0 {
|
||||||
dot.push(format!(r#" "{}" -> "...""#, bank.slot(),));
|
dot.push(format!(r#" "{}" -> "..." [dir=back]"#, bank.slot(),));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -173,7 +175,7 @@ fn graph_forks(
|
||||||
"color=blue".to_string()
|
"color=blue".to_string()
|
||||||
};
|
};
|
||||||
dot.push(format!(
|
dot.push(format!(
|
||||||
r#" "{}" -> "{}"[{},penwidth={}];"#,
|
r#" "{}" -> "{}"[{},dir=back,penwidth={}];"#,
|
||||||
bank.slot(),
|
bank.slot(),
|
||||||
parent.slot(),
|
parent.slot(),
|
||||||
link_label,
|
link_label,
|
||||||
|
@ -193,15 +195,21 @@ fn graph_forks(
|
||||||
let mut absent_votes = 0;
|
let mut absent_votes = 0;
|
||||||
let mut lowest_last_vote_slot = std::u64::MAX;
|
let mut lowest_last_vote_slot = std::u64::MAX;
|
||||||
let mut lowest_total_stake = 0;
|
let mut lowest_total_stake = 0;
|
||||||
for (node_pubkey, (last_vote_slot, root_slot, stake, total_stake)) in &last_votes {
|
for (node_pubkey, (last_vote_slot, vote_state, stake, total_stake)) in &last_votes {
|
||||||
dot.push(format!(
|
dot.push(format!(
|
||||||
r#" "{}"[shape=box,label="validator: {}\nstake: {} SOL\nlast vote slot: {}\nroot slot: {}"];"#,
|
r#" "{}"[shape=box,label="validator: {}\nstake: {} SOL\nroot slot: {}\nlatest votes:\n{}"];"#,
|
||||||
node_pubkey,
|
node_pubkey,
|
||||||
node_pubkey,
|
node_pubkey,
|
||||||
lamports_to_sol(*stake),
|
lamports_to_sol(*stake),
|
||||||
last_vote_slot,
|
vote_state.root_slot.unwrap_or(0),
|
||||||
root_slot.unwrap_or(0)
|
vote_state
|
||||||
|
.votes
|
||||||
|
.iter()
|
||||||
|
.map(|vote| format!("slot {} (conf={})", vote.slot, vote.confirmation_count))
|
||||||
|
.collect::<Vec<_>>()
|
||||||
|
.join("\n")
|
||||||
));
|
));
|
||||||
|
|
||||||
dot.push(format!(
|
dot.push(format!(
|
||||||
r#" "{}" -> "{}" [style=dotted,label="last vote"];"#,
|
r#" "{}" -> "{}" [style=dotted,label="last vote"];"#,
|
||||||
node_pubkey,
|
node_pubkey,
|
||||||
|
@ -214,8 +222,9 @@ fn graph_forks(
|
||||||
}
|
}
|
||||||
absent_votes += 1;
|
absent_votes += 1;
|
||||||
absent_stake += stake;
|
absent_stake += stake;
|
||||||
|
|
||||||
"...".to_string()
|
"...".to_string()
|
||||||
}
|
},
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1139,9 +1139,12 @@ impl Blocktree {
|
||||||
serialized_shred
|
serialized_shred
|
||||||
.expect("Shred must exist if shred index was included in a range"),
|
.expect("Shred must exist if shred index was included in a range"),
|
||||||
)
|
)
|
||||||
.map_err(|_| {
|
.map_err(|err| {
|
||||||
BlocktreeError::InvalidShredData(Box::new(bincode::ErrorKind::Custom(
|
BlocktreeError::InvalidShredData(Box::new(bincode::ErrorKind::Custom(
|
||||||
"Could not reconstruct shred from shred payload".to_string(),
|
format!(
|
||||||
|
"Could not reconstruct shred from shred payload: {:?}",
|
||||||
|
err
|
||||||
|
),
|
||||||
)))
|
)))
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue