Skip to content

Commit

Permalink
chore: more renamings
Browse files Browse the repository at this point in the history
  • Loading branch information
huitseeker committed Jun 3, 2024
1 parent 0056c45 commit 311b7b1
Show file tree
Hide file tree
Showing 57 changed files with 216 additions and 130 deletions.
4 changes: 2 additions & 2 deletions cli/src/bin/cargo-prove.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use sphinx_cli::{
build::BuildCmd, build_toolchain::BuildToolchainCmd,
install_toolchain::InstallToolchainCmd, new::NewCmd, prove::ProveCmd,
},
Sphinx_VERSION_MESSAGE,
SPHINX_VERSION_MESSAGE,
};

#[derive(Parser)]
Expand All @@ -15,7 +15,7 @@ pub enum Cargo {
}

#[derive(clap::Args)]
#[command(author, about, long_about = None, args_conflicts_with_subcommands = true, version = Sphinx_VERSION_MESSAGE)]
#[command(author, about, long_about = None, args_conflicts_with_subcommands = true, version = SPHINX_VERSION_MESSAGE)]
pub struct ProveCli {
#[clap(subcommand)]
pub command: Option<ProveCliCommands>,
Expand Down
2 changes: 1 addition & 1 deletion cli/src/commands/install_toolchain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ use clap::Parser;
use home::home_dir;
use rand::{distributions::Alphanumeric, Rng};
use reqwest::Client;
use sphinx_sdk::artifacts::download_file;
use std::fs::{self};
use std::io::Read;
use std::process::Command;
use sphinx_sdk::artifacts::download_file;

#[cfg(target_family = "unix")]
use std::os::unix::fs::PermissionsExt;
Expand Down
2 changes: 1 addition & 1 deletion cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use reqwest::Client;

pub const RUSTUP_TOOLCHAIN_NAME: &str = "succinct";

pub const Sphinx_VERSION_MESSAGE: &str = concat!(
pub const SPHINX_VERSION_MESSAGE: &str = concat!(
"sphinx",
" (",
env!("VERGEN_GIT_SHA"),
Expand Down
2 changes: 1 addition & 1 deletion core/src/air/public_values.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use super::Word;
use crate::stark::PROOF_MAX_NUM_PVS;

/// The number of non padded elements in the SP1 proofs public values vec.
pub const Sphinx_PROOF_NUM_PV_ELTS: usize = size_of::<PublicValues<Word<u8>, u8>>();
pub const SPHINX_PROOF_NUM_PV_ELTS: usize = size_of::<PublicValues<Word<u8>, u8>>();

/// The number of 32 bit words in the SP1 proof's committed value digest.
pub const PV_DIGEST_NUM_WORDS: usize = 8;
Expand Down
2 changes: 1 addition & 1 deletion core/src/cpu/columns/ecall.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use std::mem::size_of;
use sphinx_derive::AlignedBorrow;
use std::mem::size_of;

use crate::{air::PV_DIGEST_NUM_WORDS, operations::IsZeroOperation};

Expand Down
2 changes: 1 addition & 1 deletion core/src/operations/field/extensions/quadratic/sqrt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ use crate::operations::field::params::{FieldParameters, Limbs};
use crate::operations::field::range::FieldRangeCols;
use num::BigUint;
use p3_field::PrimeField32;
use std::fmt::Debug;
use sphinx_derive::AlignedBorrow;
use std::fmt::Debug;

use super::QuadFieldOpCols;

Expand Down
14 changes: 8 additions & 6 deletions core/src/runtime/syscall.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ pub enum SyscallCode {
COMMIT_DEFERRED_PROOFS = 0x00_00_00_1A,

/// Executes the `VERIFY_SP1_PROOF` precompile.
VERIFY_Sphinx_PROOF = 0x00_00_00_1B,
VERIFY_SPHINX_PROOF = 0x00_00_00_1B,

/// Executes the `HINT_LEN` precompile.
HINT_LEN = 0x00_00_00_F0,
Expand Down Expand Up @@ -146,7 +146,7 @@ impl SyscallCode {
0x00_01_01_79 => SyscallCode::BLS12381_FP2_MUL,
0x00_00_00_10 => SyscallCode::COMMIT,
0x00_00_00_1A => SyscallCode::COMMIT_DEFERRED_PROOFS,
0x00_00_00_1B => SyscallCode::VERIFY_Sphinx_PROOF,
0x00_00_00_1B => SyscallCode::VERIFY_SPHINX_PROOF,
0x00_00_00_F0 => SyscallCode::HINT_LEN,
0x00_00_00_F1 => SyscallCode::HINT_READ,
0x00_01_01_71 => SyscallCode::BLS12381_G1_ADD,
Expand Down Expand Up @@ -362,7 +362,7 @@ pub fn default_syscall_map() -> HashMap<SyscallCode, Arc<dyn Syscall>> {
Arc::new(SyscallCommitDeferred::new()),
);
syscall_map.insert(
SyscallCode::VERIFY_Sphinx_PROOF,
SyscallCode::VERIFY_SPHINX_PROOF,
Arc::new(SyscallVerifySphinxProof::new()),
);
syscall_map.insert(SyscallCode::HINT_LEN, Arc::new(SyscallHintLen::new()));
Expand Down Expand Up @@ -429,7 +429,9 @@ mod tests {
SyscallCode::EXIT_UNCONSTRAINED => {
assert_eq!(code as u32, sphinx_zkvm::syscalls::EXIT_UNCONSTRAINED)
}
SyscallCode::SHA_EXTEND => assert_eq!(code as u32, sphinx_zkvm::syscalls::SHA_EXTEND),
SyscallCode::SHA_EXTEND => {
assert_eq!(code as u32, sphinx_zkvm::syscalls::SHA_EXTEND)
}
SyscallCode::SHA_COMPRESS => {
assert_eq!(code as u32, sphinx_zkvm::syscalls::SHA_COMPRESS)
}
Expand Down Expand Up @@ -487,8 +489,8 @@ mod tests {
SyscallCode::COMMIT_DEFERRED_PROOFS => {
assert_eq!(code as u32, sphinx_zkvm::syscalls::COMMIT_DEFERRED_PROOFS)
}
SyscallCode::VERIFY_Sphinx_PROOF => {
assert_eq!(code as u32, sphinx_zkvm::syscalls::VERIFY_Sphinx_PROOF)
SyscallCode::VERIFY_SPHINX_PROOF => {
assert_eq!(code as u32, sphinx_zkvm::syscalls::VERIFY_SPHINX_PROOF)
}
SyscallCode::HINT_LEN => assert_eq!(code as u32, sphinx_zkvm::syscalls::HINT_LEN),
SyscallCode::HINT_READ => assert_eq!(code as u32, sphinx_zkvm::syscalls::HINT_READ),
Expand Down
4 changes: 2 additions & 2 deletions core/src/stark/air.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use super::StarkMachine;
pub use crate::air::SphinxAirBuilder;
use crate::air::{MachineAir, Sphinx_PROOF_NUM_PV_ELTS};
use crate::air::{MachineAir, SPHINX_PROOF_NUM_PV_ELTS};
use crate::memory::{MemoryChipType, MemoryProgramChip};
use crate::stark::Chip;
use crate::syscall::precompiles::bls12_381::g1_decompress::Bls12381G1DecompressChip;
Expand Down Expand Up @@ -123,7 +123,7 @@ impl<F: PrimeField32> RiscvAir<F> {
.into_iter()
.map(Chip::new)
.collect::<Vec<_>>();
StarkMachine::new(config, chips, Sphinx_PROOF_NUM_PV_ELTS)
StarkMachine::new(config, chips, SPHINX_PROOF_NUM_PV_ELTS)
}

/// Get all the different RISC-V AIRs.
Expand Down
2 changes: 1 addition & 1 deletion core/src/syscall/precompiles/bls12_381/g2_add.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ use p3_matrix::dense::RowMajorMatrix;
use p3_matrix::Matrix;
use serde::Deserialize;
use serde::Serialize;
use std::mem::size_of;
use sphinx_derive::AlignedBorrow;
use std::mem::size_of;

/// Chip for adding to BLS12-381 G2Affine points (A and B).
///
Expand Down
2 changes: 1 addition & 1 deletion core/src/syscall/precompiles/bls12_381/g2_double.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ use p3_matrix::dense::RowMajorMatrix;
use p3_matrix::Matrix;
use serde::Deserialize;
use serde::Serialize;
use std::mem::size_of;
use sphinx_derive::AlignedBorrow;
use std::mem::size_of;

/// Chip for doubling a BLS12-381 G2Affine point (P).
///
Expand Down
2 changes: 1 addition & 1 deletion core/src/syscall/precompiles/field/add.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ use p3_field::{AbstractField, PrimeField32};
use p3_matrix::{dense::RowMajorMatrix, Matrix};
use p3_maybe_rayon::prelude::{IntoParallelRefIterator, ParallelIterator};
use serde::{Deserialize, Serialize};
use tracing::instrument;
use sphinx_derive::AlignedBorrow;
use tracing::instrument;

use crate::{
air::{AluAirBuilder, MachineAir, MemoryAirBuilder},
Expand Down
2 changes: 1 addition & 1 deletion core/src/syscall/precompiles/field/mul.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ use p3_field::{AbstractField, PrimeField32};
use p3_matrix::{dense::RowMajorMatrix, Matrix};
use p3_maybe_rayon::prelude::{IntoParallelRefIterator, ParallelIterator};
use serde::{Deserialize, Serialize};
use tracing::instrument;
use sphinx_derive::AlignedBorrow;
use tracing::instrument;

use crate::{
air::{AluAirBuilder, MachineAir, MemoryAirBuilder},
Expand Down
2 changes: 1 addition & 1 deletion core/src/syscall/precompiles/field/sub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ use p3_field::{AbstractField, PrimeField32};
use p3_matrix::{dense::RowMajorMatrix, Matrix};
use p3_maybe_rayon::prelude::{IntoParallelRefIterator, ParallelIterator};
use serde::{Deserialize, Serialize};
use tracing::instrument;
use sphinx_derive::AlignedBorrow;
use tracing::instrument;

use crate::{
air::{AluAirBuilder, MachineAir, MemoryAirBuilder},
Expand Down
2 changes: 1 addition & 1 deletion core/src/syscall/precompiles/quad_field/add.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ use p3_field::{AbstractField, PrimeField32};
use p3_matrix::{dense::RowMajorMatrix, Matrix};
use p3_maybe_rayon::prelude::{IntoParallelRefIterator, ParallelIterator};
use serde::{Deserialize, Serialize};
use tracing::instrument;
use sphinx_derive::AlignedBorrow;
use tracing::instrument;

use crate::{
air::{AluAirBuilder, MachineAir, MemoryAirBuilder},
Expand Down
2 changes: 1 addition & 1 deletion core/src/syscall/precompiles/quad_field/mul.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ use p3_field::{AbstractField, PrimeField32};
use p3_matrix::{dense::RowMajorMatrix, Matrix};
use p3_maybe_rayon::prelude::{IntoParallelRefIterator, ParallelIterator};
use serde::{Deserialize, Serialize};
use tracing::instrument;
use sphinx_derive::AlignedBorrow;
use tracing::instrument;

use crate::{
air::{AluAirBuilder, MachineAir, MemoryAirBuilder},
Expand Down
2 changes: 1 addition & 1 deletion core/src/syscall/precompiles/quad_field/sub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ use p3_field::{AbstractField, PrimeField32};
use p3_matrix::{dense::RowMajorMatrix, Matrix};
use p3_maybe_rayon::prelude::{IntoParallelRefIterator, ParallelIterator};
use serde::{Deserialize, Serialize};
use tracing::instrument;
use sphinx_derive::AlignedBorrow;
use tracing::instrument;

use crate::{
air::{AluAirBuilder, MachineAir, MemoryAirBuilder},
Expand Down
4 changes: 3 additions & 1 deletion core/src/utils/prove.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,9 @@ where
// If we don't need to batch, we can just run the program normally and prove it.
if env::shard_batch_size() == 0 {
// Execute the runtime and collect all the events..
runtime.run().map_err(SphinxCoreProverError::ExecutionError)?;
runtime
.run()
.map_err(SphinxCoreProverError::ExecutionError)?;

// If debugging is enabled, we will also debug the constraints.
#[cfg(feature = "debug")]
Expand Down
4 changes: 2 additions & 2 deletions eval.sh
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ for program in "${programs[@]}"; do
for hash_fn in "${hash_functions[@]}"; do
for shard_size in "${shard_sizes[@]}"; do
echo "Running $program with hash function $hash_fn and shard size $shard_size, $runs times"
if ! CARGO_NET_GIT_FETCH_WITH_CLI=true RUSTFLAGS='-C target-cpu=native' cargo run -p wp1-eval --release -- \
if ! CARGO_NET_GIT_FETCH_WITH_CLI=true RUSTFLAGS='-C target-cpu=native' cargo run -p sphinx-eval --release -- \
--program $program --hashfn $hash_fn --shard-size $shard_size --benchmark-path "$benchmark_path" --elf-path "$elf_path" --runs $runs; then
echo "Error running evaluation for $program with hash function $hash_fn and shard size $shard_size"
fi
done
done

cd "$root_directory"
done
done
58 changes: 29 additions & 29 deletions examples/bls12381-pairing/program/Cargo.lock

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

Binary file not shown.
10 changes: 5 additions & 5 deletions prover/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,32 @@ all:
build-groth16:
mkdir -p build && \
RUSTFLAGS='-C target-cpu=native' \
cargo run -p wp1-prover --release --bin build_groth16 -- \
cargo run -p sphinx-prover --release --bin build_groth16 -- \
--build-dir=./build

release-groth16:
bash release.sh

test-e2e:
RUSTFLAGS='-C target-cpu=native' \
cargo test --package wp1-prover --lib --release -- tests::test_e2e --exact --show-output
cargo test --package sphinx-prover --lib --release -- tests::test_e2e --exact --show-output

fibonacci-sweep:
mkdir -p scripts/results && \
rm -f scripts/results/fibonacci_sweep.log && \
RUSTFLAGS='-C target-cpu=native -C target_feature=+avx512ifma,+avx512vl' \
RUST_LOG=info \
cargo run --package wp1-prover --release --bin fibonacci_sweep
cargo run --package sphinx-prover --release --bin fibonacci_sweep

tendermint-sweep:
mkdir -p scripts/results && \
rm -f scripts/results/tendermint_sweep.log && \
RUSTFLAGS='-C target-cpu=native -C target_feature=+avx512ifma,+avx512vl' \
RUST_LOG=info \
cargo run --package wp1-prover --release --bin tendermint_sweep
cargo run --package sphinx-prover --release --bin tendermint_sweep

fibonacci-groth16:
mkdir -p scripts/results && \
RUSTFLAGS='-C target-cpu=native -C target_feature=+avx512ifma,+avx512vl' \
RUST_LOG=info \
cargo run --package wp1-prover --release --bin fibonacci_groth16
cargo run --package sphinx-prover --release --bin fibonacci_groth16
Loading

0 comments on commit 311b7b1

Please sign in to comment.