Skip to content

Commit

Permalink
Remove pairing and use halo2_proof::pairing instead (scroll-tech#491
Browse files Browse the repository at this point in the history
)

* use halo2_proof::pairing

* remove: unused FieldExt

Co-authored-by: Carlos Pérez <[email protected]>
  • Loading branch information
kilic and CPerezz authored May 6, 2022
1 parent 287a3f4 commit 818f48e
Show file tree
Hide file tree
Showing 47 changed files with 43 additions and 58 deletions.
9 changes: 1 addition & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion bus-mapping/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ ethers-providers = "0.6"
itertools = "0.10"
lazy_static = "1.4"
log = "0.4.14"
pairing = { git = 'https://github.com/appliedzkp/pairing', package = "pairing_bn256" }
serde = {version = "1.0.130", features = ["derive"] }
serde_json = "1.0.66"

Expand Down
1 change: 0 additions & 1 deletion bus-mapping/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ all of the Memory, Stack and Storage ops performed by the provided trace.

```rust
use bus_mapping::{ExecutionTrace, ExecutionStep, BlockConstants, Error, evm::EvmWord};
use pairing::arithmetic::FieldExt;

let input_trace = r#"
[
Expand Down
1 change: 0 additions & 1 deletion bus-mapping/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
//! use mock::test_ctx::{TestContext, helpers::*};
//! use eth_types::evm_types::Gas;
//! use bus_mapping::circuit_input_builder::{Block, CircuitInputBuilder};
//! use pairing::arithmetic::FieldExt;
//!
//! let input_trace = r#"
//! [
Expand Down
1 change: 0 additions & 1 deletion circuit-benchmarks/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ edition = "2021"
[dependencies]
ff = "0.11"
halo2_proofs = { git = "https://github.com/appliedzkp/halo2.git", tag = "v2022_05_03" }
pairing = { git = 'https://github.com/appliedzkp/pairing', package = "pairing_bn256" }
ark-std = { version = "0.3", features = ["print-trace"] }
zkevm-circuits = { path = "../zkevm-circuits" }
keccak256 = { path = "../keccak256" }
Expand Down
2 changes: 1 addition & 1 deletion circuit-benchmarks/src/evm_circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ mod evm_circ_benches {
use ark_std::{end_timer, start_timer};
use halo2_proofs::plonk::{create_proof, keygen_pk, keygen_vk, verify_proof, SingleVerifier};
use halo2_proofs::{
pairing::bn256::{Bn256, Fr, G1Affine},
poly::commitment::{Params, ParamsVerifier},
transcript::{Blake2bRead, Blake2bWrite, Challenge255},
};
use pairing::bn256::{Bn256, Fr, G1Affine};
use rand::SeedableRng;
use rand_xorshift::XorShiftRng;
use std::env::var;
Expand Down
2 changes: 1 addition & 1 deletion circuit-benchmarks/src/keccak_permutation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ mod tests {
use ark_std::{end_timer, start_timer};
use halo2_proofs::plonk::{create_proof, keygen_pk, keygen_vk, verify_proof, SingleVerifier};
use halo2_proofs::{
pairing::bn256::{Bn256, Fr, G1Affine},
poly::commitment::{Params, ParamsVerifier},
transcript::{Blake2bRead, Blake2bWrite, Challenge255},
};
Expand All @@ -86,7 +87,6 @@ mod tests {
common::{State, ROUND_CONSTANTS},
gate_helpers::biguint_to_f,
};
use pairing::bn256::{Bn256, Fr, G1Affine};
use rand::SeedableRng;
use rand_xorshift::XorShiftRng;
use std::env::var;
Expand Down
2 changes: 1 addition & 1 deletion circuit-benchmarks/src/state_circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ mod tests {
use ark_std::{end_timer, start_timer};
use halo2_proofs::plonk::{create_proof, keygen_pk, keygen_vk, verify_proof, SingleVerifier};
use halo2_proofs::{
pairing::bn256::{Bn256, Fr, G1Affine},
poly::commitment::{Params, ParamsVerifier},
transcript::{Blake2bRead, Blake2bWrite, Challenge255},
};
use pairing::bn256::{Bn256, Fr, G1Affine};
use rand::SeedableRng;
use rand_xorshift::XorShiftRng;
use zkevm_circuits::state_circuit::StateCircuit;
Expand Down
2 changes: 1 addition & 1 deletion eth-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ ethers-core = "0.6"
ethers-providers = "0.6"
hex = "0.4"
lazy_static = "1.4"
pairing = { git = 'https://github.com/appliedzkp/pairing', package = "pairing_bn256" }
halo2_proofs = { git = "https://github.com/appliedzkp/halo2.git", tag = "v2022_05_03" }
regex = "1.5.4"
serde = {version = "1.0.130", features = ["derive"] }
serde_json = "1.0.66"
Expand Down
1 change: 1 addition & 0 deletions eth-types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ pub mod geth_types;

pub use bytecode::Bytecode;
pub use error::Error;
use halo2_proofs::pairing;
use pairing::group::ff::PrimeField;

use crate::evm_types::{memory::Memory, stack::Stack, storage::Storage};
Expand Down
1 change: 0 additions & 1 deletion gadgets/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ authors = ["The appliedzkp team"]
[dependencies]
ff = "0.11"
halo2_proofs = { git = "https://github.com/appliedzkp/halo2.git", tag = "v2022_05_03" }
pairing = { git = 'https://github.com/appliedzkp/pairing', package = "pairing_bn256" }
sha3 = "0.7.2"
eth-types = { path = "../eth-types" }
digest = "0.7.6"
Expand Down
2 changes: 1 addition & 1 deletion gadgets/src/evm_word.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,12 @@ mod tests {
use super::*;
use ff::PrimeField;
use halo2_proofs::arithmetic::Field as HaloField;
use halo2_proofs::pairing::bn256::Fr as Fp;
use halo2_proofs::{
circuit::SimpleFloorPlanner,
dev::{FailureLocation, MockProver, VerifyFailure},
plonk::{Circuit, Instance},
};
use pairing::bn256::Fr as Fp;
use rand::SeedableRng;
use rand_xorshift::XorShiftRng;
use std::marker::PhantomData;
Expand Down
5 changes: 3 additions & 2 deletions gadgets/src/is_zero.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@
use halo2_proofs::{
circuit::{Chip, Region},
pairing::arithmetic::FieldExt,
plonk::{Advice, Column, ConstraintSystem, Error, Expression, VirtualCells},
poly::Rotation,
};
use pairing::arithmetic::FieldExt;

use std::array;

/// Trait that needs to be implemented for any gadget or circuit that wants to
Expand Down Expand Up @@ -139,10 +140,10 @@ mod test {
arithmetic::FieldExt,
circuit::{Layouter, SimpleFloorPlanner},
dev::MockProver,
pairing::bn256::Fr as Fp,
plonk::{Advice, Circuit, Column, ConstraintSystem, Error, Selector},
poly::Rotation,
};
use pairing::bn256::Fr as Fp;
use std::marker::PhantomData;

macro_rules! try_test_circuit {
Expand Down
2 changes: 1 addition & 1 deletion gadgets/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub mod is_zero;
pub mod monotone;

use halo2_proofs::circuit::AssignedCell;
use pairing::arithmetic::FieldExt;
use halo2_proofs::pairing::arithmetic::FieldExt;

#[allow(dead_code)]
/// An assigned cell in the circuit.
Expand Down
4 changes: 2 additions & 2 deletions gadgets/src/monotone.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
//! Monotone gadget helps to check if an advice column is monotonically
//! increasing within a range. With strict enabled, it disallows equality of two
//! cell.
use halo2_proofs::pairing::arithmetic::FieldExt;
use halo2_proofs::{
circuit::{Chip, Layouter},
plonk::{Advice, Column, ConstraintSystem, Error, Expression, Fixed, VirtualCells},
poly::Rotation,
};
use pairing::arithmetic::FieldExt;
use std::{marker::PhantomData, u64};

#[allow(dead_code)]
Expand Down Expand Up @@ -115,9 +115,9 @@ mod test {
FailureLocation, MockProver,
VerifyFailure::{self, Lookup},
},
pairing::bn256::Fr as Fp,
plonk::{Advice, Circuit, Column, ConstraintSystem, Error, Selector},
};
use pairing::bn256::Fr as Fp;
use std::marker::PhantomData;

#[derive(Clone, Debug)]
Expand Down
1 change: 0 additions & 1 deletion integration-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ pretty_assertions = "1.0.0"
log = "0.4.14"
env_logger = "0.9"
halo2_proofs = { git = "https://github.com/appliedzkp/halo2.git", tag = "v2022_05_03" }
pairing = { git = 'https://github.com/appliedzkp/pairing', package = "pairing_bn256" }
ff = "0.11"

[dev-dependencies]
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/tests/circuits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ async fn test_evm_circuit_block(block_num: u64) {

async fn test_state_circuit_block(block_num: u64) {
use halo2_proofs::arithmetic::BaseExt;
use pairing::bn256::Fr;
use halo2_proofs::pairing::bn256::Fr;

let cli = get_client();
let cli = BuilderClient::new(cli).await.unwrap();
Expand Down Expand Up @@ -63,7 +63,7 @@ async fn test_state_circuit_block(block_num: u64) {
ROWS_MAX,
>::new(Fr::rand(), &rw_map);

use pairing::bn256::Fr as Fp;
use halo2_proofs::pairing::bn256::Fr as Fp;
let prover = MockProver::<Fp>::run(DEGREE as u32, &circuit, vec![]).unwrap();
prover.verify().expect("state_circuit verification failed");
}
Expand Down
1 change: 0 additions & 1 deletion keccak256/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ halo2_proofs = { git = "https://github.com/appliedzkp/halo2.git", tag = "v2022_0
itertools = "0.10.1"
num-bigint = "0.4.2"
num-traits = "0.2.14"
pairing = { git = 'https://github.com/appliedzkp/pairing', package = "pairing_bn256" }
plotters = { version = "0.3.0", optional = true }
eth-types = { path = "../eth-types" }
lazy_static = "1.4"
Expand Down
2 changes: 1 addition & 1 deletion keccak256/src/circuit/word_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ mod tests {
metadata::{Column as MetaColumn, Region},
FailureLocation, MockProver, VerifyFailure,
},
pairing::bn256::Fr,
plonk::{Advice, Any, Circuit},
};
use pairing::bn256::Fr;
use pretty_assertions::assert_eq;

#[test]
Expand Down
1 change: 1 addition & 0 deletions keccak256/src/permutation/absorb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ mod tests {
use crate::common::State;
use crate::keccak_arith::KeccakFArith;
use halo2_proofs::circuit::Layouter;
use halo2_proofs::pairing;
use halo2_proofs::plonk::{Advice, Column, ConstraintSystem, Error};
use halo2_proofs::{circuit::SimpleFloorPlanner, dev::MockProver, plonk::Circuit};
use itertools::Itertools;
Expand Down
2 changes: 1 addition & 1 deletion keccak256/src/permutation/base_conversion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -168,10 +168,10 @@ mod tests {
use halo2_proofs::{
circuit::{Layouter, SimpleFloorPlanner},
dev::MockProver,
pairing::bn256::Fr as Fp,
plonk::{Advice, Circuit, Column, ConstraintSystem, Error},
};
use num_bigint::BigUint;
use pairing::bn256::Fr as Fp;
use pretty_assertions::assert_eq;
#[test]
fn test_base_conversion_from_b2() {
Expand Down
2 changes: 1 addition & 1 deletion keccak256/src/permutation/circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -287,9 +287,9 @@ mod tests {
use crate::common::{State, NEXT_INPUTS_LANES, ROUND_CONSTANTS};
use crate::gate_helpers::biguint_to_f;
use halo2_proofs::circuit::Layouter;
use halo2_proofs::pairing::bn256::Fr as Fp;
use halo2_proofs::plonk::{ConstraintSystem, Error};
use halo2_proofs::{circuit::SimpleFloorPlanner, dev::MockProver, plonk::Circuit};
use pairing::bn256::Fr as Fp;
use pretty_assertions::assert_eq;
use std::convert::TryInto;

Expand Down
2 changes: 1 addition & 1 deletion keccak256/src/permutation/iota_b13.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,9 @@ mod tests {
use crate::common::{PERMUTATION, ROUND_CONSTANTS};
use crate::gate_helpers::biguint_to_f;
use halo2_proofs::circuit::Layouter;
use halo2_proofs::pairing::bn256::Fr as Fp;
use halo2_proofs::plonk::{Advice, Column, ConstraintSystem, Error};
use halo2_proofs::{circuit::SimpleFloorPlanner, dev::MockProver, plonk::Circuit};
use pairing::bn256::Fr as Fp;
use pretty_assertions::assert_eq;
use std::convert::TryInto;
use std::marker::PhantomData;
Expand Down
2 changes: 1 addition & 1 deletion keccak256/src/permutation/iota_b9.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,9 +274,9 @@ mod tests {
use super::*;
use crate::common::{PERMUTATION, ROUND_CONSTANTS};
use halo2_proofs::circuit::Layouter;
use halo2_proofs::pairing::bn256::Fr as Fp;
use halo2_proofs::plonk::{Advice, Column, ConstraintSystem, Error};
use halo2_proofs::{circuit::SimpleFloorPlanner, dev::MockProver, plonk::Circuit};
use pairing::bn256::Fr as Fp;
use pretty_assertions::assert_eq;
use std::convert::TryInto;
use std::marker::PhantomData;
Expand Down
2 changes: 1 addition & 1 deletion keccak256/src/permutation/mixing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,10 +331,10 @@ mod tests {
use crate::common::{State, PERMUTATION, ROUND_CONSTANTS};
use crate::gate_helpers::biguint_to_f;
use halo2_proofs::circuit::Layouter;
use halo2_proofs::pairing::bn256::Fr as Fp;
use halo2_proofs::plonk::{ConstraintSystem, Error};
use halo2_proofs::{circuit::SimpleFloorPlanner, dev::MockProver, plonk::Circuit};
use itertools::Itertools;
use pairing::bn256::Fr as Fp;
use pretty_assertions::assert_eq;
use std::convert::TryInto;

Expand Down
2 changes: 1 addition & 1 deletion keccak256/src/permutation/pi.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use halo2_proofs::circuit::AssignedCell;
use halo2_proofs::pairing::arithmetic::FieldExt;
use itertools::Itertools;
use pairing::arithmetic::FieldExt;
use std::convert::TryInto;

/// The Keccak Pi step
Expand Down
2 changes: 1 addition & 1 deletion keccak256/src/permutation/rho.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,10 +123,10 @@ mod tests {
use crate::gate_helpers::biguint_to_f;
use crate::keccak_arith::*;
use halo2_proofs::circuit::Layouter;
use halo2_proofs::pairing::bn256::Fr as Fp;
use halo2_proofs::plonk::{Advice, Column, ConstraintSystem, Error};
use halo2_proofs::{circuit::SimpleFloorPlanner, dev::MockProver, plonk::Circuit};
use itertools::Itertools;
use pairing::bn256::Fr as Fp;
use std::convert::TryInto;

#[test]
Expand Down
2 changes: 1 addition & 1 deletion keccak256/src/permutation/state_conversion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,12 @@ mod tests {
use crate::arith_helpers::convert_b2_to_b13;
use crate::gate_helpers::biguint_to_f;
use crate::permutation::tables::FromBinaryTableConfig;
use halo2_proofs::pairing::bn256::Fr as Fp;
use halo2_proofs::{
circuit::{Layouter, SimpleFloorPlanner},
dev::MockProver,
plonk::{Advice, Circuit, Column, ConstraintSystem, Error},
};
use pairing::bn256::Fr as Fp;
use pretty_assertions::assert_eq;
#[test]
fn test_state_base_conversion() {
Expand Down
2 changes: 1 addition & 1 deletion keccak256/src/permutation/theta.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,13 @@ mod tests {
use crate::common::*;
use crate::gate_helpers::biguint_to_f;
use crate::keccak_arith::*;
use halo2_proofs::pairing::bn256::Fr as Fp;
use halo2_proofs::{
circuit::{Layouter, SimpleFloorPlanner},
dev::MockProver,
plonk::{Advice, Circuit, Column, ConstraintSystem, Error},
};
use itertools::Itertools;
use pairing::bn256::Fr as Fp;
use std::convert::TryInto;
use std::marker::PhantomData;

Expand Down
Loading

0 comments on commit 818f48e

Please sign in to comment.