From 31c5db91a5c05a73507e760b43bef7e5ed8f93f7 Mon Sep 17 00:00:00 2001 From: Dmitry Vagner Date: Tue, 17 Jan 2023 16:11:15 +0700 Subject: [PATCH] rename module --- evm/src/arithmetic/mod.rs | 2 +- evm/src/{bn254.rs => bn254_arithmetic.rs} | 5 +++++ evm/src/bn254_curve_pairing.rs | 0 evm/src/cpu/kernel/interpreter.rs | 2 +- evm/src/cpu/kernel/tests/bn254.rs | 2 +- evm/src/generation/prover_input.rs | 2 +- evm/src/lib.rs | 2 +- 7 files changed, 10 insertions(+), 5 deletions(-) rename evm/src/{bn254.rs => bn254_arithmetic.rs} (99%) create mode 100644 evm/src/bn254_curve_pairing.rs diff --git a/evm/src/arithmetic/mod.rs b/evm/src/arithmetic/mod.rs index bb58edf3..8a71888b 100644 --- a/evm/src/arithmetic/mod.rs +++ b/evm/src/arithmetic/mod.rs @@ -1,6 +1,6 @@ use ethereum_types::U256; -use crate::bn254::BN_BASE; +use crate::bn254_arithmetic::BN_BASE; use crate::util::{addmod, mulmod, submod}; mod add; diff --git a/evm/src/bn254.rs b/evm/src/bn254_arithmetic.rs similarity index 99% rename from evm/src/bn254.rs rename to evm/src/bn254_arithmetic.rs index 5f71c845..d7e3ca3e 100644 --- a/evm/src/bn254.rs +++ b/evm/src/bn254_arithmetic.rs @@ -1,3 +1,4 @@ +use std::ops::{Add, Div, Mul, Sub}; use std::str::FromStr; use ethereum_types::U256; @@ -11,6 +12,10 @@ pub const BN_BASE: U256 = U256([ 0x30644e72e131a029, ]); +// pub struct Fp { +// val: U256, +// } + pub type Fp = U256; pub type Fp2 = [U256; 2]; pub type Fp6 = [Fp2; 3]; diff --git a/evm/src/bn254_curve_pairing.rs b/evm/src/bn254_curve_pairing.rs new file mode 100644 index 00000000..e69de29b diff --git a/evm/src/cpu/kernel/interpreter.rs b/evm/src/cpu/kernel/interpreter.rs index 40fd7dbc..c8c5786b 100644 --- a/evm/src/cpu/kernel/interpreter.rs +++ b/evm/src/cpu/kernel/interpreter.rs @@ -7,7 +7,7 @@ use ethereum_types::{U256, U512}; use keccak_hash::keccak; use plonky2::field::goldilocks_field::GoldilocksField; -use crate::bn254::BN_BASE; +use crate::bn254_arithmetic::BN_BASE; use crate::cpu::kernel::aggregator::KERNEL; use crate::cpu::kernel::constants::context_metadata::ContextMetadata; use crate::cpu::kernel::constants::global_metadata::GlobalMetadata; diff --git a/evm/src/cpu/kernel/tests/bn254.rs b/evm/src/cpu/kernel/tests/bn254.rs index 1f6a9638..04b81675 100644 --- a/evm/src/cpu/kernel/tests/bn254.rs +++ b/evm/src/cpu/kernel/tests/bn254.rs @@ -3,7 +3,7 @@ use std::str::FromStr; use anyhow::Result; use ethereum_types::U256; -use crate::bn254::{ +use crate::bn254_arithmetic::{ curve_generator, fp12_to_vec, frob_fp12, gen_fp12, gen_fp12_sparse, miller_loop, mul_fp12, power, tate, twisted_curve_generator, Curve, Fp12, TwistedCurve, }; diff --git a/evm/src/generation/prover_input.rs b/evm/src/generation/prover_input.rs index bcbc5558..37363715 100644 --- a/evm/src/generation/prover_input.rs +++ b/evm/src/generation/prover_input.rs @@ -3,7 +3,7 @@ use std::str::FromStr; use ethereum_types::{BigEndianHash, H256, U256}; use plonky2::field::types::Field; -use crate::bn254::{fp12_to_array, inv_fp12, vec_to_fp12}; +use crate::bn254_arithmetic::{fp12_to_array, inv_fp12, vec_to_fp12}; use crate::generation::prover_input::EvmField::{ Bn254Base, Bn254Scalar, Secp256k1Base, Secp256k1Scalar, }; diff --git a/evm/src/lib.rs b/evm/src/lib.rs index bd9ba261..226a8b77 100644 --- a/evm/src/lib.rs +++ b/evm/src/lib.rs @@ -8,7 +8,7 @@ pub mod all_stark; pub mod arithmetic; -pub mod bn254; +pub mod bn254_arithmetic; pub mod config; pub mod constraint_consumer; pub mod cpu;