You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
shadow-testing: fix prover stack overflow by adding RUST_MIN_STACK
- Add export RUST_MIN_STACK=16777216 to 04-prover-up.sh
- Document the batch proof stack overflow issue in LESSONS_LEARNED.md
- Chunk proofs work with default stack, but batch/bundle proofs need 16MB
-[ ] Relayer started with `--config <path>` and `--min-codec-version 10`
597
597
-[ ] Target bundles/batches reset to `rollup_status = 1`
598
598
-[ ] Parent batch exists in shadow DB
599
+
600
+
---
601
+
602
+
## 2026-06-04: Shadow Testing with New zkvm-prover — Bundles 13450-13454
603
+
604
+
### What Happened
605
+
Attempted to prove bundles 13450-13454 using the local shadow prover (current build with OpenVM 1.6.0 / zkvm-prover `ed3b964`). The bundles and their batches/chunks were imported from Sepolia production RDS.
606
+
607
+
### Lesson 1: Import Production Data, Then Clear Proofs and Reset Status
608
+
609
+
**Wrong approach** (what was done initially):
610
+
- Imported bundles with production proofs from RDS
611
+
- Kept the proofs in the DB
612
+
- Tried to assign bundle tasks directly to the prover
613
+
- Coordinator failed with `ProofEnum deserialization` error because the imported proofs were generated by a different zkvm-prover version
614
+
615
+
**Correct approach**:
616
+
1. Import raw metadata (batch headers, chunk info, L2 blocks, state roots) from RDS
617
+
2.**Clear all `proof` fields** after import:
618
+
```sql
619
+
UPDATE chunk SET proof =NULL, proving_status =1, ... WHERE ...;
620
+
UPDATE batch SET proof =NULL, proving_status =1, chunk_proofs_status =0, ... WHERE ...;
621
+
UPDATE bundle SET proof =NULL, proving_status =1, batch_proofs_status =1, ... WHERE ...;
622
+
```
623
+
3. Let the local prover regenerate all proofs from scratch
624
+
4. The coordinator verifies the newly-generated proofs
625
+
626
+
**Why**: Proofs are tied to the specific zkvm-prover / circuit version. The `StarkProof` struct uses `bincode_v1` serialization for `Proof<SC>`, and the binary format changes when the `openvm-stark-backend` or `openvm-sdk` versions change. Proofs generated by version `f18523c` cannot be deserialized by version `ed3b964`.
627
+
628
+
### Lesson 2: Prover Config Must Use Valid Proof Types
629
+
630
+
**Wrong config**:
631
+
```json
632
+
"supported_proof_types": [0, 1, 2, 3]
633
+
```
634
+
Type `0` = `ProofTypeUndefined`, which the coordinator rejects with `illegal proof type: 0`.
635
+
636
+
**Correct config**:
637
+
```json
638
+
"supported_proof_types": [1, 2, 3]
639
+
```
640
+
-`1` = Chunk
641
+
-`2` = Batch
642
+
-`3` = Bundle
643
+
644
+
### Lesson 3: Prover Binary Takes Only `--config` Flag
thread 'tokio-rt-worker' panicked at ... cudaErrorMemoryAllocation: out of memory
667
+
```
668
+
669
+
**Root Cause**: Each prover allocates a large GPU memory pool for circuit proving. Running multiple provers on the same physical GPU (or even different GPUs if the system is under memory pressure) exceeds available VRAM.
670
+
671
+
**Mitigation**:
672
+
- Use the script's default of 2 GPUs (`GPUS="0,1"`) instead of 4
673
+
- Or run provers sequentially on a single GPU
674
+
- Monitor GPU memory with `nvidia-smi` during proving
675
+
676
+
**Note**: With 1-2 provers on RTX 3090s, chunk proof generation takes ~700-800s. Batch and bundle proofs take longer.
677
+
678
+
### Lesson 5: GORM `[]byte` Mapping for PostgreSQL `bytea` Works Correctly
679
+
680
+
**Initial suspicion**: The `json.Unmarshal(batch.Proof, &message.OpenVMBatchProof)` failure was thought to be caused by GORM corrupting the `bytea` field.
681
+
682
+
**Verification**: A standalone Go test using the exact same GORM model and PostgreSQL `bytea` type successfully read and unmarshaled all batch proofs (1,089,806 bytes each).
683
+
684
+
**Conclusion**: GORM correctly handles PostgreSQL `bytea` fields. The actual deserialization failure happens in the Rust `libzkp` layer (`gen_universal_task`), not in Go.
685
+
686
+
### Pre-Proving Checklist for New Guest Version Tests
687
+
688
+
-[ ] Import raw data from RDS (exclude `proof` columns, or clear them after import)
689
+
-[ ] Reset `proving_status` to 1 for all chunks, batches, bundles
-[ ] Prover launched with `--config <path>` only (no `--http.addr`/`--http.port`)
694
+
-[ ] Coordinator asset hashes match prover circuit hashes
695
+
-[ ] GPU count is appropriate for available VRAM (2 GPUs recommended for RTX 3090)
696
+
-[ ] Shadow bypass is configured if testing finalize without real on-chain verification
697
+
698
+
### 6. Prover Batch Proof Stack Overflow — Set `RUST_MIN_STACK`
699
+
700
+
**Date**: 2026-06-04
701
+
702
+
**Symptom**: After chunk proofs succeed, prover crashes during batch proof generation with:
703
+
```
704
+
thread 'tokio-rt-worker' has overflowed its stack
705
+
fatal runtime error: stack overflow, aborting
706
+
```
707
+
Crash occurs in `gen_proof_universal` during aggregation keygen, right after `coset_lde_batch`.
708
+
709
+
**Root Cause**: The default Rust thread stack size (2 MB) is insufficient for OpenVM 1.6.0 batch/bundle proof generation. Chunk proofs work fine, but batch proofs require deeper recursion in the STARK prover.
710
+
711
+
**Fix**: Set `RUST_MIN_STACK=16777216` (16 MB) before starting the prover. The `zkvm-prover/Makefile` already sets this, but custom startup scripts must also export it:
0 commit comments