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

chore: Improve and update dependencies #104

Merged
merged 5 commits into from
Jun 24, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
2 changes: 2 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
run: |
git config --global url."https://${{ secrets.REPO_TOKEN }}@github.com/".insteadOf ssh://git@github.com
git config --global url."https://${{ secrets.REPO_TOKEN }}@github.com".insteadOf https://github.com
echo "CARGO_NET_GIT_FETCH_WITH_CLI=true" | tee -a $GITHUB_ENV
- uses: actions/checkout@v4
with:
repository: lurk-lab/ci-workflows
Expand All @@ -38,6 +39,7 @@ jobs:
run: |
git config --global url."https://${{ secrets.REPO_TOKEN }}@github.com/".insteadOf ssh://git@github.com
git config --global url."https://${{ secrets.REPO_TOKEN }}@github.com".insteadOf https://github.com
echo "CARGO_NET_GIT_FETCH_WITH_CLI=true" | tee -a $GITHUB_ENV
- uses: actions/checkout@v4
with:
repository: lurk-lab/ci-workflows
Expand Down
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 = "dev"}
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
8 changes: 6 additions & 2 deletions src/lair/lair_chip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,11 @@ mod tests {

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

#[test]
fn test_prove_and_verify() {
Expand Down Expand Up @@ -171,7 +174,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
60 changes: 36 additions & 24 deletions src/poseidon/constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,16 @@ use p3_field::AbstractField;

// +++ t = 4, R_F = 8, R_P = 21 +++
lazy_static! {
pub static ref MATRIX_DIAG_4_BABYBEAR: Array<BabyBear, U4> = Array::clone_from_slice(
pub static ref MATRIX_DIAG_4_BABYBEAR: Array<BabyBear, U4> = Array::try_from(
[
BabyBear::from_canonical_u32(0x35bf6f46),
BabyBear::from_canonical_u32(0x6982669e),
BabyBear::from_canonical_u32(0x41f852b1),
BabyBear::from_canonical_u32(0x375cdab7),
]
.as_ref()
);
)
.unwrap();
pub static ref FULL_RC_4_8: [[BabyBear; 4]; 8] = [
[
BabyBear::from_canonical_u32(0x1b149b6a),
Expand Down Expand Up @@ -96,7 +97,7 @@ lazy_static! {

// +++ t = 8, R_F = 8, R_P = 12 +++
lazy_static! {
pub static ref MATRIX_DIAG_8_BABYBEAR: Array<BabyBear, U8> = Array::clone_from_slice(
pub static ref MATRIX_DIAG_8_BABYBEAR: Array<BabyBear, U8> = Array::try_from(
[
BabyBear::from_canonical_u32(0x17a3691a),
BabyBear::from_canonical_u32(0x00849878),
Expand All @@ -108,7 +109,8 @@ lazy_static! {
BabyBear::from_canonical_u32(0x468846c4),
]
.as_ref()
);
)
.unwrap();
pub static ref FULL_RC_8_8: [[BabyBear; 8]; 8] = [
[
BabyBear::from_canonical_u32(0x11978cde),
Expand Down Expand Up @@ -209,7 +211,7 @@ lazy_static! {

// +++ t = 12, R_F = 8, R_P = 10 +++
lazy_static! {
pub static ref MATRIX_DIAG_12_BABYBEAR: Array<BabyBear, U12> = Array::clone_from_slice(
pub static ref MATRIX_DIAG_12_BABYBEAR: Array<BabyBear, U12> = Array::try_from(
[
BabyBear::from_canonical_u32(0x5ce6d17e),
BabyBear::from_canonical_u32(0x392b0106),
Expand All @@ -225,7 +227,8 @@ lazy_static! {
BabyBear::from_canonical_u32(0x63a32984),
]
.as_ref()
);
)
.unwrap();
pub static ref FULL_RC_12_8: [[BabyBear; 12]; 8] = [
[
BabyBear::from_canonical_u32(0x44d3bb88),
Expand Down Expand Up @@ -356,7 +359,7 @@ lazy_static! {

// +++ t = 16, R_F = 8, R_P = 13 +++
lazy_static! {
pub static ref MATRIX_DIAG_16_BABYBEAR: Array<BabyBear, U16> = Array::clone_from_slice(
pub static ref MATRIX_DIAG_16_BABYBEAR: Array<BabyBear, U16> = Array::try_from(
[
BabyBear::from_canonical_u32(0x0a632d93),
BabyBear::from_canonical_u32(0x6db657b6),
Expand All @@ -376,7 +379,8 @@ lazy_static! {
BabyBear::from_canonical_u32(0x5231c801),
]
.as_ref()
);
)
.unwrap();
pub static ref FULL_RC_16_8: [[BabyBear; 16]; 8] = [
[
BabyBear::from_canonical_u32(0x69cbb6af),
Expand Down Expand Up @@ -542,7 +546,7 @@ lazy_static! {

// +++ t = 20, R_F = 8, R_P = 18 +++
lazy_static! {
pub static ref MATRIX_DIAG_20_BABYBEAR: Array<BabyBear, U20> = Array::clone_from_slice(
pub static ref MATRIX_DIAG_20_BABYBEAR: Array<BabyBear, U20> = Array::try_from(
[
BabyBear::from_canonical_u32(0x60531da2),
BabyBear::from_canonical_u32(0x332932da),
Expand All @@ -566,7 +570,8 @@ lazy_static! {
BabyBear::from_canonical_u32(0x025b97c2),
]
.as_ref()
);
)
.unwrap();
pub static ref FULL_RC_20_8: [[BabyBear; 20]; 8] = [
[
BabyBear::from_canonical_u32(0x30cd4497),
Expand Down Expand Up @@ -769,7 +774,7 @@ lazy_static! {

// +++ t = 24, R_F = 8, R_P = 21 +++
lazy_static! {
pub static ref MATRIX_DIAG_24_BABYBEAR: Array<BabyBear, U24> = Array::clone_from_slice(
pub static ref MATRIX_DIAG_24_BABYBEAR: Array<BabyBear, U24> = Array::try_from(
[
BabyBear::from_canonical_u32(0x409133ef),
BabyBear::from_canonical_u32(0x1667a8a0),
Expand Down Expand Up @@ -797,7 +802,8 @@ lazy_static! {
BabyBear::from_canonical_u32(0x36c0e387),
]
.as_ref()
);
)
.unwrap();
pub static ref FULL_RC_24_8: [[BabyBear; 24]; 8] = [
[
BabyBear::from_canonical_u32(0x0fa20c37),
Expand Down Expand Up @@ -1035,7 +1041,7 @@ lazy_static! {

// +++ t = 28, R_F = 8, R_P = 25 +++
lazy_static! {
pub static ref MATRIX_DIAG_28_BABYBEAR: Array<BabyBear, U28> = Array::clone_from_slice(
pub static ref MATRIX_DIAG_28_BABYBEAR: Array<BabyBear, U28> = Array::try_from(
[
BabyBear::from_canonical_u32(0x283b2716),
BabyBear::from_canonical_u32(0x2c6fc85a),
Expand Down Expand Up @@ -1067,7 +1073,8 @@ lazy_static! {
BabyBear::from_canonical_u32(0x29cd05b9),
]
.as_ref()
);
)
.unwrap();
pub static ref FULL_RC_28_8: [[BabyBear; 28]; 8] = [
[
BabyBear::from_canonical_u32(0x1a4948c3),
Expand Down Expand Up @@ -1341,7 +1348,7 @@ lazy_static! {

// +++ t = 32, R_F = 8, R_P = 30 +++
lazy_static! {
pub static ref MATRIX_DIAG_32_BABYBEAR: Array<BabyBear, U32> = Array::clone_from_slice(
pub static ref MATRIX_DIAG_32_BABYBEAR: Array<BabyBear, U32> = Array::try_from(
[
BabyBear::from_canonical_u32(0x08529dda),
BabyBear::from_canonical_u32(0x082b3a31),
Expand Down Expand Up @@ -1377,7 +1384,8 @@ lazy_static! {
BabyBear::from_canonical_u32(0x524b3356),
]
.as_ref()
);
)
.unwrap();
pub static ref FULL_RC_32_8: [[BabyBear; 32]; 8] = [
[
BabyBear::from_canonical_u32(0x6710e381),
Expand Down Expand Up @@ -1688,7 +1696,7 @@ lazy_static! {

// +++ t = 36, R_F = 8, R_P = 34 +++
lazy_static! {
pub static ref MATRIX_DIAG_36_BABYBEAR: Array<BabyBear, U36> = Array::clone_from_slice(
pub static ref MATRIX_DIAG_36_BABYBEAR: Array<BabyBear, U36> = Array::try_from(
[
BabyBear::from_canonical_u32(0x14fe3780),
BabyBear::from_canonical_u32(0x24a66ad4),
Expand Down Expand Up @@ -1728,7 +1736,8 @@ lazy_static! {
BabyBear::from_canonical_u32(0x3835c26b),
]
.as_ref()
);
)
.unwrap();
pub static ref FULL_RC_36_8: [[BabyBear; 36]; 8] = [
[
BabyBear::from_canonical_u32(0x2944306f),
Expand Down Expand Up @@ -2075,7 +2084,7 @@ lazy_static! {

// +++ t = 40, R_F = 8, R_P = 38 +++
lazy_static! {
pub static ref MATRIX_DIAG_40_BABYBEAR: Array<BabyBear, U40> = Array::clone_from_slice(
pub static ref MATRIX_DIAG_40_BABYBEAR: Array<BabyBear, U40> = Array::try_from(
[
BabyBear::from_canonical_u32(0x1777e9b2),
BabyBear::from_canonical_u32(0x0543f0b4),
Expand Down Expand Up @@ -2119,7 +2128,8 @@ lazy_static! {
BabyBear::from_canonical_u32(0x77215247),
]
.as_ref()
);
)
.unwrap();
pub static ref FULL_RC_40_8: [[BabyBear; 40]; 8] = [
[
BabyBear::from_canonical_u32(0x0267f8f9),
Expand Down Expand Up @@ -2502,7 +2512,7 @@ lazy_static! {

// +++ t = 44, R_F = 8, R_P = 42 +++
lazy_static! {
pub static ref MATRIX_DIAG_44_BABYBEAR: Array<BabyBear, U44> = Array::clone_from_slice(
pub static ref MATRIX_DIAG_44_BABYBEAR: Array<BabyBear, U44> = Array::try_from(
[
BabyBear::from_canonical_u32(0x15c26880),
BabyBear::from_canonical_u32(0x20f77f08),
Expand Down Expand Up @@ -2550,7 +2560,8 @@ lazy_static! {
BabyBear::from_canonical_u32(0x1c3102da),
]
.as_ref()
);
)
.unwrap();
pub static ref FULL_RC_44_8: [[BabyBear; 44]; 8] = [
[
BabyBear::from_canonical_u32(0x1c9054d7),
Expand Down Expand Up @@ -2969,7 +2980,7 @@ lazy_static! {

// +++ t = 48, R_F = 8, R_P = 46 +++
lazy_static! {
pub static ref MATRIX_DIAG_48_BABYBEAR: Array<BabyBear, U48> = Array::clone_from_slice(
pub static ref MATRIX_DIAG_48_BABYBEAR: Array<BabyBear, U48> = Array::try_from(
[
BabyBear::from_canonical_u32(0x1c9a964a),
BabyBear::from_canonical_u32(0x5f04c2b2),
Expand Down Expand Up @@ -3021,7 +3032,8 @@ lazy_static! {
BabyBear::from_canonical_u32(0x3b3bd3b0),
]
.as_ref()
);
)
.unwrap();
pub static ref FULL_RC_48_8: [[BabyBear; 48]; 8] = [
[
BabyBear::from_canonical_u32(0x761c8842),
Expand Down
Loading