mirror of
https://github.com/logos-storage/plonky2.git
synced 2026-01-03 14:23:07 +00:00
Prep for publishing to crates.io
This commit is contained in:
parent
815113809a
commit
137bc78565
@ -1,18 +1,20 @@
|
||||
[package]
|
||||
name = "plonky2_ecdsa"
|
||||
description = "ECDSA gadget for Plonky2"
|
||||
version = "0.1.0"
|
||||
license = "MIT OR Apache-2.0"
|
||||
edition = "2021"
|
||||
|
||||
[features]
|
||||
parallel = ["maybe_rayon/parallel", "plonky2/parallel"]
|
||||
parallel = ["plonky2_maybe_rayon/parallel", "plonky2/parallel"]
|
||||
|
||||
[dependencies]
|
||||
anyhow = { version = "1.0.40", default-features = false }
|
||||
itertools = { version = "0.10.0", default-features = false }
|
||||
maybe_rayon = { path = "../maybe_rayon", default-features = false }
|
||||
plonky2_maybe_rayon = { version = "0.1.0", default-features = false }
|
||||
num = { version = "0.4.0", default-features = false }
|
||||
plonky2 = { path = "../plonky2", default-features = false }
|
||||
plonky2_u32 = { path = "../u32", default-features = false }
|
||||
plonky2 = { version = "0.1.1", default-features = false }
|
||||
plonky2_u32 = { version = "0.1.0", default-features = false }
|
||||
serde = { version = "1.0", default-features = false, features = ["derive"] }
|
||||
|
||||
[dev-dependencies]
|
||||
|
||||
@ -1,8 +1,8 @@
|
||||
use alloc::vec::Vec;
|
||||
|
||||
use itertools::Itertools;
|
||||
use maybe_rayon::*;
|
||||
use plonky2::field::types::{Field, PrimeField};
|
||||
use plonky2_maybe_rayon::*;
|
||||
|
||||
use crate::curve::curve_summation::affine_multisummation_best;
|
||||
use crate::curve::curve_types::{AffinePoint, Curve, ProjectivePoint};
|
||||
|
||||
@ -2,6 +2,11 @@
|
||||
name = "plonky2_evm"
|
||||
description = "Implementation of STARKs for the Ethereum Virtual Machine"
|
||||
version = "0.1.0"
|
||||
authors = ["Daniel Lubarov <daniel@lubarov.com>", "William Borgeaud <williamborgeaud@gmail.com>"]
|
||||
readme = "README.md"
|
||||
repository = "https://github.com/mir-protocol/plonky2"
|
||||
keywords = ["EVM", "STARK", "Ethereum"]
|
||||
categories = ["cryptography"]
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
@ -15,13 +20,13 @@ hex-literal = "0.3.4"
|
||||
itertools = "0.10.3"
|
||||
keccak-hash = "0.10.0"
|
||||
log = "0.4.14"
|
||||
maybe_rayon = { path = "../maybe_rayon" }
|
||||
plonky2_maybe_rayon = "0.1.0"
|
||||
num = "0.4.0"
|
||||
once_cell = "1.13.0"
|
||||
pest = "2.1.3"
|
||||
pest_derive = "2.1.0"
|
||||
plonky2 = { path = "../plonky2", default-features = false, features = ["timing"] }
|
||||
plonky2_util = { path = "../util" }
|
||||
plonky2 = { version = "0.1.1", default-features = false, features = ["timing"] }
|
||||
plonky2_util = { version = "0.1.0" }
|
||||
rand = "0.8.5"
|
||||
rand_chacha = "0.3.1"
|
||||
rlp = "0.5.1"
|
||||
@ -42,7 +47,7 @@ sha2 = "0.10.6"
|
||||
[features]
|
||||
default = ["parallel"]
|
||||
asmtools = ["hex"]
|
||||
parallel = ["plonky2/parallel", "maybe_rayon/parallel"]
|
||||
parallel = ["plonky2/parallel", "plonky2_maybe_rayon/parallel"]
|
||||
|
||||
[[bin]]
|
||||
name = "assemble"
|
||||
|
||||
@ -41,8 +41,8 @@ impl Kernel {
|
||||
prover_inputs: HashMap<usize, ProverInputFn>,
|
||||
) -> Self {
|
||||
let code_hash_bytes = keccak(&code).0;
|
||||
let code_hash = std::array::from_fn(|i| {
|
||||
u32::from_le_bytes(std::array::from_fn(|j| code_hash_bytes[i * 4 + j]))
|
||||
let code_hash = core::array::from_fn(|i| {
|
||||
u32::from_le_bytes(core::array::from_fn(|j| code_hash_bytes[i * 4 + j]))
|
||||
});
|
||||
let ordered_labels = global_labels
|
||||
.keys()
|
||||
|
||||
@ -4,13 +4,13 @@ use crate::keccak_sponge::columns::{KECCAK_WIDTH_BYTES, KECCAK_WIDTH_U32S};
|
||||
|
||||
/// Like tiny-keccak's `keccakf`, but deals with `u32` limbs instead of `u64` limbs.
|
||||
pub(crate) fn keccakf_u32s(state_u32s: &mut [u32; KECCAK_WIDTH_U32S]) {
|
||||
let mut state_u64s: [u64; 25] = std::array::from_fn(|i| {
|
||||
let mut state_u64s: [u64; 25] = core::array::from_fn(|i| {
|
||||
let lo = state_u32s[i * 2] as u64;
|
||||
let hi = state_u32s[i * 2 + 1] as u64;
|
||||
lo | (hi << 32)
|
||||
});
|
||||
keccakf(&mut state_u64s);
|
||||
*state_u32s = std::array::from_fn(|i| {
|
||||
*state_u32s = core::array::from_fn(|i| {
|
||||
let u64_limb = state_u64s[i / 2];
|
||||
let is_hi = i % 2;
|
||||
(u64_limb >> (is_hi * 32)) as u32
|
||||
@ -20,9 +20,9 @@ pub(crate) fn keccakf_u32s(state_u32s: &mut [u32; KECCAK_WIDTH_U32S]) {
|
||||
/// Like tiny-keccak's `keccakf`, but deals with bytes instead of `u64` limbs.
|
||||
pub(crate) fn keccakf_u8s(state_u8s: &mut [u8; KECCAK_WIDTH_BYTES]) {
|
||||
let mut state_u64s: [u64; 25] =
|
||||
std::array::from_fn(|i| u64::from_le_bytes(state_u8s[i * 8..][..8].try_into().unwrap()));
|
||||
core::array::from_fn(|i| u64::from_le_bytes(state_u8s[i * 8..][..8].try_into().unwrap()));
|
||||
keccakf(&mut state_u64s);
|
||||
*state_u8s = std::array::from_fn(|i| {
|
||||
*state_u8s = core::array::from_fn(|i| {
|
||||
let u64_limb = state_u64s[i / 8];
|
||||
u64_limb.to_le_bytes()[i % 8]
|
||||
});
|
||||
|
||||
@ -24,7 +24,7 @@ fn mpt_hash_empty() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn mpt_hash_empty_branch() -> Result<()> {
|
||||
let children = std::array::from_fn(|_| PartialTrie::Empty.into());
|
||||
let children = core::array::from_fn(|_| PartialTrie::Empty.into());
|
||||
let state_trie = PartialTrie::Branch {
|
||||
children,
|
||||
value: vec![],
|
||||
@ -85,7 +85,7 @@ fn mpt_hash_branch_to_leaf() -> Result<()> {
|
||||
value: test_account_2_rlp(),
|
||||
}
|
||||
.into();
|
||||
let mut children = std::array::from_fn(|_| PartialTrie::Empty.into());
|
||||
let mut children = core::array::from_fn(|_| PartialTrie::Empty.into());
|
||||
children[3] = leaf;
|
||||
let state_trie = PartialTrie::Branch {
|
||||
children,
|
||||
|
||||
@ -66,7 +66,7 @@ fn mpt_insert_leaf_leaf_key_extends_insert_key() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn mpt_insert_branch_replacing_empty_child() -> Result<()> {
|
||||
let children = std::array::from_fn(|_| PartialTrie::Empty.into());
|
||||
let children = core::array::from_fn(|_| PartialTrie::Empty.into());
|
||||
let state_trie = PartialTrie::Branch {
|
||||
children,
|
||||
value: vec![],
|
||||
@ -81,7 +81,7 @@ fn mpt_insert_branch_replacing_empty_child() -> Result<()> {
|
||||
#[ignore]
|
||||
fn mpt_insert_extension_nonoverlapping_keys() -> Result<()> {
|
||||
// Existing keys are 0xABC, 0xABCDEF; inserted key is 0x12345.
|
||||
let mut children = std::array::from_fn(|_| PartialTrie::Empty.into());
|
||||
let mut children = core::array::from_fn(|_| PartialTrie::Empty.into());
|
||||
children[0xD] = PartialTrie::Leaf {
|
||||
nibbles: 0xEF_u64.into(),
|
||||
value: test_account_1_rlp(),
|
||||
@ -104,7 +104,7 @@ fn mpt_insert_extension_nonoverlapping_keys() -> Result<()> {
|
||||
#[ignore]
|
||||
fn mpt_insert_extension_insert_key_extends_node_key() -> Result<()> {
|
||||
// Existing keys are 0xA, 0xABCD; inserted key is 0xABCDEF.
|
||||
let mut children = std::array::from_fn(|_| PartialTrie::Empty.into());
|
||||
let mut children = core::array::from_fn(|_| PartialTrie::Empty.into());
|
||||
children[0xB] = PartialTrie::Leaf {
|
||||
nibbles: 0xCD_u64.into(),
|
||||
value: test_account_1_rlp(),
|
||||
@ -129,7 +129,7 @@ fn mpt_insert_branch_to_leaf_same_key() -> Result<()> {
|
||||
}
|
||||
.into();
|
||||
|
||||
let mut children = std::array::from_fn(|_| PartialTrie::Empty.into());
|
||||
let mut children = core::array::from_fn(|_| PartialTrie::Empty.into());
|
||||
children[0] = leaf;
|
||||
let state_trie = PartialTrie::Branch {
|
||||
children,
|
||||
|
||||
@ -134,7 +134,7 @@ fn load_all_mpts_hash() -> Result<()> {
|
||||
|
||||
#[test]
|
||||
fn load_all_mpts_empty_branch() -> Result<()> {
|
||||
let children = std::array::from_fn(|_| PartialTrie::Empty.into());
|
||||
let children = core::array::from_fn(|_| PartialTrie::Empty.into());
|
||||
let state_trie = PartialTrie::Branch {
|
||||
children,
|
||||
value: vec![],
|
||||
|
||||
@ -178,15 +178,15 @@ where
|
||||
stark_config: &StarkConfig,
|
||||
) -> RootCircuitData<F, C, D> {
|
||||
let inner_common_data: [_; NUM_TABLES] =
|
||||
std::array::from_fn(|i| &by_table[i].final_circuits()[0].common);
|
||||
core::array::from_fn(|i| &by_table[i].final_circuits()[0].common);
|
||||
|
||||
let mut builder = CircuitBuilder::new(CircuitConfig::standard_recursion_config());
|
||||
let recursive_proofs =
|
||||
std::array::from_fn(|i| builder.add_virtual_proof_with_pis::<C>(inner_common_data[i]));
|
||||
let pis: [_; NUM_TABLES] = std::array::from_fn(|i| {
|
||||
core::array::from_fn(|i| builder.add_virtual_proof_with_pis::<C>(inner_common_data[i]));
|
||||
let pis: [_; NUM_TABLES] = core::array::from_fn(|i| {
|
||||
PublicInputs::from_vec(&recursive_proofs[i].public_inputs, stark_config)
|
||||
});
|
||||
let index_verifier_data = std::array::from_fn(|_i| builder.add_virtual_target());
|
||||
let index_verifier_data = core::array::from_fn(|_i| builder.add_virtual_target());
|
||||
|
||||
let mut challenger = RecursiveChallenger::<F, C::Hasher, D>::new(&mut builder);
|
||||
for pi in &pis {
|
||||
|
||||
@ -35,7 +35,7 @@ impl<F: RichField + Extendable<D>, C: GenericConfig<D, F = F>, const D: usize> A
|
||||
let num_permutation_batch_sizes = all_stark.permutation_batch_sizes();
|
||||
|
||||
AllProofChallenges {
|
||||
stark_challenges: std::array::from_fn(|i| {
|
||||
stark_challenges: core::array::from_fn(|i| {
|
||||
challenger.compact();
|
||||
self.stark_proofs[i].proof.get_challenges(
|
||||
&mut challenger,
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
use std::marker::PhantomData;
|
||||
|
||||
use itertools::Itertools;
|
||||
use maybe_rayon::*;
|
||||
use plonky2::field::extension::{Extendable, FieldExtension};
|
||||
use plonky2::field::packed::PackedField;
|
||||
use plonky2::field::polynomial::PolynomialValues;
|
||||
@ -10,6 +9,7 @@ use plonky2::hash::hash_types::RichField;
|
||||
use plonky2::timed;
|
||||
use plonky2::util::timing::TimingTree;
|
||||
use plonky2::util::transpose;
|
||||
use plonky2_maybe_rayon::*;
|
||||
|
||||
use crate::constraint_consumer::{ConstraintConsumer, RecursiveConstraintConsumer};
|
||||
use crate::cross_table_lookup::Column;
|
||||
|
||||
@ -3,7 +3,6 @@
|
||||
use std::fmt::Debug;
|
||||
|
||||
use itertools::Itertools;
|
||||
use maybe_rayon::*;
|
||||
use plonky2::field::batch_util::batch_multiply_inplace;
|
||||
use plonky2::field::extension::{Extendable, FieldExtension};
|
||||
use plonky2::field::packed::PackedField;
|
||||
@ -17,6 +16,7 @@ use plonky2::plonk::circuit_builder::CircuitBuilder;
|
||||
use plonky2::plonk::config::{AlgebraicHasher, GenericConfig, Hasher};
|
||||
use plonky2::plonk::plonk_common::{reduce_with_powers, reduce_with_powers_ext_circuit};
|
||||
use plonky2::util::reducing::{ReducingFactor, ReducingFactorTarget};
|
||||
use plonky2_maybe_rayon::*;
|
||||
|
||||
use crate::config::StarkConfig;
|
||||
use crate::constraint_consumer::{ConstraintConsumer, RecursiveConstraintConsumer};
|
||||
|
||||
@ -1,6 +1,5 @@
|
||||
use ethereum_types::{Address, H256, U256};
|
||||
use itertools::Itertools;
|
||||
use maybe_rayon::*;
|
||||
use plonky2::field::extension::{Extendable, FieldExtension};
|
||||
use plonky2::fri::oracle::PolynomialBatch;
|
||||
use plonky2::fri::proof::{FriChallenges, FriChallengesTarget, FriProof, FriProofTarget};
|
||||
@ -13,6 +12,7 @@ use plonky2::hash::merkle_tree::MerkleCap;
|
||||
use plonky2::iop::ext_target::ExtensionTarget;
|
||||
use plonky2::iop::target::Target;
|
||||
use plonky2::plonk::config::GenericConfig;
|
||||
use plonky2_maybe_rayon::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::all_stark::NUM_TABLES;
|
||||
@ -29,7 +29,7 @@ pub struct AllProof<F: RichField + Extendable<D>, C: GenericConfig<D, F = F>, co
|
||||
|
||||
impl<F: RichField + Extendable<D>, C: GenericConfig<D, F = F>, const D: usize> AllProof<F, C, D> {
|
||||
pub fn degree_bits(&self, config: &StarkConfig) -> [usize; NUM_TABLES] {
|
||||
std::array::from_fn(|i| self.stark_proofs[i].proof.recover_degree_bits(config))
|
||||
core::array::from_fn(|i| self.stark_proofs[i].proof.recover_degree_bits(config))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2,7 +2,6 @@ use std::any::type_name;
|
||||
|
||||
use anyhow::{ensure, Result};
|
||||
use itertools::Itertools;
|
||||
use maybe_rayon::*;
|
||||
use once_cell::sync::Lazy;
|
||||
use plonky2::field::extension::Extendable;
|
||||
use plonky2::field::packable::Packable;
|
||||
@ -17,6 +16,7 @@ use plonky2::plonk::config::{GenericConfig, Hasher};
|
||||
use plonky2::timed;
|
||||
use plonky2::util::timing::TimingTree;
|
||||
use plonky2::util::transpose;
|
||||
use plonky2_maybe_rayon::*;
|
||||
use plonky2_util::{log2_ceil, log2_strict};
|
||||
|
||||
use crate::all_stark::{AllStark, Table, NUM_TABLES};
|
||||
|
||||
@ -107,7 +107,7 @@ impl<F: RichField + Extendable<D>, C: GenericConfig<D, F = F>, const D: usize>
|
||||
where
|
||||
[(); C::Hasher::HASH_SIZE]:,
|
||||
{
|
||||
let pis: [_; NUM_TABLES] = std::array::from_fn(|i| {
|
||||
let pis: [_; NUM_TABLES] = core::array::from_fn(|i| {
|
||||
PublicInputs::from_vec(&self.recursive_proofs[i].public_inputs, inner_config)
|
||||
});
|
||||
|
||||
@ -279,7 +279,7 @@ where
|
||||
num_permutation_zs,
|
||||
);
|
||||
|
||||
let init_challenger_state_target = std::array::from_fn(|_| builder.add_virtual_public_input());
|
||||
let init_challenger_state_target = core::array::from_fn(|_| builder.add_virtual_public_input());
|
||||
let mut challenger =
|
||||
RecursiveChallenger::<F, C::Hasher, D>::from_state(init_challenger_state_target);
|
||||
let challenges = proof_target.get_challenges::<F, C>(
|
||||
|
||||
@ -140,7 +140,7 @@ pub(crate) fn stack_pop_with_log_and_fill<const N: usize, F: Field>(
|
||||
return Err(ProgramError::StackUnderflow);
|
||||
}
|
||||
|
||||
let result = std::array::from_fn(|i| {
|
||||
let result = core::array::from_fn(|i| {
|
||||
let address = MemoryAddress::new(
|
||||
state.registers.context,
|
||||
Segment::Stack,
|
||||
|
||||
@ -56,7 +56,7 @@ fn test_basic_smart_contract() -> anyhow::Result<()> {
|
||||
};
|
||||
|
||||
let state_trie_before = {
|
||||
let mut children = std::array::from_fn(|_| PartialTrie::Empty.into());
|
||||
let mut children = core::array::from_fn(|_| PartialTrie::Empty.into());
|
||||
children[sender_nibbles.get_nibble(0) as usize] = PartialTrie::Leaf {
|
||||
nibbles: sender_nibbles.truncate_n_nibbles_front(1),
|
||||
value: rlp::encode(&sender_account_before).to_vec(),
|
||||
@ -110,7 +110,7 @@ fn test_basic_smart_contract() -> anyhow::Result<()> {
|
||||
..to_account_before
|
||||
};
|
||||
|
||||
let mut children = std::array::from_fn(|_| PartialTrie::Empty.into());
|
||||
let mut children = core::array::from_fn(|_| PartialTrie::Empty.into());
|
||||
children[sender_nibbles.get_nibble(0) as usize] = PartialTrie::Leaf {
|
||||
nibbles: sender_nibbles.truncate_n_nibbles_front(1),
|
||||
value: rlp::encode(&sender_account_after).to_vec(),
|
||||
|
||||
@ -83,7 +83,7 @@ fn test_simple_transfer() -> anyhow::Result<()> {
|
||||
..AccountRlp::default()
|
||||
};
|
||||
|
||||
let mut children = std::array::from_fn(|_| PartialTrie::Empty.into());
|
||||
let mut children = core::array::from_fn(|_| PartialTrie::Empty.into());
|
||||
children[sender_nibbles.get_nibble(0) as usize] = PartialTrie::Leaf {
|
||||
nibbles: sender_nibbles.truncate_n_nibbles_front(1),
|
||||
value: rlp::encode(&sender_account_after).to_vec(),
|
||||
|
||||
@ -2,13 +2,15 @@
|
||||
name = "plonky2_field"
|
||||
description = "Finite field arithmetic"
|
||||
version = "0.1.0"
|
||||
license = "MIT OR Apache-2.0"
|
||||
authors = ["Daniel Lubarov <daniel@lubarov.com>", "William Borgeaud <williamborgeaud@gmail.com>", "Jacqueline Nabaglo <j@nab.gl>", "Hamish Ivey-Law <hamish@ivey-law.name>"]
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
anyhow = { version = "1.0.40", default-features = false }
|
||||
itertools = { version = "0.10.0", default-features = false, features = ["use_alloc"] }
|
||||
num = { version = "0.4", default-features = false, features = ["alloc", "rand"] }
|
||||
plonky2_util = { path = "../util", default-features = false }
|
||||
plonky2_util = { version = "0.1.0", default-features = false }
|
||||
rand = { version = "0.8.5", default-features = false, features = ["getrandom"] }
|
||||
serde = { version = "1.0", default-features = false, features = ["alloc", "derive"] }
|
||||
static_assertions = { version = "1.1.0", default-features = false }
|
||||
|
||||
@ -6,8 +6,8 @@ edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
anyhow = { version = "1.0.40", default-features = false }
|
||||
plonky2 = { path = "../plonky2", default-features = false }
|
||||
plonky2 = { version = "0.1.1", default-features = false }
|
||||
|
||||
[dev-dependencies]
|
||||
plonky2 = { path = "../plonky2" }
|
||||
plonky2 = { version = "0.1.1" }
|
||||
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
[package]
|
||||
name = "maybe_rayon"
|
||||
name = "plonky2_maybe_rayon"
|
||||
description = "Feature-gated wrapper around rayon"
|
||||
license = "MIT OR Apache-2.0"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
|
||||
@ -1,19 +1,19 @@
|
||||
[package]
|
||||
name = "plonky2"
|
||||
description = "Recursive SNARKs based on PLONK and FRI"
|
||||
version = "0.1.0"
|
||||
authors = ["Polygon Zero <daniel@mirprotocol.org>"]
|
||||
version = "0.1.1"
|
||||
license = "MIT OR Apache-2.0"
|
||||
authors = ["Daniel Lubarov <daniel@lubarov.com>", "William Borgeaud <williamborgeaud@gmail.com>", "Nicholas Ward <npward@berkeley.edu>"]
|
||||
readme = "README.md"
|
||||
repository = "https://github.com/mir-protocol/plonky2"
|
||||
keywords = ["cryptography", "SNARK", "PLONK", "FRI"]
|
||||
categories = ["cryptography"]
|
||||
edition = "2021"
|
||||
default-run = "generate_constants"
|
||||
|
||||
[features]
|
||||
default = ["gate_testing", "parallel", "rand_chacha", "std", "timing"]
|
||||
gate_testing = []
|
||||
parallel = ["hashbrown/rayon", "maybe_rayon/parallel"]
|
||||
parallel = ["hashbrown/rayon", "plonky2_maybe_rayon/parallel"]
|
||||
std = ["anyhow/std", "rand/std"]
|
||||
timing = ["std"]
|
||||
|
||||
@ -24,10 +24,10 @@ hashbrown = { version = "0.12.3", default-features = false, features = ["ahash",
|
||||
itertools = { version = "0.10.0", default-features = false }
|
||||
keccak-hash = { version = "0.8.0", default-features = false }
|
||||
log = { version = "0.4.14", default-features = false }
|
||||
maybe_rayon = { path = "../maybe_rayon", default-features = false }
|
||||
plonky2_maybe_rayon = { version = "0.1.0", default-features = false }
|
||||
num = { version = "0.4", default-features = false, features = ["rand"] }
|
||||
plonky2_field = { path = "../field", default-features = false }
|
||||
plonky2_util = { path = "../util", default-features = false }
|
||||
plonky2_field = { version = "0.1.0", default-features = false }
|
||||
plonky2_util = { version = "0.1.0", default-features = false }
|
||||
rand = { version = "0.8.4", default-features = false }
|
||||
rand_chacha = { version = "0.3.1", optional = true, default-features = false }
|
||||
serde = { version = "1.0", default-features = false, features = ["derive"] }
|
||||
@ -38,7 +38,6 @@ unroll = { version = "0.1.5", default-features = false }
|
||||
criterion = { version = "0.4.0", default-features = false }
|
||||
env_logger = { version = "0.9.0", default-features = false }
|
||||
num_cpus = { version = "1.14.0", default-features = false }
|
||||
plonky2 = { path = "." }
|
||||
rand = { version = "0.8.4", default-features = false, features = ["getrandom"] }
|
||||
rand_chacha = { version = "0.3.1", default-features = false }
|
||||
serde_cbor = { version = "0.11.2" }
|
||||
|
||||
@ -9,7 +9,6 @@ use core::str::FromStr;
|
||||
|
||||
use anyhow::{anyhow, Context as _, Result};
|
||||
use log::{info, Level, LevelFilter};
|
||||
use maybe_rayon::rayon;
|
||||
use plonky2::gates::noop::NoopGate;
|
||||
use plonky2::hash::hash_types::RichField;
|
||||
use plonky2::iop::witness::{PartialWitness, WitnessWrite};
|
||||
@ -20,6 +19,7 @@ use plonky2::plonk::proof::{CompressedProofWithPublicInputs, ProofWithPublicInpu
|
||||
use plonky2::plonk::prover::prove;
|
||||
use plonky2::util::timing::TimingTree;
|
||||
use plonky2_field::extension::Extendable;
|
||||
use plonky2_maybe_rayon::rayon;
|
||||
use rand::rngs::OsRng;
|
||||
use rand::{RngCore, SeedableRng};
|
||||
use rand_chacha::ChaCha8Rng;
|
||||
|
||||
@ -2,8 +2,8 @@ use alloc::format;
|
||||
use alloc::vec::Vec;
|
||||
|
||||
use itertools::Itertools;
|
||||
use maybe_rayon::*;
|
||||
use plonky2_field::types::Field;
|
||||
use plonky2_maybe_rayon::*;
|
||||
|
||||
use crate::field::extension::Extendable;
|
||||
use crate::field::fft::FftRootTable;
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
use alloc::vec::Vec;
|
||||
|
||||
use maybe_rayon::*;
|
||||
use plonky2_maybe_rayon::*;
|
||||
|
||||
use crate::field::extension::{flatten, unflatten, Extendable};
|
||||
use crate::field::polynomial::{PolynomialCoeffs, PolynomialValues};
|
||||
|
||||
@ -1,3 +1,5 @@
|
||||
use alloc::vec;
|
||||
|
||||
use plonky2_field::extension::Extendable;
|
||||
|
||||
use crate::gates::coset_interpolation::CosetInterpolationGate;
|
||||
|
||||
@ -57,7 +57,7 @@ impl<F: RichField + Extendable<D>, const D: usize> CircuitBuilder<F, D> {
|
||||
access_index: Target,
|
||||
v: Vec<HashOutTarget>,
|
||||
) -> HashOutTarget {
|
||||
let selected = std::array::from_fn(|i| {
|
||||
let selected = core::array::from_fn(|i| {
|
||||
self.random_access(
|
||||
access_index,
|
||||
v.iter().map(|hash| hash.elements[i]).collect(),
|
||||
|
||||
@ -2,7 +2,7 @@ use alloc::vec::Vec;
|
||||
use core::mem::MaybeUninit;
|
||||
use core::slice;
|
||||
|
||||
use maybe_rayon::*;
|
||||
use plonky2_maybe_rayon::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::hash::hash_types::RichField;
|
||||
@ -84,7 +84,7 @@ fn fill_subtree<F: RichField, H: Hasher<F>>(
|
||||
// Split `leaves` between both children.
|
||||
let (left_leaves, right_leaves) = leaves.split_at(leaves.len() / 2);
|
||||
|
||||
let (left_digest, right_digest) = maybe_rayon::join(
|
||||
let (left_digest, right_digest) = plonky2_maybe_rayon::join(
|
||||
|| fill_subtree::<F, H>(left_digests_buf, left_leaves),
|
||||
|| fill_subtree::<F, H>(right_digests_buf, right_leaves),
|
||||
);
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
use alloc::vec::Vec;
|
||||
|
||||
use hashbrown::HashMap;
|
||||
use maybe_rayon::*;
|
||||
use plonky2_maybe_rayon::*;
|
||||
|
||||
use crate::field::polynomial::PolynomialValues;
|
||||
use crate::field::types::Field;
|
||||
|
||||
@ -2,7 +2,7 @@ use alloc::vec;
|
||||
use alloc::vec::Vec;
|
||||
|
||||
use anyhow::ensure;
|
||||
use maybe_rayon::*;
|
||||
use plonky2_maybe_rayon::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::field::extension::Extendable;
|
||||
|
||||
@ -3,7 +3,7 @@ use alloc::{format, vec};
|
||||
use core::mem::swap;
|
||||
|
||||
use anyhow::{ensure, Result};
|
||||
use maybe_rayon::*;
|
||||
use plonky2_maybe_rayon::*;
|
||||
|
||||
use crate::field::extension::Extendable;
|
||||
use crate::field::polynomial::{PolynomialCoeffs, PolynomialValues};
|
||||
|
||||
@ -1,4 +1,5 @@
|
||||
use alloc::vec;
|
||||
use alloc::vec::Vec;
|
||||
|
||||
use hashbrown::HashMap;
|
||||
use plonky2_field::extension::Extendable;
|
||||
|
||||
@ -804,12 +804,14 @@ impl Buffer {
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl Remaining for Buffer {
|
||||
fn remaining(&self) -> usize {
|
||||
self.bytes.len() - self.pos
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
impl Read for Buffer {
|
||||
#[inline]
|
||||
fn read_exact(&mut self, bytes: &mut [u8]) -> IoResult<()> {
|
||||
|
||||
@ -2,11 +2,17 @@
|
||||
name = "starky"
|
||||
description = "Implementation of STARKs"
|
||||
version = "0.1.0"
|
||||
license = "MIT OR Apache-2.0"
|
||||
authors = ["Daniel Lubarov <daniel@lubarov.com>", "William Borgeaud <williamborgeaud@gmail.com>"]
|
||||
readme = "README.md"
|
||||
repository = "https://github.com/mir-protocol/plonky2"
|
||||
keywords = ["cryptography", "STARK", "FRI"]
|
||||
categories = ["cryptography"]
|
||||
edition = "2021"
|
||||
|
||||
[features]
|
||||
default = ["parallel", "std", "timing"]
|
||||
parallel = ["plonky2/parallel", "maybe_rayon/parallel"]
|
||||
parallel = ["plonky2/parallel", "plonky2_maybe_rayon/parallel"]
|
||||
std = ["anyhow/std", "plonky2/std"]
|
||||
timing = ["plonky2/timing"]
|
||||
|
||||
@ -14,8 +20,8 @@ timing = ["plonky2/timing"]
|
||||
anyhow = { version = "1.0.40", default-features = false }
|
||||
itertools = { version = "0.10.0", default-features = false }
|
||||
log = { version = "0.4.14", default-features = false }
|
||||
maybe_rayon = { path = "../maybe_rayon", default-features = false }
|
||||
plonky2 = { path = "../plonky2", default-features = false }
|
||||
plonky2_maybe_rayon = { version = "0.1.0", default-features = false }
|
||||
plonky2 = { version = "0.1.1", default-features = false }
|
||||
|
||||
[dev-dependencies]
|
||||
env_logger = { version = "0.9.0", default-features = false }
|
||||
|
||||
@ -4,7 +4,6 @@ use alloc::vec;
|
||||
use alloc::vec::Vec;
|
||||
|
||||
use itertools::Itertools;
|
||||
use maybe_rayon::*;
|
||||
use plonky2::field::batch_util::batch_multiply_inplace;
|
||||
use plonky2::field::extension::{Extendable, FieldExtension};
|
||||
use plonky2::field::packed::PackedField;
|
||||
@ -17,6 +16,7 @@ use plonky2::iop::target::Target;
|
||||
use plonky2::plonk::circuit_builder::CircuitBuilder;
|
||||
use plonky2::plonk::config::{AlgebraicHasher, GenericConfig, Hasher};
|
||||
use plonky2::util::reducing::{ReducingFactor, ReducingFactorTarget};
|
||||
use plonky2_maybe_rayon::*;
|
||||
|
||||
use crate::config::StarkConfig;
|
||||
use crate::constraint_consumer::{ConstraintConsumer, RecursiveConstraintConsumer};
|
||||
|
||||
@ -2,7 +2,6 @@ use alloc::vec;
|
||||
use alloc::vec::Vec;
|
||||
|
||||
use itertools::Itertools;
|
||||
use maybe_rayon::*;
|
||||
use plonky2::field::extension::{Extendable, FieldExtension};
|
||||
use plonky2::fri::oracle::PolynomialBatch;
|
||||
use plonky2::fri::proof::{
|
||||
@ -16,6 +15,7 @@ use plonky2::hash::merkle_tree::MerkleCap;
|
||||
use plonky2::iop::ext_target::ExtensionTarget;
|
||||
use plonky2::iop::target::Target;
|
||||
use plonky2::plonk::config::GenericConfig;
|
||||
use plonky2_maybe_rayon::*;
|
||||
|
||||
use crate::config::StarkConfig;
|
||||
use crate::permutation::PermutationChallengeSet;
|
||||
|
||||
@ -3,7 +3,6 @@ use core::iter::once;
|
||||
|
||||
use anyhow::{ensure, Result};
|
||||
use itertools::Itertools;
|
||||
use maybe_rayon::*;
|
||||
use plonky2::field::extension::Extendable;
|
||||
use plonky2::field::packable::Packable;
|
||||
use plonky2::field::packed::PackedField;
|
||||
@ -17,6 +16,7 @@ use plonky2::plonk::config::{GenericConfig, Hasher};
|
||||
use plonky2::timed;
|
||||
use plonky2::util::timing::TimingTree;
|
||||
use plonky2::util::{log2_ceil, log2_strict, transpose};
|
||||
use plonky2_maybe_rayon::*;
|
||||
|
||||
use crate::config::StarkConfig;
|
||||
use crate::constraint_consumer::ConstraintConsumer;
|
||||
|
||||
@ -8,11 +8,11 @@ edition = "2021"
|
||||
anyhow = "1.0.40"
|
||||
itertools = "0.10.0"
|
||||
log = "0.4.14"
|
||||
plonky2 = { path = "../plonky2" }
|
||||
plonky2_util = { path = "../util" }
|
||||
plonky2 = { version = "0.1.1" }
|
||||
plonky2_util = { version = "0.1.0" }
|
||||
rand = "0.8.4"
|
||||
rand_chacha = "0.3.1"
|
||||
starky = { path = "../starky" }
|
||||
starky = { version = "0.1.0" }
|
||||
|
||||
[dev-dependencies]
|
||||
criterion = "0.4.0"
|
||||
|
||||
@ -1,14 +1,17 @@
|
||||
[package]
|
||||
name = "plonky2_u32"
|
||||
description = "u32 gadget for Plonky2"
|
||||
version = "0.1.0"
|
||||
license = "MIT OR Apache-2.0"
|
||||
repository = "https://github.com/mir-protocol/plonky2"
|
||||
edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
anyhow = { version = "1.0.40", default-features = false }
|
||||
itertools = { version = "0.10.0", default-features = false }
|
||||
num = { version = "0.4", default-features = false }
|
||||
plonky2 = { path = "../plonky2", default-features = false }
|
||||
plonky2 = { version = "0.1.1", default-features = false }
|
||||
|
||||
[dev-dependencies]
|
||||
plonky2 = { path = "../plonky2", default-features = false, features = ["gate_testing"] }
|
||||
plonky2 = { version = "0.1.1", default-features = false, features = ["gate_testing"] }
|
||||
rand = { version = "0.8.4", default-features = false, features = ["getrandom"] }
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
name = "plonky2_util"
|
||||
description = "Utilities used by Plonky2"
|
||||
version = "0.1.0"
|
||||
license = "MIT OR Apache-2.0"
|
||||
edition = "2021"
|
||||
|
||||
[dev-dependencies]
|
||||
|
||||
@ -9,7 +9,7 @@ anyhow = "1.0.40"
|
||||
array_tool = "1.0.3"
|
||||
bimap = "0.6.1"
|
||||
itertools = "0.10.0"
|
||||
"plonky2" = { path = "../plonky2" }
|
||||
"plonky2_field" = { path = "../field" }
|
||||
"plonky2_util" = { path = "../util" }
|
||||
"plonky2" = { version = "0.1.0" }
|
||||
"plonky2_field" = { version = "0.1.0" }
|
||||
"plonky2_util" = { version = "0.1.0" }
|
||||
rand = "0.8.4"
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user