mirror of
https://github.com/logos-storage/plonky2.git
synced 2026-01-08 08:43:06 +00:00
serialize ProofChallenges
This commit is contained in:
parent
e642b82410
commit
b640bf6381
@ -42,7 +42,7 @@ fn main() -> Result<()> {
|
|||||||
pw.set_target(initial_a, F::ZERO);
|
pw.set_target(initial_a, F::ZERO);
|
||||||
pw.set_target(initial_b, F::ONE);
|
pw.set_target(initial_b, F::ONE);
|
||||||
|
|
||||||
let data = builder.build_without_randomizing::<C>();
|
let data = builder.build::<C>();
|
||||||
|
|
||||||
let common_circuit_data_serialized = serde_json::to_string(&data.common).unwrap();
|
let common_circuit_data_serialized = serde_json::to_string(&data.common).unwrap();
|
||||||
fs::write("common_circuit_data.json", common_circuit_data_serialized)
|
fs::write("common_circuit_data.json", common_circuit_data_serialized)
|
||||||
@ -60,6 +60,16 @@ fn main() -> Result<()> {
|
|||||||
let proof_serialized = serde_json::to_string(&proof).unwrap();
|
let proof_serialized = serde_json::to_string(&proof).unwrap();
|
||||||
fs::write("proof_with_public_inputs.json", proof_serialized).expect("Unable to write file");
|
fs::write("proof_with_public_inputs.json", proof_serialized).expect("Unable to write file");
|
||||||
|
|
||||||
|
let proof_challenges = proof
|
||||||
|
.get_challenges(
|
||||||
|
proof.get_public_inputs_hash(),
|
||||||
|
&data.verifier_only.circuit_digest,
|
||||||
|
&data.common,
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
let proof_challenges_serialized = serde_json::to_string(&proof_challenges).unwrap();
|
||||||
|
fs::write("proof_challenges.json", proof_challenges_serialized).expect("Unable to write file");
|
||||||
|
|
||||||
println!(
|
println!(
|
||||||
"100th Fibonacci number mod |F| (starting with {}, {}) is: {}",
|
"100th Fibonacci number mod |F| (starting with {}, {}) is: {}",
|
||||||
proof.public_inputs[0], proof.public_inputs[1], proof.public_inputs[2]
|
proof.public_inputs[0], proof.public_inputs[1], proof.public_inputs[2]
|
||||||
|
|||||||
@ -94,7 +94,7 @@ impl<F: RichField + Extendable<D>, C: GenericConfig<D, F = F>, const D: usize>
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Computes all Fiat-Shamir challenges used in the Plonk proof.
|
/// Computes all Fiat-Shamir challenges used in the Plonk proof.
|
||||||
pub(crate) fn get_challenges(
|
pub fn get_challenges(
|
||||||
&self,
|
&self,
|
||||||
public_inputs_hash: <<C as GenericConfig<D>>::InnerHasher as Hasher<F, C::HCI>>::Hash,
|
public_inputs_hash: <<C as GenericConfig<D>>::InnerHasher as Hasher<F, C::HCI>>::Hash,
|
||||||
circuit_digest: &<<C as GenericConfig<D>>::Hasher as Hasher<C::F, C::HCO>>::Hash,
|
circuit_digest: &<<C as GenericConfig<D>>::Hasher as Hasher<C::F, C::HCO>>::Hash,
|
||||||
|
|||||||
@ -102,7 +102,7 @@ impl<F: RichField + Extendable<D>, C: GenericConfig<D, F = F>, const D: usize>
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn get_public_inputs_hash(
|
pub fn get_public_inputs_hash(
|
||||||
&self,
|
&self,
|
||||||
) -> <<C as GenericConfig<D>>::InnerHasher as Hasher<F, C::HCI>>::Hash
|
) -> <<C as GenericConfig<D>>::InnerHasher as Hasher<F, C::HCI>>::Hash
|
||||||
where
|
where
|
||||||
@ -276,7 +276,8 @@ impl<F: RichField + Extendable<D>, C: GenericConfig<D, F = F>, const D: usize>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) struct ProofChallenges<F: RichField + Extendable<D>, const D: usize> {
|
#[derive(Serialize)]
|
||||||
|
pub struct ProofChallenges<F: RichField + Extendable<D>, const D: usize> {
|
||||||
/// Random values used in Plonk's permutation argument.
|
/// Random values used in Plonk's permutation argument.
|
||||||
pub plonk_betas: Vec<F>,
|
pub plonk_betas: Vec<F>,
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user