pub async fn get_log_block_number(
        &mut self,
        filter: &GetLogsFilter,
        offset: usize,
    ) -> DalResult<Option<L2BlockNumber>> {
        let (where_sql, arg_index) = self.build_get_logs_where_clause(filter);

        let query = format!(
            r#"
                SELECT miniblock_number
                FROM events
                WHERE {}
                ORDER BY miniblock_number ASC, event_index_in_block ASC
                LIMIT 1 OFFSET ${}
            "#,
            where_sql, arg_index
        );

        let mut query = sqlx::query(&query);

        // Bind address params - noop if there are no addresses
        query = Self::bind_params_for_optional_filter_query(
            query,
            filter.addresses.iter().map(Address::as_bytes).collect(),
        );
        for (_, topics) in &filter.topics {
            // Bind topic params - noop if there are no topics
            query = Self::bind_params_for_optional_filter_query(
                query,
                topics.iter().map(H256::as_bytes).collect(),
            );
        }
        query = query.bind(offset as i32);
        let log = query
            .instrument("get_log_block_number")
            .report_latency()
            .with_arg("filter", filter)
            .with_arg("offset", &offset)
            .fetch_optional(self.storage)
            .await?;

        Ok(log.map(|row| L2BlockNumber(row.get::<i64, _>("miniblock_number") as u32)))
    }
Returns L2 block number of log for given filter and offset.
Used to determine if there is more than `offset` logs that satisfies filter.
core/lib/dal/src/events_web3_dal.rs