Race condition when fetching the list of messages in rollup node
In the rollup node when downloading the inbox stored in a block with a given block_hash, we download the list of operations using chain:Main and the level of the block corresponding to the block_hash:
https://gitlab.com/tezos/tezos/-/blob/master/src/proto_alpha/bin_sc_rollup_node/inbox.ml#L75
Subsequently, we store the fetched list of messages in a block_hash indexed level map, using block_hash as the key:
https://gitlab.com/tezos/tezos/-/blob/master/src/proto_alpha/bin_sc_rollup_node/inbox.ml#L104
If a chain reorganisation occurs on layer1 after the rollup node has called Inbox.process_head (https://gitlab.com/tezos/tezos/-/blob/master/src/proto_alpha/bin_sc_rollup_node/inbox.ml#L104), but before the list of messages is downloaded from layer1, then the overall effect would be that of storing the wrong list of messages for block_hash.
Related: #3016 (closed) (different bug, same code snippet)