Skip to content

Commit

Permalink
chore: Improve and update dependencies
Browse files Browse the repository at this point in the history
- Replaced standard HashMap with hashbrown's HashMap in `execute.rs` for optimization.
- Modified `prove` method in `StarkMachine` to take a new additional argument `opts` of type `SphinxCoreOpts`.
- Updated several dependencies branch references in `Cargo.toml` including changing `sphinx-core` to use `plonk-rebased` branch.

Companion PR of argumentcomputer/sphinx#72
  • Loading branch information
huitseeker committed Jun 24, 2024
1 parent fffb994 commit ae169db
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 16 deletions.
28 changes: 15 additions & 13 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ edition = "2021"
[workspace.dependencies]
rayon = "1.10.0"
itertools = "0.13.0"
p3-air = { git = "https://github.com/lurk-lab/Plonky3.git", branch = "sp1-new-tmp" }
p3-baby-bear = { git = "https://github.com/lurk-lab/Plonky3.git", branch = "sp1-new-tmp" }
p3-field = { git = "https://github.com/lurk-lab/Plonky3.git", branch = "sp1-new-tmp" }
p3-matrix = { git = "https://github.com/lurk-lab/Plonky3.git", branch = "sp1-new-tmp" }
p3-mds = { git = "https://github.com/lurk-lab/Plonky3.git", branch = "sp1-new-tmp" }
p3-commit = { git = "https://github.com/lurk-lab/Plonky3.git", branch = "sp1-new-tmp" }
p3-challenger = { git = "https://github.com/lurk-lab/Plonky3.git", branch = "sp1-new-tmp" }
p3-maybe-rayon = { git = "https://github.com/lurk-lab/Plonky3.git", branch = "sp1-new-tmp" }
p3-poseidon2 = { git = "https://github.com/lurk-lab/Plonky3.git", branch = "sp1-new-tmp" }
p3-symmetric = { git = "https://github.com/lurk-lab/Plonky3.git", branch = "sp1-new-tmp" }
p3-uni-stark = { git = "https://github.com/lurk-lab/Plonky3.git", branch = "sp1-new-tmp" }
p3-util = { git = "https://github.com/lurk-lab/Plonky3.git", branch = "sp1-new-tmp" }
sphinx-core = { git = "ssh://git@github.com/lurk-lab/sphinx.git", branch = "dev-tmp"}
p3-air = { git = "https://github.com/lurk-lab/Plonky3.git", branch = "sp1" }
p3-baby-bear = { git = "https://github.com/lurk-lab/Plonky3.git", branch = "sp1" }
p3-field = { git = "https://github.com/lurk-lab/Plonky3.git", branch = "sp1" }
p3-matrix = { git = "https://github.com/lurk-lab/Plonky3.git", branch = "sp1" }
p3-mds = { git = "https://github.com/lurk-lab/Plonky3.git", branch = "sp1" }
p3-commit = { git = "https://github.com/lurk-lab/Plonky3.git", branch = "sp1" }
p3-challenger = { git = "https://github.com/lurk-lab/Plonky3.git", branch = "sp1" }
p3-maybe-rayon = { git = "https://github.com/lurk-lab/Plonky3.git", branch = "sp1" }
p3-poseidon2 = { git = "https://github.com/lurk-lab/Plonky3.git", branch = "sp1" }
p3-symmetric = { git = "https://github.com/lurk-lab/Plonky3.git", branch = "sp1" }
p3-uni-stark = { git = "https://github.com/lurk-lab/Plonky3.git", branch = "sp1" }
p3-util = { git = "https://github.com/lurk-lab/Plonky3.git", branch = "sp1" }
sphinx-core = { git = "ssh://git@github.com/lurk-lab/sphinx.git", branch = "plonk-rebased"}
anyhow = "1.0.72"
arc-swap = "1.7.1"
base-x = "0.2.11"
Expand All @@ -42,6 +42,7 @@ serde_json = "1.0"
thiserror = "1.0.44"
hybrid-array = "0.2.0-rc"
lazy_static = "1.4.0"
hashbrown = "0.14.5"

[dependencies]
anyhow = { workspace = true }
Expand Down Expand Up @@ -77,6 +78,7 @@ p3-poseidon2 = { workspace = true }
p3-symmetric = { workspace = true }
p3-util = { workspace = true }
sphinx-core = { workspace = true }
hashbrown = { workspace = true }

[dev-dependencies]
criterion = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion src/lair/execute.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use fxhash::FxBuildHasher;
use hashbrown::HashMap;
use indexmap::IndexMap;
use p3_field::{AbstractField, Field, PrimeField};
use sphinx_core::stark::{Indexed, MachineRecord};
use std::collections::HashMap;
use std::slice::Iter;

use super::{
Expand Down
5 changes: 3 additions & 2 deletions src/lair/lair_chip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ mod tests {

use crate::lair::execute::QueryRecord;
use p3_baby_bear::BabyBear;
use sphinx_core::stark::{LocalProver, StarkGenericConfig, StarkMachine};
use sphinx_core::{stark::{LocalProver, StarkGenericConfig, StarkMachine}, utils::SphinxCoreOpts};
use sphinx_core::utils::BabyBearPoseidon2;

#[test]
Expand Down Expand Up @@ -171,7 +171,8 @@ mod tests {
let mut challenger_p = machine.config().challenger();
let mut challenger_v = machine.config().challenger();
machine.debug_constraints(&pk, queries.clone(), &mut challenger_p.clone());
let proof = machine.prove::<LocalProver<_, _>>(&pk, queries, &mut challenger_p);
let opts = SphinxCoreOpts::default();
let proof = machine.prove::<LocalProver<_, _>>(&pk, queries, &mut challenger_p, opts);
machine
.verify(&vk, &proof, &mut challenger_v)
.expect("proof verifies");
Expand Down

0 comments on commit ae169db

Please sign in to comment.