-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Fix session phase in early-exit #453
Conversation
svyatonik
left a comment
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.
Seems good. Probably worth test.
Also maybe alter documentation for LastLengthChange - now it is Block at which the session length last changed && it looks like when <SessionLength<T>>::put(); has been called last time. Actually it is something like the block at which last session of length != SessionLength has been completed.
| if is_final_block || broken_validation { | ||
| Self::rotate_session(!broken_validation); | ||
| if let Some(normal_rotation) = Self::forcing_new_session() { | ||
| Self::rotate_session(normal_rotation, is_final_block); |
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 about how force_new_session() will be used, but probably Self::rotate_session(normal_rotation && !broken_validation, is_final_block) would be better (to make sure we slash validators)?
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.
the idea is that if you use force_new_session(), then it is able to override everything else in terms of the slashing.
if force_new_session() isn't the reason that this session is ending, then slashing is done if this session has been prematurely ended.
| pub BrokenPercentLate get(broken_percent_late): b"ses:broken_percent_late" => required T::Moment; | ||
|
|
||
| // New session is being forced. | ||
| pub ForcingNewSession get(forcing_new_session): b"ses:forcing_new_session" => bool; |
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 think it would be nice if it was documented what actually bool means here and that it actually a tri-state (like empty, true and false)
* master: Collator for the "adder" (formerly basic-add) parachain and various small fixes (#438) Storage changes subscription (#464) Wasm execution optimizations (#466) Fix the --key generation (#475) Fix typo in service.rs (#472) Fix session phase in early-exit (#453) Make ping unidirectional (#458) Update README.adoc
Remove log and add tracing to farmer
* Add error information back into metadata to roll back removal in paritytech#394 * Go back to obtaining runtime error info * re-do codegen too to check that it's all gravy * Convert DispatchError module errors into a module variant to make them easier to work with * Fix broken doc link
Runtime had incorrect logic when early-exiting from a session: it relies on
block_number - last_length_change % lengthto determine its phase within the current session. If a session early exited, nothing changed. This makes it resetlast_length_changewhen the session early-exits in order to ensure the phase calculation works as expected.Also, change spec version.