- 
                Notifications
    You must be signed in to change notification settings 
- Fork 29
Parse out alpenglow votes in vote_parser.rs #95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| Hmm for some reason, votes aren't being received by the second node over gossip in #89, even though i see the leader pushing them into gossip...ick | 
| if vote.is_alpenglow_vote() { | ||
| return None; | ||
| } | ||
| } | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: is this equivalent to
if (slot >= first_alpenglow_slot) ^ vote.is_alpenglow_vote() {
return None;
}
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah it's equivalent, changed
| ParsedVoteTransaction::Alpenglow(tx) => match tx { | ||
| AlpenglowVote::Notarize(vote) => Some((vote.slot(), *vote.replayed_bank_hash())), | ||
| AlpenglowVote::Finalize(vote) => Some((vote.slot(), *vote.replayed_bank_hash())), | ||
| AlpenglowVote::Skip(_vote) => None, | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can give Skip Some((vote.end_slot(), Hash::default())) to make the vote sending work? I don't think we care that much about the start_slot changing
If we do that, then I think this function can return (Slot, Hash), since it will always return Some(...)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think you want to send skip votes to repair for fork choice weighting, so that logic should probably be handled separately
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, let's add a comment here saying why Skip should return None then.
|  | ||
| pub fn is_full_tower_vote(&self) -> bool { | ||
| match self { | ||
| ParsedVoteTransaction::Tower(tx) => tx.is_full_tower_vote(), | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would we still have anything other than full tower vote in TowerBFT side when Alpenglow launches?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no I think we should be ignoring all alpenglow votes for slots < the first alpenglow slot, hence this check https://github.com/anza-xyz/alpenglow/pulls#discussion_r1999224815
| Some((*key, vote, switch_proof_hash, signature)) | ||
| Some(( | ||
| *key, | ||
| ParsedVoteTransaction::Tower(vote), | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm why don't we need this for Alpenglow?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's "this"? this is the equivalent for alpenglow:
alpenglow/vote/src/vote_parser.rs
Line 123 in 1558360
| ParsedVoteTransaction::Alpenglow(alpenglow_vote), | 
| )) | ||
| } | ||
|  | ||
| pub fn parse_alpenglow_vote_transaction(tx: &Transaction) -> Option<ParsedVote> { | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: can this guy and parse_sanitized_alpenglow_vote_transaction share code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could probably pass some closures to handle custom parsing, but code overlap is small enough where it doesn't seem worth it
|  | ||
| fn parse_alpenglow_vote_instruction_data(vote_instruction_data: &[u8]) -> Option<AlpenglowVote> { | ||
| alpenglow_vote::vote::Vote::deserialize_simple_vote(vote_instruction_data).ok() | ||
| } | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit:: add TODO to add test cases.
Also can we use alpenglow_vote::vote::Vote as AlpenglowVote?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done!
| vec![( | ||
| validator0_keypairs.vote_keypair.pubkey(), | ||
| VoteTransaction::from(Vote::new(vec![voted_slot], Hash::default())), | ||
| ParsedVoteTransaction::Tower(VoteTransaction::from(Vote::new( | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: add TODO for alpenglow test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah going to need to go through and write some detailed tests, might hand off to @ksn6
| alpenglow/gossip/src/cluster_info.rs Line 2191 in efc48d5 
 Edit: Figured it out, its the deserialize implementation in CrdsData::Vote, fixed here: 9ee113a Repair now seems to be working with two local cluster nodes! | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Post merge LGTM
Just a couple nits
| } | ||
| } | ||
|  | ||
| fn parse_alpenglow_vote_instruction_data(vote_instruction_data: &[u8]) -> Option<AlpenglowVote> { | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: we could also check AlpenglowVote::is_simple_vote if we want to distinguish between accounting instructions here.
Also fine to keep it as is, accounting instructions and invalid packets will both turn into None
|  | ||
| // TODO: add tests | ||
| pub fn parse_alpenglow_vote_transaction(tx: &Transaction) -> Option<ParsedVote> { | ||
| // Check first instruction for a vote | 
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we are doing this from scratch here, we could formalize the requirement that votes must be a single instruction transaction (fail to parse here and in banking stage).
Problem
Summary of Changes
Parse out votes
Fixes #