-
Notifications
You must be signed in to change notification settings - Fork 57
✨ add EC and modexp precompiles #143
base: dl-precompiles
Are you sure you want to change the base?
✨ add EC and modexp precompiles #143
Conversation
>( | ||
builder: CsBuilder<T, F, GC, TB>, | ||
) -> CsBuilder<T, F, impl GateConfigurationHolder<F>, impl StaticToolboxHolder> { | ||
// TODO: Maybe some gates are not actually needed since it was copy-pasting from the previous secp256k1 ecmul implementation. |
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.
you can check if this is the case or not by running a full proof of the circuit and then printing the gate stats - it should give you a tally of how often each gate is called
(Some(TARGET_CIRCUIT_TRACE_LENGTH), Some(1 << 26)) | ||
} | ||
|
||
fn add_tables<CS: ConstraintSystem<F>>(cs: &mut CS) { |
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.
are any of these tables actually necessary? i thought ecadd only uses gates and it seems useless to add byte splits, bitwise ops and fixed base muls
(Some(TARGET_CIRCUIT_TRACE_LENGTH), Some(1 << 26)) | ||
} | ||
|
||
fn add_tables<CS: ConstraintSystem<F>>(cs: &mut CS) { |
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.
i assume it's the same case with gates and tables here but these should be checked and removed before merging on each new circuit
ECAdd(T), | ||
ECMul(T), | ||
ECPairing(T), |
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.
i think its best to keep the order of when the circuit was added, so they should be at the bottom of the list, it will break backwards compatibility with the old numeric_circuit_type
s
ZkSyncBaseLayerStorage::ECAdd(..) => "Elliptic Curve points addition", | ||
ZkSyncBaseLayerStorage::ECMul(..) => "Elliptic Curve point multiplication by a scalar", | ||
ZkSyncBaseLayerStorage::ECPairing(..) => "Elliptic Curve pairing on BN254", |
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.
same goes then for all these instances of course
src/tests/run_manually.rs
Outdated
match el { | ||
ZkSyncBaseLayerCircuit::ECAdd(_) => { | ||
base_test_circuit(el); | ||
} | ||
_ => { | ||
continue; | ||
} | ||
} | ||
// base_test_circuit(el); |
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.
ensure this is changed back before merging
370c42a
to
12a6b87
Compare
Rebased to |
What ❔
Add tests for ECMul, ECAdd, ECPairing and Modexp.
Why ❔
The above were absent.
Checklist
zk fmt
andzk lint
.