-
Notifications
You must be signed in to change notification settings - Fork 30
migration: validate that migrationary blocks are VoM #566
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -833,6 +833,9 @@ pub enum BlockstoreProcessorError { | |
|
|
||
| #[error("non consecutive leader slot for bank {0} parent {1}")] | ||
| NonConsecutiveLeaderSlot(Slot, Slot), | ||
|
|
||
| #[error("user transactions found in vote only mode bank at slot {0}")] | ||
| UserTransactionsInVoteOnlyBank(Slot), | ||
| } | ||
|
|
||
| /// Callback for accessing bank state after each slot is confirmed while | ||
|
|
@@ -1673,14 +1676,30 @@ fn confirm_slot_entries( | |
| .expect("Transaction verification generates entries"); | ||
|
|
||
| let mut replay_timer = Measure::start("replay_elapsed"); | ||
| let is_vote_only_bank = bank.vote_only_bank(); | ||
| let replay_entries: Vec<_> = entries | ||
| .into_iter() | ||
| .zip(entry_tx_starting_indexes) | ||
| .map(|(entry, tx_starting_index)| ReplayEntry { | ||
| entry, | ||
| starting_index: tx_starting_index, | ||
| .map(|(entry, tx_starting_index)| { | ||
| // If bank is in vote-only mode, validate that entries contain only vote transactions | ||
| if let EntryType::Transactions(ref transactions) = entry { | ||
| if is_vote_only_bank | ||
| && transactions | ||
| .iter() | ||
| .any(|tx| !tx.is_simple_vote_transaction()) | ||
|
Comment on lines
+1685
to
+1689
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thinking about performance, this seems fine.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, is the check on number of transactions is bounded at this point based on shred count and compute units?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes we have block limits in form of CUs and maximum number of shreds amongst other things |
||
| { | ||
| return Err(BlockstoreProcessorError::UserTransactionsInVoteOnlyBank( | ||
| bank.slot(), | ||
| )); | ||
| } | ||
| } | ||
| Ok(ReplayEntry { | ||
| entry, | ||
| starting_index: tx_starting_index, | ||
| }) | ||
| }) | ||
| .collect(); | ||
| .collect::<result::Result<Vec<_>, _>>()?; | ||
|
|
||
| let process_result = process_entries( | ||
| bank, | ||
| replay_tx_thread_pool, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
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.
for some context the reason we never validated this before was because VoM is based on a local-trigger (tower distance) so we could end up rejecting blocks from honest nodes.
I believe that this is safe, since the migration slot is known via a rooted bank. The only scenario where this could be an issue is:
In this scenario we'd mark the Alpenglow block as dead because it's not vote only - however we would already mark it as dead because it's missing PoH ticks.
The only way to remedy this situation is to wait for our slow node to eventually see the genesis certificate / a finalization certificate and then we'd purge, repair, and re-replay the Alpenglow blocks as not vote only.
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.
For the current, Tower case, we only ever mark are our own leader slot banks as VoM, right?
So they wouldn't actually go through this filtering process IIUC, which seems fine.
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.
yep we don't validate (and with this change won't validate) tower blocks as VoM.
Only concern is if this validation could screw up something in Alpenglow which I don't believe it can
Uh oh!
There was an error while loading. Please reload this page.
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.
If we check for the migration certificate in the block header, could we avoid this?
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.
Yep, since we will have the genesis certificate in the BlockMarker, at this point we can get to
ReadyToEnableand then progress with the migration.