async fn root_hashes_match(&self, l1_batch: L1BatchNumber) -> Result<bool, HashMatchError> {
        let mut storage = self.pool.connection().await?;
        let local_hash = storage
            .blocks_dal()
            .get_l1_batch_state_root(l1_batch)
            .await?
            .with_context(|| format!("Root hash does not exist for local batch #{l1_batch}"))?;
        drop(storage);

        let remote_hash = self.client.l1_batch_root_hash(l1_batch).await??;
        if remote_hash != local_hash {
            tracing::warn!(
                "Reorg detected: local root hash {local_hash:?} doesn't match the state hash from \
                main node {remote_hash:?} (L1 batch #{l1_batch})"
            );
        }
        Ok(remote_hash == local_hash)
    }
Compares root hashes of the latest local batch and of the same batch from the main node.
core/node/reorg_detector/src/lib.rs