Skip to content

Commit 9e35fbc

Browse files
committed
Ledger + VRF: use public fields instead of methods from proof-systems
1 parent 2425122 commit 9e35fbc

File tree

2 files changed

+21
-4
lines changed

2 files changed

+21
-4
lines changed

ledger/src/proofs/transaction.rs

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use ark_ec::{short_weierstrass::Projective, AffineRepr, CurveGroup, PrimeGroup};
55
use ark_ff::{fields::arithmetic::InvalidBigInt, AdditiveGroup, BigInteger256, Field, PrimeField};
66
use kimchi::{
77
circuits::{gate::CircuitGate, wires::COLUMNS},
8-
groupmap::GroupMap,
8+
groupmap::{BWParameters, GroupMap},
99
proof::RecursionChallenge,
1010
};
1111
use mina_curves::pasta::{Fp, Fq};
@@ -24,6 +24,7 @@ use mina_p2p_messages::v2::{
2424
};
2525
use mina_poseidon::constants::PlonkSpongeConstantsKimchi;
2626
use mina_signer::{CompressedPubKey, PubKey};
27+
use poly_commitment::commitment::CommitmentCurve;
2728

2829
use crate::{
2930
decompress_pk, gen_keypair,
@@ -3996,8 +3997,7 @@ pub(super) fn create_proof<C: ProofConstants, F: FieldWitness>(
39963997
let mut rng = get_rng();
39973998

39983999
let now = redux::Instant::now();
3999-
let group_map =
4000-
kimchi::groupmap::GroupMap::<<F as proofs::field::FieldWitness>::Scalar>::setup();
4000+
let group_map = <F::OtherCurve as CommitmentCurve>::Map::setup();
40014001
let proof = kimchi::proof::ProverProof::create_recursive::<F::FqSponge, EFrSponge<F>, _>(
40024002
&group_map,
40034003
computed_witness,
@@ -4011,7 +4011,23 @@ pub(super) fn create_proof<C: ProofConstants, F: FieldWitness>(
40114011
let prev_challenges_hash = debug::hash_prev_challenge::<F>(&prev_challenges);
40124012
let witness_primary_hash = debug::hash_slice(&w.primary);
40134013
let witness_aux_hash = debug::hash_slice(w.aux());
4014-
let group_map_hash = debug::hash_slice(&group_map.composition());
4014+
let group_map_hash = {
4015+
// Recreating the same value to access the field.
4016+
// We should find a way to bypass the type-checker to reuse
4017+
// the value group_map defined above.
4018+
// As it is only in the case of errors, the additional cost of
4019+
// creating a new value can be ignored.
4020+
let group_map_for_debug =
4021+
BWParameters::<<<F as FieldWitness>::Scalar as FieldWitness>::Parameters>::setup();
4022+
let d = vec![
4023+
group_map_for_debug.u,
4024+
group_map_for_debug.fu,
4025+
group_map_for_debug.sqrt_neg_three_u_squared_minus_u_over_2,
4026+
group_map_for_debug.sqrt_neg_three_u_squared,
4027+
group_map_for_debug.inv_three_u_squared,
4028+
];
4029+
debug::hash_slice(&d)
4030+
};
40154031

40164032
dbg!(
40174033
&prev_challenges_hash,

vrf/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use ark_ec::{AffineRepr, CurveGroup};
22
use ark_ff::PrimeField;
3+
use core::ops::Mul;
34
use ledger::AccountIndex;
45
use message::VrfMessage;
56
use mina_node_account::AccountPublicKey;

0 commit comments

Comments
 (0)