approval-voting: Fix sending of assignments after restart (#6973)
There is a problem on restart where nodes will not trigger their needed assignment if they were offline while the time of the assignment passed. That happens because after restart we will hit this condition https://github.com/paritytech/polkadot-sdk/blob/4e805ca0/polkadot/node/core/approval-voting/src/lib.rs#L2495 and considered will be `tick_now` which is already higher than the tick of our assignment. The fix is to schedule a wakeup for untriggered assignments at restart and let the logic of processing an wakeup decide if it needs to trigger the assignment or not. One thing that we need to be careful here is to make sure we don't schedule the wake up immediately after restart because, the node would still be behind with all the assignments that should have received and might make it wrongfully decide it needs to trigger its assignment, so I added a `RESTART_WAKEUP_DELAY: Tick = 12` which should be more t...
parent
6878ba1f
Showing
- polkadot/node/core/approval-voting/src/lib.rs 24 additions, 1 deletionpolkadot/node/core/approval-voting/src/lib.rs
- polkadot/node/core/approval-voting/src/tests.rs 246 additions, 0 deletionspolkadot/node/core/approval-voting/src/tests.rs
- prdoc/pr_6973.prdoc 16 additions, 0 deletionsprdoc/pr_6973.prdoc