Use PrimeField as generic bound across the codebase (#67)

Co-authored-by: Cesar Descalzo <cesar.descalzo2@gmail.com>
Co-authored-by: Antonio Mejías Gil <anmegi.95@gmail.com>
This commit is contained in:
Marti
2024-07-18 17:17:08 +02:00
committed by GitHub
parent fa6262ab58
commit a573c15b32
10 changed files with 131 additions and 137 deletions

View File

@@ -2,7 +2,7 @@ use ark_circom::{CircomBuilder, CircomConfig};
use ark_std::rand::thread_rng;
use color_eyre::Result;
use ark_bn254::Bn254;
use ark_bn254::{Bn254, Fr};
use ark_crypto_primitives::snark::SNARK;
use ark_groth16::Groth16;
@@ -10,7 +10,7 @@ type GrothBn = Groth16<Bn254>;
#[tokio::test]
async fn groth16_proof() -> Result<()> {
let cfg = CircomConfig::<Bn254>::new(
let cfg = CircomConfig::<Fr>::new(
"./test-vectors/mycircuit.wasm",
"./test-vectors/mycircuit.r1cs",
)?;
@@ -41,7 +41,7 @@ async fn groth16_proof() -> Result<()> {
#[tokio::test]
async fn groth16_proof_wrong_input() {
let cfg = CircomConfig::<Bn254>::new(
let cfg = CircomConfig::<Fr>::new(
"./test-vectors/mycircuit.wasm",
"./test-vectors/mycircuit.r1cs",
)
@@ -63,7 +63,7 @@ async fn groth16_proof_wrong_input() {
#[tokio::test]
#[cfg(feature = "circom-2")]
async fn groth16_proof_circom2() -> Result<()> {
let cfg = CircomConfig::<Bn254>::new(
let cfg = CircomConfig::<Fr>::new(
"./test-vectors/circom2_multiplier2.wasm",
"./test-vectors/circom2_multiplier2.r1cs",
)?;
@@ -95,7 +95,7 @@ async fn groth16_proof_circom2() -> Result<()> {
#[tokio::test]
#[cfg(feature = "circom-2")]
async fn witness_generation_circom2() -> Result<()> {
let cfg = CircomConfig::<Bn254>::new(
let cfg = CircomConfig::<Fr>::new(
"./test-vectors/circom2_multiplier2.wasm",
"./test-vectors/circom2_multiplier2.r1cs",
)?;

View File

@@ -2,7 +2,7 @@ use ark_circom::{ethereum, CircomBuilder, CircomConfig};
use ark_std::rand::thread_rng;
use color_eyre::Result;
use ark_bn254::Bn254;
use ark_bn254::{Bn254, Fr};
use ark_crypto_primitives::snark::SNARK;
use ark_groth16::Groth16;
@@ -16,7 +16,7 @@ use std::{convert::TryFrom, sync::Arc};
#[tokio::test]
async fn solidity_verifier() -> Result<()> {
let cfg = CircomConfig::<Bn254>::new(
let cfg = CircomConfig::<Fr>::new(
"./test-vectors/mycircuit.wasm",
"./test-vectors/mycircuit.r1cs",
)?;
@@ -61,7 +61,6 @@ async fn solidity_verifier() -> Result<()> {
// the ones expected by the abigen'd types. Could we maybe provide a convenience
// macro for these, given that there's room for implementation error?
abigen!(Groth16Verifier, "./tests/verifier_artifact.json");
use groth_16_verifier::{G1Point, G2Point, Proof, VerifyingKey};
impl From<ethereum::G1> for G1Point {
fn from(src: ethereum::G1) -> Self {
Self { x: src.x, y: src.y }