Skip to content

Commit

Permalink
updated to fork to last version
Browse files Browse the repository at this point in the history
  • Loading branch information
MatteoMer committed Jun 20, 2024
1 parent 81c21bd commit 0ddb373
Show file tree
Hide file tree
Showing 24 changed files with 20 additions and 58 deletions.
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "jolt-verifier/lib/forge-std"]
path = jolt-verifier/lib/forge-std
[submodule "jolt-evm-verifier/lib/forge-std"]
path = jolt-evm-verifier/lib/forge-std
url = https://github.com/foundry-rs/forge-std
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions jolt-evm-verifier/lib/forge-std
Submodule forge-std added at 19891e
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use jolt_core::{
field::JoltField,
poly::commitment::zeromorph::Zeromorph,
subprotocols::grand_product::{BatchedDenseGrandProduct, BatchedGrandProduct},
utils::transcript::ProofTranscript,
};
Expand All @@ -9,13 +10,16 @@ use ark_ff::{BigInteger, PrimeField};

use alloy_primitives::{hex, U256};
use alloy_sol_types::{sol, SolType};
use ark_bn254::Fr;
use ark_bn254::{Bn254, Fr};
use ark_std::test_rng;

fn get_proof_data<F: JoltField + PrimeField>(batched_circuit: &mut BatchedDenseGrandProduct<F>) {
fn get_proof_data(batched_circuit: &mut BatchedDenseGrandProduct<Fr>) {
let mut transcript: ProofTranscript = ProofTranscript::new(b"test_transcript");

let (proof, _r_prover) = batched_circuit.prove_grand_product(&mut transcript);
let (proof, _r_prover) = <BatchedDenseGrandProduct<Fr> as BatchedGrandProduct<
Fr,
Zeromorph<Bn254>,
>>::prove_grand_product(batched_circuit, &mut transcript, None);

//encoding the proof into abi

Expand Down Expand Up @@ -67,9 +71,12 @@ fn get_proof_data<F: JoltField + PrimeField>(batched_circuit: &mut BatchedDenseG
);
}

fn get_claims_data<F: JoltField + PrimeField>(batched_circuit: &BatchedDenseGrandProduct<F>) {
let claims = batched_circuit
.claims()
fn get_claims_data(batched_circuit: &BatchedDenseGrandProduct<Fr>) {
let claims =
<BatchedDenseGrandProduct<Fr> as BatchedGrandProduct<Fr, Zeromorph<Bn254>>>::claims(
batched_circuit,
);
let claims = claims
.iter()
.map(|c| U256::from_le_slice(c.into_bigint().to_bytes_le().as_slice()))
.collect::<Vec<_>>();
Expand All @@ -78,19 +85,6 @@ fn get_claims_data<F: JoltField + PrimeField>(batched_circuit: &BatchedDenseGran
print!("{}", hex::encode(encoded_claims));
}

fn verify_proof<F: JoltField + PrimeField>(batched_circuit: &mut BatchedDenseGrandProduct<F>) {
let claims = batched_circuit.claims();

let mut transcript: ProofTranscript = ProofTranscript::new(b"test_transcript");

let (proof, _r_prover) = batched_circuit.prove_grand_product(&mut transcript);

let mut transcript: ProofTranscript = ProofTranscript::new(b"test_transcript");

let (_, _r_verifier) =
BatchedDenseGrandProduct::verify_grand_product(&proof, &claims, &mut transcript);
}

fn main() {
let args: Vec<_> = env::args().collect();

Expand All @@ -106,12 +100,14 @@ fn main() {
.take(BATCH_SIZE)
.collect();

let mut batched_circuit = BatchedDenseGrandProduct::construct(leaves);
let mut batched_circuit = <BatchedDenseGrandProduct<Fr> as BatchedGrandProduct<
Fr,
Zeromorph<Bn254>,
>>::construct(leaves);

match args[1].as_str() {
"proofs" => get_proof_data(&mut batched_circuit),
"claims" => get_claims_data(&batched_circuit),
"verify" => verify_proof(&mut batched_circuit),
_ => println!("invalid arguement"),
};
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
34 changes: 0 additions & 34 deletions jolt-verifier/.github/workflows/test.yml

This file was deleted.

1 change: 0 additions & 1 deletion jolt-verifier/lib/forge-std
Submodule forge-std deleted from 978ac6

0 comments on commit 0ddb373

Please sign in to comment.