evm/node: add locking logic to tx_queue
Checklist
- [ ] Provide automatic testing. nothing to test yet, it will come in the following MR
-
Add an item in the changelog
What
meta issue for stacked MR: #7785
Add a locking logic for the tx_queue. It's not yet called, it will be in the next MR.
Why
Similarly to the tx_pool, we want to lock it when we don't want to publish blueprint anymore.
The logic for the tx_pool is the following: whenever the blueprints_publisher detects a large lag (configurable) between the rollup node l2 head and the local state, it locks the tx_pool. The block_producer checks whenever it's asked to produce a block if the tx_pool is locked, and don't do anything if it's locked.
I first thought about moving the locking logic out from the tx_pool into the block_producer, which feels more adequate. But if we do that there is a small difference with the current behavior. The request to lock the block_producer goes into the worker queue and so any produce_block request before it would be applied, whereas with the current behavior any current produce_block request will fails because as soon as the tx_pool is locked. The difference would be at most a couple of blocks, I think it still make sens, but I prefer to do such MR separately after making sure it's valid.