Various clean-ups before assert adjustment#13006
Conversation
|
|
||
| // return immediately if votes are empty... | ||
| if self.lockouts.votes.is_empty() { | ||
| return Ok(self); |
There was a problem hiding this comment.
I didn't like my previous coding (especially regarding the branched-off early bail-out code flow with Ok(_))... Well, I found out that I can steamline these a bit.
| // Unless we're voting since genesis, slots_in_tower must always be older than last checked_slot | ||
| // including all vote slot and the root slot. | ||
| assert!(*slot_in_tower < checked_slot) | ||
| assert!( |
There was a problem hiding this comment.
I'm adding tests before adjusting this assert!.
There was a problem hiding this comment.
Hi! I'm catching this assertion when I'm running a new validator: #13128
| ); | ||
| } | ||
|
|
||
| #[test] |
There was a problem hiding this comment.
I'm adding tests before adjusting this assert!.
| ); | ||
|
|
||
| blockstore.set_roots(&new_roots)? | ||
| blockstore.set_roots(&new_roots)?; |
There was a problem hiding this comment.
oddly enough, clippy and rustfmt doesn't seem to complain this. ;)
Codecov Report
@@ Coverage Diff @@
## master #13006 +/- ##
=======================================
Coverage 81.9% 81.9%
=======================================
Files 361 361
Lines 85272 85308 +36
=======================================
+ Hits 69895 69928 +33
- Misses 15377 15380 +3 |
|
@carllin Could you review this? Thanks! |
| )); | ||
| } | ||
| self.adjust_lockouts_with_slot_history(slot_history)?; | ||
| self.initialize_root(replayed_root); |
There was a problem hiding this comment.
cool, I think this looks equivalent to me, much easier to read 😄
* Various clean-ups before assert adjustment * oops (cherry picked from commit efdb560)
* Various clean-ups before assert adjustment * oops
* Various clean-ups before assert adjustment * oops
* Various clean-ups before assert adjustment * oops
Problem
Well, I've ended up collecting some cleanups I'd like to settle down before #12671.
Summary of Changes
Flush out various cleanups before really introducing assert adjustments for easier review.
This pr should be no functional change.