zkMIPS / zkm

The universal zkVM empowering Ethereum as the Global Settlement Layer
https://zkm.io
MIT License
105 stars 50 forks source link

fix: missing preprocessed circuits on Proof Aggregation #109

Closed Ventruo closed 7 months ago

Ventruo commented 7 months ago

Problem

Running any proof aggregation (aggregate_proof_allor aggregate_proof) in examples/zkmips.rs resulting in error of missing preprocessed circuits. Segment size used is 1024 resulting in 300 files in /tmp/output. The command used here is:

RUST_LOG=trace BLOCK_NO=13284491 SEG_FILE_DIR="/tmp/output" SEG_FILE_NUM=$(ls /tmp/output -1 | wc -l) \
    cargo run --release --example zkmips aggregate_proof_all

Result Log:

[2024-04-03T03:09:27Z INFO  zkm::cpu::bootstrap_kernel] Bootstrapping took 2563 cycles
[2024-04-03T03:09:27Z INFO  zkm::generation] CPU halted after 3587 cycles
[2024-04-03T03:09:27Z INFO  zkm::generation] CPU trace padded to 4096 cycles
[2024-04-03T03:09:27Z INFO  zkm::generation] Trace lengths (before padding): TraceCheckpoint { arithmetic_len: 357, cpu_len: 4096, keccak_len: 14928, keccak_sponge_len: 622, logic_len: 21149, memory_len: 108065 }
[2024-04-03T03:10:29Z INFO  plonky2::util::timing] 253.7764s to prove root first
[2024-04-03T03:12:49Z INFO  zkm::cpu::bootstrap_kernel] Bootstrapping took 1027 cycles
[2024-04-03T03:12:51Z INFO  zkm::generation] CPU halted after 2051 cycles
[2024-04-03T03:12:51Z INFO  zkm::generation] CPU trace padded to 4096 cycles
[2024-04-03T03:12:51Z INFO  zkm::generation] Trace lengths (before padding): TraceCheckpoint { arithmetic_len: 342, cpu_len: 4096, keccak_len: 6000, keccak_sponge_len: 250, logic_len: 8500, memory_len: 46603 }
thread 'main' panicked at examples/zkmips.rs:150:56:
called `Result::unwrap()` on an `Err` value: Missing preprocessed circuits for Keccak table with size 13.
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

After several discussions and help from ZKM team (Stephen Duan) on Discord #dev-support. The solutions is to change several bits of DEGREE_BITS_RANGE as shown in this PR changes. This fix ran both proof aggregation command successfully.

Specifications

CPU: Intel 12th Gen i7-1255U OS: Ubuntu 22.04.4 LTS
RAM: 16GB Swap: 32GB