mirror of
https://github.com/codex-storage/proof-aggregation.git
synced 2025-02-13 15:16:58 +00:00
change entropy to hashout
This commit is contained in:
parent
f139d70a5f
commit
3a1d87d450
@ -67,7 +67,7 @@ pub struct SampleCircuitInput<
|
||||
F: RichField + Extendable<D> + Poseidon2,
|
||||
const D: usize,
|
||||
>{
|
||||
pub entropy: Vec<F>,
|
||||
pub entropy: HashOut<F>,
|
||||
pub dataset_root: HashOut<F>,
|
||||
pub slot_index: F,
|
||||
|
||||
@ -342,7 +342,7 @@ impl<
|
||||
pw.set_hash_target(targets.slot_root, witnesses.slot_root);
|
||||
|
||||
// assign entropy
|
||||
assign_hash_out_targets(pw, &targets.entropy.elements, &witnesses.entropy);
|
||||
assign_hash_out_targets(pw, &targets.entropy.elements, &witnesses.entropy.elements);
|
||||
|
||||
// do the sample N times
|
||||
for i in 0..n_samples {
|
||||
|
@ -1,12 +1,7 @@
|
||||
use plonky2::hash::hash_types::{HashOut, HashOutTarget, NUM_HASH_OUT_ELTS, RichField};
|
||||
use plonky2::hash::hash_types::{HashOutTarget, NUM_HASH_OUT_ELTS, RichField};
|
||||
use plonky2::iop::witness::{PartialWitness, WitnessWrite};
|
||||
use plonky2::plonk::circuit_data::{CircuitData, VerifierCircuitData};
|
||||
use plonky2::plonk::config::{AlgebraicHasher, GenericConfig, Hasher};
|
||||
use plonky2::plonk::proof::{Proof, ProofWithPublicInputs};
|
||||
use plonky2_field::extension::Extendable;
|
||||
use plonky2_poseidon2::poseidon2_hash::poseidon2::Poseidon2;
|
||||
use crate::circuits::params::HF;
|
||||
use anyhow::Result;
|
||||
use plonky2::iop::target::{BoolTarget, Target};
|
||||
use plonky2::plonk::circuit_builder::CircuitBuilder;
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -37,7 +37,7 @@ pub fn gen_testing_circuit_input<
|
||||
}
|
||||
|
||||
SampleCircuitInput::<F, D> {
|
||||
entropy: proof.entropy.elements.clone().to_vec(),
|
||||
entropy: proof.entropy,
|
||||
dataset_root: dataset_t.tree.root().unwrap(),
|
||||
slot_index: proof.slot_index.clone(),
|
||||
slot_root,
|
||||
@ -77,7 +77,7 @@ pub fn verify_circuit_input<
|
||||
let mask_bits = usize_to_bits_le(params.n_cells -1, params.max_depth);
|
||||
for i in 0..params.n_samples {
|
||||
let cell_index_bits = calculate_cell_index_bits(
|
||||
&circ_input.entropy,
|
||||
&circ_input.entropy.elements.to_vec(),
|
||||
slot_root,
|
||||
i + 1,
|
||||
params.max_depth,
|
||||
|
@ -76,6 +76,7 @@ impl<
|
||||
.collect(),
|
||||
entropy: circ_input
|
||||
.entropy
|
||||
.elements
|
||||
.iter()
|
||||
.map(|e| e.to_canonical_u64().to_string())
|
||||
.collect(),
|
||||
@ -125,7 +126,7 @@ impl<> SerializableCircuitInput {
|
||||
const D: usize
|
||||
>(&self) -> Result<SampleCircuitInput<F, D>> {
|
||||
// Convert entropy
|
||||
let entropy = self
|
||||
let entropy_elements = self
|
||||
.entropy
|
||||
.iter()
|
||||
.map(|s| -> Result<F, Error> {
|
||||
@ -133,6 +134,11 @@ impl<> SerializableCircuitInput {
|
||||
Ok(F::from_canonical_u64(n))
|
||||
})
|
||||
.collect::<Result<Vec<F>, Error>>()?;
|
||||
let entropy = HashOut {
|
||||
elements: entropy_elements
|
||||
.try_into()
|
||||
.map_err(|_| anyhow!("Invalid entropy length"))?,
|
||||
};
|
||||
|
||||
// Convert dataset_root
|
||||
let dataset_root_elements = self
|
||||
|
Loading…
x
Reference in New Issue
Block a user