Skip to content

Commit

Permalink
fix: verify proof in tests (#280)
Browse files Browse the repository at this point in the history
  • Loading branch information
tamirhemo authored Feb 21, 2024
1 parent 2452024 commit 8fe7a9f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 27 deletions.
19 changes: 6 additions & 13 deletions core/src/syscall/precompiles/keccak256/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,10 @@ impl KeccakPermuteChip {

#[cfg(test)]
pub mod permute_tests {
use crate::utils::run_test;
use crate::{
runtime::{Instruction, Opcode, Program, Runtime},
stark::{LocalProver, RiscvStark},
utils::{self, tests::KECCAK_PERMUTE_ELF, BabyBearPoseidon2, StarkUtils},
SP1Prover, SP1Stdin,
utils::{self, tests::KECCAK_PERMUTE_ELF},
};

pub fn keccak_permute_program() -> Program {
Expand Down Expand Up @@ -78,23 +77,17 @@ pub mod permute_tests {
}

#[test]
fn prove_babybear() {
fn test_keccak_permute_prove_babybear() {
utils::setup_logger();
let config = BabyBearPoseidon2::new();
let mut challenger = config.challenger();

let program = keccak_permute_program();
let mut runtime = Runtime::new(program);
runtime.run();

let machine = RiscvStark::new(config);
let (pk, _) = machine.setup(runtime.program.as_ref());
machine.prove::<LocalProver<_>>(&pk, &mut runtime.record, &mut challenger);
run_test(program).unwrap();
}

#[test]
fn test_keccak_permute_program_prove() {
utils::setup_logger();
SP1Prover::prove(KECCAK_PERMUTE_ELF, SP1Stdin::new()).unwrap();
let program = Program::from(KECCAK_PERMUTE_ELF);
run_test(program).unwrap();
}
}
18 changes: 4 additions & 14 deletions core/src/syscall/precompiles/sha256/extend/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,8 @@ pub mod extend_tests {
use crate::{
air::MachineAir,
alu::AluEvent,
runtime::{ExecutionRecord, Instruction, Opcode, Program, Runtime},
stark::{LocalProver, RiscvStark},
utils::{BabyBearPoseidon2, StarkUtils},
runtime::{ExecutionRecord, Instruction, Opcode, Program},
utils::run_test,
};

use super::ShaExtendChip;
Expand Down Expand Up @@ -82,17 +81,8 @@ pub mod extend_tests {
}

#[test]
fn prove_babybear() {
let config = BabyBearPoseidon2::new();
let mut challenger = config.challenger();

fn test_sha_prove() {
let program = sha_extend_program();
let mut runtime = Runtime::new(program);
runtime.run();

let machine = RiscvStark::new(config);

let (pk, _) = machine.setup(runtime.program.as_ref());
machine.prove::<LocalProver<_>>(&pk, &mut runtime.record, &mut challenger);
run_test(program).unwrap();
}
}

0 comments on commit 8fe7a9f

Please sign in to comment.