Skip to content

NotEnoughRowsAvailable on baching  #18

@LiuJiazheng

Description

@LiuJiazheng

Scenario:

Using this wasm to test out continuation feature.

By nature, K22 is enough for single proof. Hence we get 3 separate pieces of proof.

Now I want to build an aggregation circuit upon those, leveraging this repo (batcher). Intuitively I use

${BATCHER} --param ./params --output ./output batch -k 23 --challenge sha --info ...

to batch them. I only combine two of them then I get error:

thread 'main' panicked at 'keygen_vk should not fail: NotEnoughRowsAvailable { current_k: 22 }', /home/frank/.cargo/git/checkouts/halo2aggregator-s-4591bb34d62c1163/4fc143e/src/circuits/utils.rs:84:57
stack backtrace:
   0: rust_begin_unwind
             at /rustc/ff8c8dfbe66701531e3e5e335c28c544d0fbc945/library/std/src/panicking.rs:575:5
   1: core::panicking::panic_fmt
             at /rustc/ff8c8dfbe66701531e3e5e335c28c544d0fbc945/library/core/src/panicking.rs:65:14
   2: core::result::unwrap_failed
             at /rustc/ff8c8dfbe66701531e3e5e335c28c544d0fbc945/library/core/src/result.rs:1791:5
   3: halo2aggregator_s::circuits::utils::load_or_build_vkey
   4: circuits_batcher::proof::load_or_build_pkey
   5: circuits_batcher::proof::ProofPieceInfo::exec_create_proof
   6: circuits_batcher::exec::exec_batch_proofs
   7: circuit_batcher::main

Please note in error place, the k remains 22, which means k 23 as input argument does not take effect.

Basic reasoning

In src/exrc.rs function exec_batch_proofs:

et mut batchinfo = BatchInfo::<Bn256> {
        proofs,
        target_k: target_k.unwrap(),
        batch_k: k as usize,
        equivalents: vec![],
        absorb: vec![],
        expose: vec![],
    };

    batchinfo.load_commitments_check(&proofsinfo, commits);

    let param_file = format!("K{}.params", batchinfo.target_k);

    // setup target params
    let params = load_or_build_unsafe_params::<Bn256>(
        batchinfo.target_k as usize,
        &param_dir.join(format!("K{}.params", batchinfo.target_k)),
        params_cache,
    );

Here it chooses target k (22) rather than batch k (23).

A naive fix is to rehonor the k as input argument. Use max(k, batchinfo.target_k) as input of load_or_build_unsafe_params.

However that is not gonna work:

It seems that target circuit's param is still needed. For example, in its callee `` we have

for (_, proof) in self.proofs.iter().enumerate() {
                //println!("proof is {:?}", proof.transcripts);
                //println!("instance is {:?}", proof.instances);
                native_verifier::verify_single_proof::<E>(
                    &params_verifier,
                    &proof.vkey,
                    &proof.instances,
                    proof.transcripts.clone(),
                    TranscriptHash::Poseidon,
                );
            }

And the simple replacement of param file makes verification fails. For sure, inside agg also relies on param and corresponding vkeys.

Thoughts

Up to this point, I am not sure it is a feature or a bug:

The easiest solution is upgrade underlying target circuit to K 23 as well. But is that really solving the issue? Shouldn't batcher allow a smaller space for target circuit and a bigger one for agg circuit?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions