Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: verify proof in tests #280

Merged
merged 1 commit into from
Feb 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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();
}
}
Loading