-
Notifications
You must be signed in to change notification settings - Fork 857
Conversation
4b80960
to
99d2b1c
Compare
de1790e
to
01b82f7
Compare
9f248ba
to
0e7d8a1
Compare
ca8eb40
to
ecbc924
Compare
* feat: preliminary work * wip * finish assignment to ecrecover * fix: input length may be different than call data length (for precompiles) * fix: input bytes to ecrecover * minor edits * Fix ecrecover input rlc comparison (right-padding zeroes) (#585) * potential approach (pow of rand lookup) * add lookup for pow of rand * fix: right pad only if needed * fix: missing constraint on padded_rlc * constrain pow of rand table * Update step.rs * fix: sig_v sanity check (remove assertions to allow garbage input) * fix: calldata length == 0 handled * chore: renaming precompile_* and parallel iter for tests --------- Co-authored-by: Zhang Zhuo <[email protected]> Precompile ECRECOVER (#529) * feat: preliminary work * wip * finish assignment to ecrecover * fix: input length may be different than call data length (for precompiles) * fix: input bytes to ecrecover * minor edits * Fix ecrecover input rlc comparison (right-padding zeroes) (#585) * potential approach (pow of rand lookup) * add lookup for pow of rand * fix: right pad only if needed * fix: missing constraint on padded_rlc * constrain pow of rand table * Update step.rs * fix: sig_v sanity check (remove assertions to allow garbage input) * fix: calldata length == 0 handled * chore: renaming precompile_* and parallel iter for tests --------- Co-authored-by: Zhang Zhuo <[email protected]>
* wip: preliminary work sig circuit/lookp * feat: handle panics and edge cases in sig circuit * fix: handle v not boolean * fix: fq modulus not assigned and bus-mapping handle overflowing r/s * fix: sig_v handle invalid values (lookup) and is_valid dev_load fix * refactor (review comment) * fix: no sig table lookup for invalid sig_v * remove wrong test case (assertion fail)
ecbc924
to
d0d3c4a
Compare
This reverts commit 2e2625c.
afd1526
to
be813d0
Compare
be813d0
to
fc1065c
Compare
93ecb19
to
4f09a7d
Compare
bbdf449
to
359ad7e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added some nitpicks and questions. Looks great to me, but I have yet to read ECC circuit more carefully.
zkevm-circuits/src/sig_circuit.rs
Outdated
// - limb_bits: 88 | ||
// - num_limbs: 3 | ||
// | ||
// TODO: make those parameters tunable from a config file |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this to be done in a new PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed in aed502b
}, | ||
)?; | ||
|
||
layouter.assign_region( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are some TODOs in the Scroll version, like // TODO: is this correct?
before assign_region
function. I guess it's a leftover?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, I believe so. So, I removed it.
zkevm-circuits/src/ecc_circuit.rs
Outdated
powers_of_256: &[QuantumCell<F>], | ||
op: &EcAddOp, | ||
) -> EcAddDecomposed<F> { | ||
log::trace!("[ECC] ==> EcAdd Assignmnet START:"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: Assignmnet -> Assignment
|
||
ecc_chip.assert_equal(ctx, &rand_point, &sum3); | ||
|
||
log::trace!("[ECC] EcAdd Assignmnet END:"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: Assignment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice catch! fixed in 4d5070f
powers_of_256: &[QuantumCell<F>], | ||
op: &EcMulOp, | ||
) -> EcMulDecomposed<F> { | ||
log::trace!("[ECC] ==> EcMul Assignmnet START:"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: Assignment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed in 4d5070f
powers_of_256: &[QuantumCell<F>], | ||
op: &EcPairingOp, | ||
) -> EcPairingDecomposed<F> { | ||
log::trace!("[ECC] ==> EcPairing Assignment START:"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: same as above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed in 4d5070f
e30ce15
to
7af89c8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems all good to me. I would need some more time to check every detail of the ecc_circuit, but there are tests covering all edge cases and it was peer reviewed by Scroll people, so I think it should be all right.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
First pass.
47e9d16
to
d6bc6c1
Compare
375181b
to
a9858ef
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
closed #1665
This PR was ported from
which manly includes,
ecrecover.rs
)sig_circuit.rs
). What I did is to change rlc to word lo/hi.sig_table.rs
ecc_circuit.rs
). It's not be used inecRecover
, but it was implemented in Scroll's PR. If I removed ecc_circuit, it would be inconvienent for people portingecAdd
,ecMul
orecPairing
. That's why I keep it here.halo2lib
(includeshalo2-base
andhalo2-ecc
)