pub async fn block_certificate(
        &mut self,
        block_number: validator::BlockNumber,
    ) -> anyhow::Result<Option<BlockCertificate>> {
        let Some(row) = sqlx::query!(
            r#"
            SELECT
                versioned_certificate
            FROM
                miniblocks_consensus
            WHERE
                number = $1
            "#,
            i64::try_from(block_number.0)?
        )
        .instrument("block_certificate")
        .report_latency()
        .fetch_optional(self.storage)
        .await?
        else {
            return Ok(None);
        };

        let d = zksync_protobuf::serde::Deserialize {
            deny_unknown_fields: true,
        };

        let cert = row
            .versioned_certificate
            .as_ref()
            .map(|cert| d.proto_fmt(cert))
            .transpose()?;

        if cert.is_some() {
            return Ok(cert);
        }

        Ok(None)
    }
Fetches the consensus certificate for the L2 block with the given `block_number`.
core/lib/dal/src/consensus_dal/mod.rs