pub async fn wait_for_blocks(
        &self,
        ctx: &ctx::Ctx,
        want_last: validator::BlockNumber,
    ) -> ctx::Result<Vec<validator::Block>> {
        const POLL_INTERVAL: time::Duration = time::Duration::milliseconds(100);
        let state = loop {
            let state = self
                .connection(ctx)
                .await
                .wrap("connection()")?
                .block_store_state(ctx)
                .await
                .wrap("block_store_state()")?;
            tracing::info!("state.next() = {}", state.next());
            if state.next() > want_last {
                break state;
            }
            ctx.sleep(POLL_INTERVAL).await?;
        };

        assert_eq!(want_last.next(), state.next());
        let mut conn = self.connection(ctx).await.wrap("connection()")?;
        let mut blocks: Vec<validator::Block> = vec![];
        for i in state.first.0..state.next().0 {
            let i = validator::BlockNumber(i);
            let block = conn.block(ctx, i).await.wrap("block()")?.unwrap();
            blocks.push(block);
        }
        Ok(blocks)
    }
Waits for `want_last` block then fetches all L2 blocks with certificates.
core/node/consensus/src/storage/testonly.rs