forked from scroll-tech/zkevm-circuits
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* precompile io table definition * chore: ecc circuit (pre-req) * chore: more witness data structs * wip: assignment to the ecc circuit * wip: pairing ops * wip * wip: assigned values to ecadd, ecmul * wip: assigned ec ops * wip: expose ecc table * chore: refactor * chore: docs * ecc table dev load * pairing op bytes * chore: refactor to_bytes for pairing op * add ecc table to evm circuit * wip: test structure for ecc circuit * add unequal or double * tests for ecc circuit * random values in tests (ecc circuit) * fix: compilation * fix: minor fixes * fix: pairing op assert success value * chore: remove part not required * fix: compilation * fix: docs for ecc table args * chore: revert changes added by mistake * feat: EcMul execution gadget and associated bus-mapping * refactor: conform to new precompile gadget pattern * test: add eip-196 specified test cases for ecmul * fix: 32-byte scalar s needs to be reduced to Fr * fix: handle point at infinity for pairing op * fix: accommodate valid large scalar values * fix: variadic size OK | ignore infinity points * feat: add verifying constraints on scalar mod order of Fr * fix: handling ecadd/ecdouble using ecc_chip::sum * chore: refactor, clean code * fix: add gadget conditions for infinity points and zero scalar * fix: resolve merge conflict on ecc circuit * fix: remove invalid flag on ecmul gadget * fix: resolve merge conflict ecc circuit test * fix: add padding gadget for bus-mapping * fix: modulo copy constraints and infinity/empty inputs * fix: doc * chore: remove unnecessary parts | fmt * feat: handle edge cases for ecAdd within ecc ciruit * chore: clippy fix * fix: copy lookups for precompile from callop * chore: revision from PR review * clippy fix * fix: scalar s doesn't need to be RLC in the ecc table lookup * fix: mod gadget can accept both EVM/Keccak randomness * chore: one less phase2 cell * chore: review comments --------- Co-authored-by: Rohit Narurkar <[email protected]>
- Loading branch information
1 parent
ac5f73e
commit b348d3f
Showing
11 changed files
with
693 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
use crate::{ | ||
circuit_input_builder::{CircuitInputStateRef, EcMulOp, ExecStep, PrecompileEvent}, | ||
precompile::{EcMulAuxData, PrecompileAuxData}, | ||
}; | ||
|
||
pub(crate) fn handle( | ||
input_bytes: Option<Vec<u8>>, | ||
output_bytes: Option<Vec<u8>>, | ||
state: &mut CircuitInputStateRef, | ||
exec_step: &mut ExecStep, | ||
) { | ||
let input_bytes = input_bytes.map_or(vec![0u8; 96], |mut bytes| { | ||
bytes.resize(96, 0u8); | ||
bytes | ||
}); | ||
let output_bytes = output_bytes.map_or(vec![0u8; 64], |mut bytes| { | ||
bytes.resize(64, 0u8); | ||
bytes | ||
}); | ||
|
||
let aux_data = EcMulAuxData::new(&input_bytes, &output_bytes); | ||
exec_step.aux_data = Some(PrecompileAuxData::EcMul(aux_data)); | ||
|
||
let ec_mul_op = EcMulOp::new_from_bytes(&input_bytes, &output_bytes); | ||
state.push_precompile_event(PrecompileEvent::EcMul(ec_mul_op)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.