-
Notifications
You must be signed in to change notification settings - Fork 313
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
turbine: Adjust reference tick calculation #4644
base: master
Are you sure you want to change the base?
Conversation
The current reference tick calculation results in the reference tick being recorded as 0 when a Bank has reached max tick height. This could lead a node to incorrectly believe they are late in receiving this shread which could lead to a premature repair request being sent. So, adjust the calculation to sature at bank.ticks_per_slot() - 1
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.
Comment here to remember why we put the hack in would be nice. Other than that, LGTM
@@ -268,7 +268,11 @@ impl StandardBroadcastRun { | |||
|
|||
// 2) Convert entries to shreds and coding shreds | |||
let is_last_in_slot = last_tick_height == bank.max_tick_height(); | |||
let reference_tick = bank.tick_height() % bank.ticks_per_slot(); | |||
let reference_tick = if is_last_in_slot { | |||
bank.ticks_per_slot() - 1 |
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.
comment here would be good
@@ -268,7 +268,11 @@ impl StandardBroadcastRun { | |||
|
|||
// 2) Convert entries to shreds and coding shreds | |||
let is_last_in_slot = last_tick_height == bank.max_tick_height(); | |||
let reference_tick = bank.tick_height() % bank.ticks_per_slot(); |
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 are changing this I would rather to change it to:
let reference_tick = last_tick_height
.saturating_add(bank.ticks_per_slot())
.saturating_sub(bank.max_tick_height());
Problem
The current reference tick calculation results in the reference tick being recorded as 0 when a Bank has reached max tick height
Summary of Changes
Adjust the calculation to saturate at
bank.ticks_per_slot() - 1
, which coincides with the max value of 63 that fit in the 6 bits allocated forreference_tick
in the shred header