-
Notifications
You must be signed in to change notification settings - Fork 12
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
Allow specifying stepDuration as a map. #152
Conversation
added a map variant to the stepDuration config parameter handling the initial step duration from the config map introduced the next step duration fixed step duration tests panic if step duration is 0 added panics on step duration 0 corrected the panic string moved step duration update to on_prepare_block corrected the use of the signer address moved the step duration update to on_close_block changed the step duration during the step increment added next_duration to tests calibrate the step timeout after duration update changing step duration seems to work updated tests estimating the start of a same step duration interval from time and the number of steps step durations derived from step numbers set the initial step to 0 review comments
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.
Looks good to me.
panic!("authority_round: step duration can't be zero") | ||
if !our_params.step_durations.contains_key(&0) { | ||
error!(target: "engine", "Authority Round step 0 duration is undefined, aborting"); | ||
panic!("authority_round: step 0 duration is undefined") |
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.
"step 0" -> "timestamp 0"
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.
Not sure; timestamp 0 is always also step 0, so this is the duration of step 0.
Should the timestamps be calculated in UTC or in the local time zone? |
f8f946f
to
b8ef2a4
Compare
UTC. The timestamps are in Unix time. |
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.
/// | ||
/// Deliberately typed as u16 as too high of a value leads | ||
/// to slow block issuance. | ||
pub step_duration: u16, |
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 need to keep the step_duration
parameter as well for backward compatibility.
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.
That should still be accepted: It can now either be a number, like before, or a map.
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.
Ah, I see, OK.
If I remove the redundant |
b8ef2a4
to
5effbc7
Compare
Sorry! I updated the unit tests. |
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.
Let's merge it 👍
Closes #122, #124, #150.