Skip to content

Commit

Permalink
clean
Browse files Browse the repository at this point in the history
  • Loading branch information
ratankaliani committed May 14, 2024
2 parents 8015826 + 518bea3 commit caca2bb
Show file tree
Hide file tree
Showing 36 changed files with 1,218 additions and 391 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ on:
- "sdk/**"
- ".github/workflows/**"
merge_group:

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
Expand Down 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,17 +161,18 @@ jobs:
- name: Install SP1 CLI
run: |
cd cli
cargo install --locked --path .
cargo install --force --locked --path .
cd ~
- name: Run cargo prove new
run: |
cargo prove new fibonacci
- name: Build program and run script
run: |
cd fibonacci
cd program
cargo prove build
cd ../script
SP1_DEV=1 RUST_LOG=info cargo run --release
cargo add sp1-sdk --path $GITHUB_WORKSPACE/sdk
SP1_DEV=1 RUST_LOG=info cargo run --release
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.

2 changes: 1 addition & 1 deletion cli/src/assets/program/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ name = "unnamed-program"
edition = "2021"

[dependencies]
sp1-zkvm = { git = "https://github.com/succinctlabs/sp1.git", rev = "v1.0.0-testnet" }
sp1-zkvm = { git = "https://github.com/succinctlabs/sp1.git", branch = "main" }
4 changes: 2 additions & 2 deletions cli/src/assets/script/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ name = "unnamed-script"
edition = "2021"

[dependencies]
sp1-sdk = { git = "https://github.com/succinctlabs/sp1.git", rev = "v1.0.0-testnet" }
sp1-sdk = { git = "https://github.com/succinctlabs/sp1.git", branch = "main" }

[build-dependencies]
sp1-helper = { git = "https://github.com/succinctlabs/sp1.git", rev = "v1.0.0-testnet" }
sp1-helper = { git = "https://github.com/succinctlabs/sp1.git", branch = "main" }
6 changes: 4 additions & 2 deletions cli/src/assets/script/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ fn main() {
stdin.write(&n);
let client = ProverClient::new();
let (pk, vk) = client.setup(ELF);
let mut proof = client.prove(&pk, stdin).expect("proving failed");
let mut proof = client.prove_compressed(&pk, stdin).expect("proving failed");

// Read output.
let a = proof.public_values.read::<u128>();
Expand All @@ -20,7 +20,9 @@ fn main() {
println!("b: {}", b);

// Verify proof.
client.verify(&proof, &vk).expect("verification failed");
client
.verify_compressed(&proof, &vk)
.expect("verification failed");

// Save proof.
proof
Expand Down
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 caca2bb

Please sign in to comment.