-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Test that tick slot hashes update the recent blockhash queue #24242
Test that tick slot hashes update the recent blockhash queue #24242
Conversation
fa4d4b1
to
37c2cd6
Compare
Note that this implies that using "last valid block height" instead of "last valid slot" for transaction expiration is actually incorrect because it assumes that skipped slots don't affect transaction expiration. This test shows that hashes for skipped slots are also added to the recent blockhash queue and so slots should be used for transaction expiration. Using block height for detecting expiration results in clients waiting longer than they need to (cc @t-nelson @CriesofCarrots @mvines) |
Codecov Report
@@ Coverage Diff @@
## master #24242 +/- ##
=========================================
+ Coverage 81.8% 81.9% +0.1%
=========================================
Files 581 580 -1
Lines 158312 161329 +3017
=========================================
+ Hits 129518 132268 +2750
- Misses 28794 29061 +267 |
(wow, is this really? it's big news to me... i'll get to review on this later...) |
Yeah I was quite surprised too, let me know if you want to me to walk through how I reached this conclusion. I'll let you dig in first :) |
Oh. Wow. |
lol wut. doesn't this mean that if 150 slots are skipped in a row, there does not exist a valid blockhash for future votes? |
tx forwards are a single hop. txs expire after 150 blocks. what's next?! nice find! think it'll be enough to stop putting new ticks in or will there be side effect? |
hmm, i think i found a counter-example?: https://explorer.solana.com/tx/5ecnMQYQhZEsup2YPr4Vii3skuvhx7VPXTXVVioVv96PhrkXwZhjbgpEzS8pnq4TdcRXDyuCQnga7wLG5GsDjJwX this transaction is included in slot 117,746,642 with recent_blockhash Du5KNR1zXVucMpPzJuPRvt9XXHwMTXsaCWJQQqUe7GRG, which in turn refers to the slot 117,746,491
then, let's see block heights:
|
You have to find a counter example greater than 151 because we allow processing transactions that are 151 slots behind the current block. I have a test to show this strange off-by-one behavior here: solana/runtime/src/blockhash_queue.rs Lines 250 to 252 in d54ec40
|
Any objections to merging this? I have a fix lined up here: #24389 |
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.
lgtm!
@@ -891,7 +891,7 @@ pub fn confirm_slot( | |||
) -> result::Result<(), BlockstoreProcessorError> { | |||
let slot = bank.slot(); | |||
|
|||
let (entries, num_shreds, slot_full) = { | |||
let slot_entries_load_result = { |
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.
loves these tiny clean-ups.
Problem
There seems to be a common misconception that skipped slots do not impact the recent blockhash queue. There is no test to observe how this works.
Summary of Changes
Bank::get_hash_age
for use in above testDefault
implementation forBlockhashQueue
into theblockhash_queue
module because I can never find itconfirm_slot_entries
function fromblockstore_processor::confirm_slot_entries
to make it easier to test the full verification flow for entriesFixes #