mirror of
https://github.com/logos-storage/proof-aggregation.git
synced 2026-01-02 13:53:13 +00:00
clean up code - remove unnecessary imports
This commit is contained in:
parent
9ce15d8e00
commit
f49d5c5218
@ -3,7 +3,6 @@
|
||||
//! https://github.com/0xPolygonZero/plonky2/blob/main/plonky2/src/gates/poseidon.rs
|
||||
//!
|
||||
use core::marker::PhantomData;
|
||||
use std::ops::Mul;
|
||||
use plonky2_field::extension::Extendable;
|
||||
use plonky2_field::types::Field;
|
||||
use plonky2::gates::gate::Gate;
|
||||
@ -407,7 +406,7 @@ impl<F: RichField + Extendable<D> + Poseidon2, const D: usize> SimpleGenerator<F
|
||||
|
||||
for i in 0..4 {
|
||||
let delta_i = swap_value * (state[i + 4] - state[i]);
|
||||
out_buffer.set_wire(local_wire(Poseidon2Gate::<F, D>::wire_delta(i)), delta_i);
|
||||
out_buffer.set_wire(local_wire(Poseidon2Gate::<F, D>::wire_delta(i)), delta_i)?;
|
||||
}
|
||||
|
||||
if swap_value == F::ONE {
|
||||
@ -429,7 +428,7 @@ impl<F: RichField + Extendable<D> + Poseidon2, const D: usize> SimpleGenerator<F
|
||||
out_buffer.set_wire(
|
||||
local_wire(Poseidon2Gate::<F, D>::wire_first_full_round(r, i)),
|
||||
state[i],
|
||||
);
|
||||
)?;
|
||||
}
|
||||
}
|
||||
<F as Poseidon2>::sbox_layer_field(&mut state);
|
||||
@ -442,7 +441,7 @@ impl<F: RichField + Extendable<D> + Poseidon2, const D: usize> SimpleGenerator<F
|
||||
out_buffer.set_wire(
|
||||
local_wire(Poseidon2Gate::<F, D>::wire_partial_round(r)),
|
||||
state[0],
|
||||
);
|
||||
)?;
|
||||
state[0] = <F as Poseidon2>::sbox_p(state[0]);
|
||||
<F as Poseidon2>::matmul_internal_field(&mut state, &<F as Poseidon2>::MAT_DIAG12_M_1);
|
||||
}
|
||||
@ -458,7 +457,7 @@ impl<F: RichField + Extendable<D> + Poseidon2, const D: usize> SimpleGenerator<F
|
||||
i,
|
||||
)),
|
||||
state[i],
|
||||
);
|
||||
)?;
|
||||
}
|
||||
|
||||
<F as Poseidon2>::sbox_layer_field(&mut state);
|
||||
@ -466,7 +465,7 @@ impl<F: RichField + Extendable<D> + Poseidon2, const D: usize> SimpleGenerator<F
|
||||
}
|
||||
|
||||
for i in 0..SPONGE_WIDTH {
|
||||
out_buffer.set_wire(local_wire(Poseidon2Gate::<F, D>::wire_output(i)), state[i]);
|
||||
out_buffer.set_wire(local_wire(Poseidon2Gate::<F, D>::wire_output(i)), state[i])?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@ -1,4 +1,6 @@
|
||||
pub mod gate;
|
||||
pub mod poseidon2_hash;
|
||||
pub mod config;
|
||||
pub mod serialization;
|
||||
pub mod serialization;
|
||||
|
||||
pub use poseidon2_hash::poseidon2::Poseidon2;
|
||||
@ -1,6 +1,2 @@
|
||||
pub mod poseidon2;
|
||||
pub mod poseidon2_goldilocks;
|
||||
|
||||
use plonky2::field::types::{Field, PrimeField64, Sample};
|
||||
use plonky2::hash::poseidon::Poseidon;
|
||||
use crate::poseidon2_hash::poseidon2::Poseidon2;
|
||||
pub mod poseidon2_goldilocks;
|
||||
@ -325,7 +325,7 @@ pub trait Poseidon2: PrimeField64 {
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
result.try_into().unwrap_or_else(|v: Vec<ExtensionTarget<D>>| {
|
||||
panic!("Expected a Vec of length {}", SPONGE_WIDTH)
|
||||
panic!("Expected a Vec of length {}, but got {}", SPONGE_WIDTH, v.len())
|
||||
})
|
||||
}
|
||||
|
||||
@ -525,14 +525,12 @@ pub(crate) mod test_helpers {
|
||||
|
||||
#[cfg(test)]
|
||||
pub(crate) mod test_consistency {
|
||||
use plonky2::hash::hashing::PlonkyPermutation;
|
||||
use plonky2::plonk::circuit_builder::CircuitBuilder;
|
||||
use crate::poseidon2_hash::poseidon2::{Poseidon2, Poseidon2Permutation, SPONGE_WIDTH};
|
||||
use crate::poseidon2_hash::poseidon2::{Poseidon2, SPONGE_WIDTH};
|
||||
use plonky2_field::goldilocks_field::GoldilocksField as F;
|
||||
use plonky2_field::types::Field;
|
||||
|
||||
#[test]
|
||||
pub(crate) fn p2new_check_con()
|
||||
pub(crate) fn check_poseidon2_consistency()
|
||||
{
|
||||
let mut input = [F::ZERO; SPONGE_WIDTH];
|
||||
for i in 0..SPONGE_WIDTH {
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
use std::time::Instant;
|
||||
use plonky2_field::extension::Extendable;
|
||||
use plonky2::gates::arithmetic_base::ArithmeticGate;
|
||||
use plonky2::gates::arithmetic_extension::ArithmeticExtensionGate;
|
||||
@ -6,7 +5,6 @@ use plonky2::gates::base_sum::BaseSumGate;
|
||||
use plonky2::gates::constant::ConstantGate;
|
||||
use plonky2::gates::coset_interpolation::CosetInterpolationGate;
|
||||
use plonky2::gates::exponentiation::ExponentiationGate;
|
||||
use plonky2::gates::gate::GateRef;
|
||||
use plonky2::gates::lookup::LookupGate;
|
||||
use plonky2::gates::lookup_table::LookupTableGate;
|
||||
use plonky2::gates::multiplication_extension::MulExtensionGate;
|
||||
@ -20,13 +18,8 @@ use plonky2::gates::reducing::ReducingGate;
|
||||
use plonky2::gates::reducing_extension::ReducingExtensionGate;
|
||||
use plonky2::hash::hash_types::RichField;
|
||||
use plonky2::{read_gate_impl, get_gate_tag_impl, impl_gate_serializer};
|
||||
use plonky2::plonk::circuit_data::{CircuitConfig, CommonCircuitData};
|
||||
use plonky2::util::serialization::{Buffer, GateSerializer, IoResult};
|
||||
use plonky2::util::serialization::GateSerializer;
|
||||
use crate::poseidon2_hash::poseidon2::Poseidon2;
|
||||
use std::vec::Vec;
|
||||
use plonky2::iop::witness::PartialWitness;
|
||||
use plonky2::plonk::circuit_builder::CircuitBuilder;
|
||||
use plonky2_field::goldilocks_field::GoldilocksField;
|
||||
|
||||
/// A gate serializer that can be used to serialize all default gates supported
|
||||
/// by the `plonky2` library with the added Poseidon2 Gate
|
||||
|
||||
@ -1,38 +1,29 @@
|
||||
use std::marker::PhantomData;
|
||||
use plonky2_field::extension::Extendable;
|
||||
use plonky2::gates::arithmetic_base::{ArithmeticBaseGenerator, ArithmeticGate};
|
||||
use plonky2::gates::arithmetic_extension::{ArithmeticExtensionGate, ArithmeticExtensionGenerator};
|
||||
use plonky2::gates::base_sum::{BaseSplitGenerator, BaseSumGate};
|
||||
use plonky2::gates::constant::ConstantGate;
|
||||
use plonky2::gates::coset_interpolation::{CosetInterpolationGate, InterpolationGenerator};
|
||||
use plonky2::gates::exponentiation::{ExponentiationGate, ExponentiationGenerator};
|
||||
use plonky2::gates::gate::{AnyGate, Gate, GateRef};
|
||||
use plonky2::gates::lookup::{LookupGate, LookupGenerator};
|
||||
use plonky2::gates::lookup_table::{LookupTableGate, LookupTableGenerator};
|
||||
use plonky2::gates::multiplication_extension::{MulExtensionGate, MulExtensionGenerator};
|
||||
use plonky2::gates::noop::NoopGate;
|
||||
use plonky2::gates::poseidon::{PoseidonGate, PoseidonGenerator};
|
||||
use crate::gate::poseidon2::{Poseidon2Gate, Poseidon2Generator};
|
||||
use plonky2::gates::poseidon_mds::{PoseidonMdsGate, PoseidonMdsGenerator};
|
||||
use plonky2::gates::public_input::PublicInputGate;
|
||||
use plonky2::gates::random_access::{RandomAccessGate, RandomAccessGenerator};
|
||||
use plonky2::gates::reducing::{ReducingGate, ReducingGenerator};
|
||||
use plonky2::gates::arithmetic_base::ArithmeticBaseGenerator;
|
||||
use plonky2::gates::arithmetic_extension::ArithmeticExtensionGenerator;
|
||||
use plonky2::gates::base_sum::BaseSplitGenerator;
|
||||
use plonky2::gates::coset_interpolation::InterpolationGenerator;
|
||||
use plonky2::gates::exponentiation::ExponentiationGenerator;
|
||||
use plonky2::gates::lookup::LookupGenerator;
|
||||
use plonky2::gates::lookup_table::LookupTableGenerator;
|
||||
use plonky2::gates::multiplication_extension::MulExtensionGenerator;
|
||||
use plonky2::gates::poseidon::PoseidonGenerator;
|
||||
use crate::gate::poseidon2::Poseidon2Generator;
|
||||
use plonky2::gates::poseidon_mds::PoseidonMdsGenerator;
|
||||
use plonky2::gates::random_access::RandomAccessGenerator;
|
||||
use plonky2::gates::reducing::ReducingGenerator;
|
||||
use plonky2::gates::reducing_extension::ReducingGenerator as ReducingExtensionGenerator;
|
||||
use plonky2::gates::reducing_extension::ReducingExtensionGate;
|
||||
use plonky2::hash::hash_types::RichField;
|
||||
use plonky2::{impl_gate_serializer, impl_generator_serializer, get_generator_tag_impl, read_generator_impl};
|
||||
use plonky2::read_gate_impl;
|
||||
use plonky2::get_gate_tag_impl;
|
||||
use plonky2::plonk::circuit_data::CommonCircuitData;
|
||||
use plonky2::util::serialization::{Buffer, GateSerializer, IoError, IoResult, Read, WitnessGeneratorSerializer, Write};
|
||||
use plonky2::{impl_generator_serializer, get_generator_tag_impl, read_generator_impl};
|
||||
use plonky2::util::serialization::WitnessGeneratorSerializer;
|
||||
use crate::poseidon2_hash::poseidon2::Poseidon2;
|
||||
use std::vec::Vec;
|
||||
use plonky2::gadgets::arithmetic::EqualityGenerator;
|
||||
use plonky2::gadgets::arithmetic_extension::QuotientGeneratorExtension;
|
||||
use plonky2::gadgets::range_check::LowHighGenerator;
|
||||
use plonky2::gadgets::split_base::BaseSumGenerator;
|
||||
use plonky2::gadgets::split_join::{SplitGenerator, WireSplitGenerator};
|
||||
use plonky2::iop::generator::{ConstantGenerator, CopyGenerator, NonzeroTestGenerator, RandomValueGenerator, SimpleGenerator, WitnessGeneratorRef};
|
||||
use plonky2::iop::generator::{ConstantGenerator, CopyGenerator, NonzeroTestGenerator, RandomValueGenerator};
|
||||
use plonky2::plonk::config::{AlgebraicHasher, GenericConfig};
|
||||
use plonky2::recursion::dummy_circuit::DummyProofGenerator;
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user