add state circuit to super circuit#670
Conversation
|
|
||
| impl RwMap { | ||
| /// Check rw_counter is continous and starting from 1 | ||
| pub fn check_rw_counter_sanity(&self) { |
There was a problem hiding this comment.
i like this check style !!
| pub struct StateCircuit<F> { | ||
| pub(crate) randomness: F, | ||
| pub(crate) rows: Vec<Rw>, | ||
| pub(crate) n_rows: usize, |
There was a problem hiding this comment.
one question: Does n_rows need to be equal to evm circui rows number in real proof ?
There was a problem hiding this comment.
no. n_rows is the rows of rw table. rw table in evm circuit and state circuit should be same. Not related to the total rows (max of fixed_table, rw_table, tx_table, other parts..) of circuit.
| &mut layouter, | ||
| &self.block.rws.table_assignments(), | ||
| self.block.randomness, | ||
| self.block.state_circuit_pad_to, |
There was a problem hiding this comment.
where is state_circuit_pad_to assigned and how to decide the value ?
There was a problem hiding this comment.
it is left to do in the final circuit (aggregation circuit / super circuit / etc) in the future. Currently we can either set it to (1<<k - 64), or in tests set it to 0 to indicate no padding needed.
| keccak_table: KeccakTable, | ||
| copy_table: CopyTable, | ||
| evm_circuit: EvmCircuit<F>, | ||
| state_circuit: StateCircuitConfig<F>, |
There was a problem hiding this comment.
not sure if need add state_circuit into L86 like tx_circuit I see it will be used for unit tests
There was a problem hiding this comment.
nonono TxCircuit is witness, while StateCircuitConfig is columns.... See for more details: #650
DreamWuGit
left a comment
There was a problem hiding this comment.
overall LGTM!! leave minor comments
|
Are we still planning to move to RLC based lookups in the future? I think the |
roynalnaruto
left a comment
There was a problem hiding this comment.
Just a couple of questions, looks good overall. Also the copy_circuit.rs needs resolving conflict from the last merge :)
|
|
||
| impl RwMap { | ||
| /// Check rw_counter is continous and starting from 1 | ||
| pub fn check_rw_counter_sanity(&self) { |
There was a problem hiding this comment.
In case the RWs do not pass the sanity check, do we want to panic (the debug_assert_eq will panic)? Or handle the error before loading the RW table?
There was a problem hiding this comment.
there are two scenarios that cannot satisfy check_rw_counter_sanity. (1)in evm circuit witness is wrong, it is bug so we debug_assert (2) we manually construct test cases for state circuit where rw_counter may not be continuous.
So i only check_rw_counter_sanity in evm circuit assignment, and let it fail if error happens
i am not sure. Even in scroll-dev branch i no longer use RLC to reduce the long term fork maintenance burden at the cost of 1-2% more rows in aggregation circuit.
there are still something missing to constrain the relationship between value.prev() <=> value_prev.cur(). At least Rw::Account prev value cannot satisfy the equality. In another branch i constrain value_prev like this: https://github.com/scroll-tech/zkevm-circuits/blob/bdf8fd3361d49fc6d8110489d744ce202cf022ee/zkevm-circuits/src/state_circuit/constraint_builder.rs#L137-L186 |
* implement RLC chip * keccak table interfaces * minor * mock chunk tests * aggregation tests * fixes * supporing empty hash preimage * minor * remove tmp data * clean up and address comments * update docs * partial fix clippy * fix chunk construction bug * fix compiling bug * fix padded chunk's data hash * fix bug in number of valid chunks * handle the case of all valid ones * add fixed columns to rlc config * enforce the chunks are orderred * fix bugs in challenges * add missing selectors for aggregation circuit * fix the fixed cells (privacy-ethereum#677) * try to reenable skip first pass * tr to fix skip first pass again * try to fix again * clean up * fixed skip first pass * aggregation parameter with k = 19 * removing unused features; partial address comments * fix clippy * fix clippy * address comment on fixed cells * fix dynamic hash test * try to fix new fixed cells * reverting last 3 commits * Add conversion from witness `Block` to `ChunkHash`. (privacy-ethereum#683) --------- Co-authored-by: Steven <asongala@163.com>
…s for the dummy chunk proofs to avoid dummy chunk proofgen time (#712) * partiall address review comments of #670 * disable disable_proof_agg by default * fix soundness issues with data hash * add fixed cells for chunk_is_valid * fix typo * well... need morning coffee * typo in readme * fix soundness issue in is_smaller_than * [feat] unify u8 u16 lookup table (#694) * add range table * replace Range256Table of rlp_circuit_fsm * replace u16_table of tx_circuit * use TableColumn * add type alias * use type alias * annotate lookup column * opt min_num_rows_block in poseidon_circuit (#700) prune debug prints and lint * speedup ci using verify_at_rows (#703) * speedup ci using verify_at_rows * use verify_at_rows to speedup super circuit ci tests * update super circuit row estimation API (#695) * remove num_of_chunks in aggregation circuit's instance column (#704) Co-authored-by: kunxian xia <xiakunxian130@gmail.com> * fix: lost tx_type when doing type conversion (#710) * fix condition (#708) * gates for zero checks * statement 1 is correct * reenable statements 3,6,7 * reenable statement 4 * everything seems to work again * update aggregation test accordingly * update spec * minor clean up * Fix fmt. * Make `ChunkHash` fields public. * fix decompose function * update figures * clean up * address comments * add is_final checks * update readme * constraint hash input length * fix clippy --------- Co-authored-by: Akase Cho <lightsing@users.noreply.github.com> Co-authored-by: Ho <noel.wei@gmail.com> Co-authored-by: Zhang Zhuo <mycinbrin@gmail.com> Co-authored-by: kunxian xia <xiakunxian130@gmail.com> Co-authored-by: Steven Gu <asongala@163.com>
most of the changes are for extracting the "rw table" out of state circuit so it can be shared between evm circuit and state circuit. Most of circuit config and assignment codes are moved from
StateCircuittoStateCircuitConfigsimilar to EvmCircuit, soStateCircuitnow becomes a "tester" circuit similar to TestCircuit in evm_circuit.rs, or "MyCircuit" in bytecode circuit / copy circuit / tx circuit.My concern is that moving codes from StateCircuit to StateCircuitConfig results large diffs and makes it a bit difficult to review... Any suggestions..?
I manually tested this PR using super circuit with cmd
cargo test --release -p zkevm-circuits skip_test_super_circuit -- --ignoredand it passed.TODO:
the newly added "aux2" and "value_prev" cols in rw table are not constrained yet. After #621 is merged, we can revisit how to constrain the relationship between initial_value / committed_value / prev_value.