pub async fn get_ready_for_da_dispatch_l1_batches(
        &mut self,
        limit: usize,
    ) -> DalResult<Vec<L1BatchDA>> {
        let rows = sqlx::query!(
            r#"
            SELECT
                number,
                pubdata_input,
                system_logs,
                sealed_at
            FROM
                l1_batches
            LEFT JOIN
                data_availability
                ON data_availability.l1_batch_number = l1_batches.number
            WHERE
                eth_commit_tx_id IS NULL
                AND number != 0
                AND data_availability.dispatch_request_id IS NULL
                AND pubdata_input IS NOT NULL
                AND sealed_at IS NOT NULL
            ORDER BY
                number
            LIMIT
                $1
            "#,
            limit as i64,
        )
        .instrument("get_ready_for_da_dispatch_l1_batches")
        .with_arg("limit", &limit)
        .fetch_all(self.storage)
        .await?;

        Ok(rows
            .into_iter()
            .map(|row| L1BatchDA {
                // `unwrap` is safe here because we have a `WHERE` clause that filters out `NULL` values
                pubdata: row.pubdata_input.unwrap(),
                l1_batch_number: L1BatchNumber(row.number as u32),
                sealed_at: row.sealed_at.unwrap().and_utc(),
                system_logs: row
                    .system_logs
                    .into_iter()
                    .map(|raw_log| L2ToL1Log::from_slice(&raw_log))
                    .collect(),
            })
            .collect())
    }
Fetches the pubdata and `l1_batch_number` for the L1 batches that are ready for DA dispatch.
core/lib/dal/src/data_availability_dal.rs