-
Notifications
You must be signed in to change notification settings - Fork 856
[word-lo-hi] fine tune copy circuit to reduce degree #1508
Conversation
|
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.
This solution looks good to me!
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
Will merge it first to unblock word-lo-hi back to main. state circuit case can fine tune later |
Nice improvment! What do you have in mind (overengineered?) for the 4-batched zero check in state circuit? |
Hi @adria0 my option is intuitively quick fix is separating into 4 zero check then |
fortunately I see that only is used in state circuit :) Maybe 4 extra is_zero it's ok for now. |
Description
[PR description]
Issue Link
#1499
Type of change
Contents
This pr is to rewrite/split copy circuit constrains to trade more gates with less degree.
copy table
tag
field is binary number decomposition with degree N (N represent number of bits, in copy table case N = 3). Once put inor::expr([#num_or_condition])
, gate degrees will be exploded quickly byN*#num_or_condition
.Before PR, copy circuit max is degree 12,
After PR, copy circuit max 6 degree with 2 more gates.
However, circuit degree upper bound still increase by 1 (9 -> 10) for word-lo-hi refactor, due to state-circuit
batch_is_zero-"is_zero is 1 if values are all zero">
gate degrees from 6 -> 10 Due to we fold 2 extra column, each contribute 2 degreeshttps://github.com/privacy-scaling-explorations/zkevm-circuits/blob/word-lo-hi/zkevm-circuits/src/state_circuit.rs#L129-L141.
State circuit need some discussion, as I thought rewrite it might be a bit over-engineering.