fn verify_commitment(&self, reference: &ethabi::Token, is_gateway: bool) -> anyhow::Result<()> {
        let protocol_version = self
            .l1_batch
            .header
            .protocol_version
            .unwrap_or_else(ProtocolVersionId::last_potentially_undefined);
        let da = detect_da(
            protocol_version,
            reference,
            self.commitment_mode,
            is_gateway,
        )
        .context("cannot detect DA source from reference commitment token")?;

        let local_token =
            CommitBatchInfo::new(self.commitment_mode, &self.l1_batch, da).into_token();
        anyhow::ensure!(
            local_token == *reference,
            "Locally reproduced commitment differs from the reference obtained from L1; \
             local: {local_token:?}, reference: {reference:?}"
        );
        Ok(())
    }
All returned errors are validation errors.
core/node/consistency_checker/src/lib.rs