fn ensure_valid_l2_block(&self, is_fictive: bool) -> anyhow::Result<()> {
        if is_fictive {
            anyhow::ensure!(
                self.l2_block.executed_transactions.is_empty(),
                "fictive L2 block must not have transactions"
            );
        } else {
            anyhow::ensure!(
                !self.l2_block.executed_transactions.is_empty(),
                "non-fictive L2 block must have at least one transaction"
            );
        }

        let first_tx_index = self.first_tx_index;
        let next_tx_index = first_tx_index + self.l2_block.executed_transactions.len();
        let tx_index_range = if is_fictive {
            next_tx_index..(next_tx_index + 1)
        } else {
            first_tx_index..next_tx_index
        };

        for event in &self.l2_block.events {
            let tx_index = event.location.1 as usize;
            anyhow::ensure!(
                tx_index_range.contains(&tx_index),
                "event transaction index {tx_index} is outside of the expected range {tx_index_range:?}"
            );
        }
        Ok(())
    }
Performs several sanity checks to make sure that the L2 block is valid.
core/node/state_keeper/src/io/seal_logic/mod.rs