Skip to content

Commit

Permalink
feat: fix execution + proving errors (#715)
Browse files Browse the repository at this point in the history
  • Loading branch information
jtguibas authored May 14, 2024
1 parent ccb7f2a commit 518bea3
Show file tree
Hide file tree
Showing 32 changed files with 1,195 additions and 369 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ jobs:
- name: Install SP1 CLI
run: |
cd cli
cargo install --locked --path .
cargo install --force --locked --path .
cd ~
- name: Run cargo check
Expand Down Expand Up @@ -161,7 +161,7 @@ jobs:
- name: Install SP1 CLI
run: |
cd cli
cargo install --locked --path .
cargo install --force --locked --path .
cd ~
- name: Run cargo prove new
Expand Down
2 changes: 2 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ strum = "0.26"
web-time = "1.1.0"
rayon-scan = "0.1.1"
serial_test = "3.1.1"
thiserror = "1.0.60"

[dev-dependencies]
tiny-keccak = { version = "2.0.2", features = ["keccak"] }
Expand Down
6 changes: 3 additions & 3 deletions core/benches/main.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use criterion::{black_box, criterion_group, criterion_main, Criterion};
use sp1_core::io::SP1Stdin;
use sp1_core::runtime::{Program, Runtime};
use sp1_core::utils::{run_and_prove, BabyBearPoseidon2};
use sp1_core::utils::{prove, BabyBearPoseidon2};

#[allow(unreachable_code)]
pub fn criterion_benchmark(c: &mut Criterion) {
Expand All @@ -13,14 +13,14 @@ pub fn criterion_benchmark(c: &mut Criterion) {
let program = Program::from_elf(&elf_path);
let cycles = {
let mut runtime = Runtime::new(program.clone());
runtime.run();
runtime.run().unwrap();
runtime.state.global_clk
};
group.bench_function(
format!("main:{}:{}", p.split('/').last().unwrap(), cycles),
|b| {
b.iter(|| {
run_and_prove(
prove(
black_box(program.clone()),
&SP1Stdin::new(),
BabyBearPoseidon2::new(),
Expand Down
2 changes: 1 addition & 1 deletion core/src/cpu/trace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ mod tests {
fn generate_trace_simple_program() {
let program = simple_program();
let mut runtime = Runtime::new(program);
runtime.run();
runtime.run().unwrap();
let chip = CpuChip::default();
let trace: RowMajorMatrix<BabyBear> =
chip.generate_trace(&runtime.record, &mut ExecutionRecord::default());
Expand Down
2 changes: 1 addition & 1 deletion core/src/lookup/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ mod test {
let machine = RiscvAir::machine(config);
let (pk, _) = machine.setup(&program);
let mut runtime = Runtime::new(program);
runtime.run();
runtime.run().unwrap();
let shards = machine.shard(runtime.record, &ShardingConfig::default());
let ok =
debug_interactions_with_all_chips(&machine, &pk, &shards, InteractionKind::all_kinds());
Expand Down
8 changes: 4 additions & 4 deletions core/src/memory/global.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ mod tests {
fn test_memory_generate_trace() {
let program = simple_program();
let mut runtime = Runtime::new(program);
runtime.run();
runtime.run().unwrap();
let shard = runtime.record.clone();

let chip: MemoryChip = MemoryChip::new(MemoryChipType::Initialize);
Expand All @@ -211,7 +211,7 @@ mod tests {

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

let chip = MemoryChip::new(MemoryChipType::Initialize);

Expand All @@ -229,7 +229,7 @@ mod tests {
let program = sha_extend_program();
let program_clone = program.clone();
let mut runtime = Runtime::new(program);
runtime.run();
runtime.run().unwrap();
let machine: crate::stark::StarkMachine<BabyBearPoseidon2, RiscvAir<BabyBear>> =
RiscvAir::machine(BabyBearPoseidon2::new());
let (pkey, _) = machine.setup(&program_clone);
Expand All @@ -252,7 +252,7 @@ mod tests {
let program = sha_extend_program();
let program_clone = program.clone();
let mut runtime = Runtime::new(program);
runtime.run();
runtime.run().unwrap();
let machine = RiscvAir::machine(BabyBearPoseidon2::new());
let (pkey, _) = machine.setup(&program_clone);
let shards = machine.shard(
Expand Down
8 changes: 4 additions & 4 deletions core/src/runtime/io.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ pub mod tests {
use super::*;
use crate::runtime::Program;
use crate::utils::tests::IO_ELF;
use crate::utils::{self, prove_core, BabyBearBlake3};
use crate::utils::{self, prove_simple, BabyBearBlake3};
use serde::Deserialize;

#[derive(Serialize, Deserialize, Debug, PartialEq)]
Expand Down Expand Up @@ -93,7 +93,7 @@ pub mod tests {
let points = points();
runtime.write_stdin(&points.0);
runtime.write_stdin(&points.1);
runtime.run();
runtime.run().unwrap();
let added_point = runtime.read_public_values::<MyPointUnaligned>();
assert_eq!(
added_point,
Expand All @@ -113,8 +113,8 @@ pub mod tests {
let points = points();
runtime.write_stdin(&points.0);
runtime.write_stdin(&points.1);
runtime.run();
runtime.run().unwrap();
let config = BabyBearBlake3::new();
prove_core(config, runtime);
prove_simple(config, runtime).unwrap();
}
}
Loading

0 comments on commit 518bea3

Please sign in to comment.