fix: Allow for stream event redrive#2283
Conversation
There was a problem hiding this comment.
I don't think this is true.
What is true is that the validator allows replacing the latest block it has personally signed. But such a "replaced" block is never committed and therefore should never be considered the chain tip.
As an example:
- Block
Nis proposed and- submitted to the validator for signing
- signed by the validator
- committed by the sequencer
Nis now the new committed chain tip and may be sent to downstream subscribers
- Block
N+1is proposed- submitted to the validator for signing
- signed by the validator
- the sequencer has some problem and discards it
- this block is never committed and is never streamed out
- A new
N+1is proposed- submitted to the validator for signing
- signed by the validator, overwriting its local last signed block
- committed by the sequencer
N+1is now the new committed chain tip and may be sent to downstream
In other words, the validators chain tip is irrelevant. It is never streamed. Only the sequencer's committed chain tip is streamed.
A separate concern is what happens if we discover that some block M proof fails, or is rejected by L1. Then we need some sort of rollback mechanism but that is a different issue.
There was a problem hiding this comment.
In other words, the validators chain tip is irrelevant. It is never streamed. Only the sequencer's committed chain tip is streamed.
We use the same machinery for streaming blocks for the validator backup stream and the RPC replica streams. This PR is trying to solve the problem we have ATM where a redriven Validator block would be ignored. So we would potentially have a bad backup (backup contains the wrong version of a block that was overwritten).
There was a problem hiding this comment.
The validator should be used for sequencer recovery. In other words, there cannot be a redriven block because there is no sequencer and therefore no new blocks.
Or if you prefer a stricter model - the validator should reject all new blocks while it has a subscription active. But I don't think we need to go that route because, again, this is intended as a last resort data recovery.
There was a problem hiding this comment.
Though maybe that isn't such a bad idea. Reject all block signing requests with cannot sign, recovery in progress.
There was a problem hiding this comment.
there cannot be a redriven block because there is no sequencer and therefore no new blocks.
I don't understand what this means. The redrive is made by the sequencer in the first place - overwriting the N'th block (next-1).
Summary
The Validator may sometimes redrive a committed / streamed block (N). Currently the stream subscription logic ignores N being redriven because it is less than the expected next (N+1).
This PR adds support for redriving historic events.
Replaces #2270.
Changelog