Skip to content

Commit 7588c74

Browse files
committed
Merge disk-spill prove and serde roundtrip tests
1 parent 494bc48 commit 7588c74

1 file changed

Lines changed: 23 additions & 36 deletions

File tree

prover/src/tests/disk_spill_tests.rs

Lines changed: 23 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -25,39 +25,43 @@ impl Drop for ForceDiskGuard {
2525
}
2626

2727
#[test]
28-
fn test_disk_spill_prove_and_verify_small() {
28+
fn test_disk_spill_prove_verify_and_roundtrip_small() {
2929
let _guard = ForceDiskGuard::new();
3030
let elf_bytes = asm_elf_bytes("sub");
3131
let opts = GoldilocksCubicProofOptions::with_blowup(2).expect("blowup=2 is always valid");
32-
let vm_proof = crate::prove_with_options(&elf_bytes, &opts, &MaxRowsConfig::default())
32+
let proof = crate::prove_with_options(&elf_bytes, &opts, &MaxRowsConfig::default())
3333
.expect("prove failed");
34-
let ok = crate::verify_with_options(&vm_proof, &elf_bytes, &opts).expect("verify failed");
35-
assert!(ok, "verification returned false");
36-
}
34+
assert!(
35+
crate::verify_with_options(&proof, &elf_bytes, &opts).expect("verify failed"),
36+
"verification returned false"
37+
);
3738

38-
#[test]
39-
fn test_disk_spill_prove_and_verify_with_chunks() {
40-
let _guard = ForceDiskGuard::new();
41-
let elf_bytes = asm_elf_bytes("all_instructions_64");
42-
let opts = GoldilocksCubicProofOptions::with_blowup(2).expect("blowup=2 is always valid");
43-
let vm_proof = crate::prove_with_options(&elf_bytes, &opts, &MaxRowsConfig::small())
44-
.expect("prove failed");
45-
let ok = crate::verify_with_options(&vm_proof, &elf_bytes, &opts).expect("verify failed");
46-
assert!(ok, "verification returned false");
39+
let bytes = bincode::serialize(&proof).expect("serialize failed");
40+
let proof2: VmProof = bincode::deserialize(&bytes).expect("deserialize failed");
41+
assert!(
42+
crate::verify_with_options(&proof2, &elf_bytes, &opts).expect("verify failed"),
43+
"verification failed after serialization roundtrip"
44+
);
4745
}
4846

4947
#[test]
50-
fn test_disk_spill_serialization_roundtrip() {
48+
fn test_disk_spill_prove_verify_and_roundtrip_chunked() {
5149
let _guard = ForceDiskGuard::new();
52-
let elf_bytes = asm_elf_bytes("sub");
50+
let elf_bytes = asm_elf_bytes("all_instructions_64");
5351
let opts = GoldilocksCubicProofOptions::with_blowup(2).expect("blowup=2 is always valid");
54-
let proof = crate::prove_with_options(&elf_bytes, &opts, &MaxRowsConfig::default())
52+
let proof = crate::prove_with_options(&elf_bytes, &opts, &MaxRowsConfig::small())
5553
.expect("prove failed");
54+
assert!(
55+
crate::verify_with_options(&proof, &elf_bytes, &opts).expect("verify failed"),
56+
"verification returned false"
57+
);
5658

5759
let bytes = bincode::serialize(&proof).expect("serialize failed");
5860
let proof2: VmProof = bincode::deserialize(&bytes).expect("deserialize failed");
59-
let valid = crate::verify_with_options(&proof2, &elf_bytes, &opts).expect("verify failed");
60-
assert!(valid, "verification failed after serialization roundtrip");
61+
assert!(
62+
crate::verify_with_options(&proof2, &elf_bytes, &opts).expect("verify failed"),
63+
"verification failed after serialization roundtrip (chunked)"
64+
);
6165
}
6266

6367
#[test]
@@ -70,20 +74,3 @@ fn test_disk_spill_prove_and_verify_372k() {
7074
let ok = crate::verify_with_options(&vm_proof, &elf_bytes, &opts).expect("verify failed");
7175
assert!(ok, "verification returned false for fib_iterative_372k");
7276
}
73-
74-
#[test]
75-
fn test_disk_spill_serialization_roundtrip_chunked() {
76-
let _guard = ForceDiskGuard::new();
77-
let elf_bytes = asm_elf_bytes("all_instructions_64");
78-
let opts = GoldilocksCubicProofOptions::with_blowup(2).expect("blowup=2 is always valid");
79-
let proof = crate::prove_with_options(&elf_bytes, &opts, &MaxRowsConfig::small())
80-
.expect("prove failed");
81-
82-
let bytes = bincode::serialize(&proof).expect("serialize failed");
83-
let proof2: VmProof = bincode::deserialize(&bytes).expect("deserialize failed");
84-
let valid = crate::verify_with_options(&proof2, &elf_bytes, &opts).expect("verify failed");
85-
assert!(
86-
valid,
87-
"verification failed after serialization roundtrip (chunked)"
88-
);
89-
}

0 commit comments

Comments
 (0)