EVM/Node: check out of sync in apply_evm_events
Checks the out of sync of rollup node blocks in Evm_context.apply_evm_events instead of the evm events follower.
The current implementation does:
- Open a stream with the rollup node
- Get a block
- Sends the block to Evm_events_follower, Signals_publisher etc, etc.
- Go back to 2
(3.) is not blocking, we have observed that we move to (4.) without finishing (3.) if there are a lot of events. However, the last known L1 level is updated at the end of apply_evm_events. Therefore, it fails on Out_of_sync because in Evm_events_followers the block arrives too soon.
We have (at least) 2 ways to fix this problem:
- The obvious one is to wait on (3.) completion, but it's risky as it can be long as it relies on HTTP requests.
- Let
Evm_contextdeal with this logic. As requests on the worker are processed sequentially we can ask the Rollup_node_follower to push the blocks one by one from the stream, without waiting on completion, and we are sure that theEvm_contextworker will process them sequentially.
Edited by Valentin Chaboche