This repository has been archived by the owner on Jul 5, 2024. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
### Description Add a new command to the stats binary that reports halo2 circuit stats for each circuit, and the supercircuit. ### Issue Link Resolve #1645 ### Type of change - [x] New feature (non-breaking change which adds functionality) ### Contents - Added new module in `stats` that records halo2 circuit stats from the configured `ConstraintSystem`, based on Scroll's code from https://github.com/scroll-tech/zkevm-circuits/blob/7d9bc181953cfc6e7baf82ff0ce651281fd70a8a/zkevm-circuits/src/util.rs#L294 - The collection of stats works in two phases, first it records per-circuit stats and then total stats (to get super circuit stats). The per-circuit stats works by configuring all the shared tables into the same `ConstraintSystem` (and obtaining stats via deltas), and then configuring each sub-circuit starting from the shared tables `ConstraintSystems` each time. - In order to separate the shared column configuration from the sub-circuit and constraints configuration, I had to extract the column definition of the BinaryNumberChip into BinaryNumberBits so that the CopyTable can be constructed without any constraint. - Added peak memory estimation based on @han0110's analysis ### Results These results are for `k = 26`. At the current worst-case estimation of At 0.0139 gas/row this gives us 2^26 * 0.0139 = ~900k gas. For 30M gas we would need 33 chunks like that. |circuit|constraints|rots|min/max(rots)|fix_cols|sels|advs|perms|lookups|degree|mem_gb| |:----|:----|:----|:----|:----|:----|:----|:----|:----|:----|:----| |tx_table|0|0|0/0|1|0|4|0|0|3|58| |wd_table|0|0|0/0|0|0|5|0|0|3|56| |rw_table|0|0|0/0|0|0|14|0|0|3|110| |mpt_table|0|0|0/0|0|0|12|0|0|3|98| |bytecode_table|0|0|0/0|0|0|6|0|0|3|62| |block_table|0|0|0/0|2|0|2|0|0|3|54| |copy_table|0|0|0/0|1|0|12|0|0|3|106| |exp_table|0|0|0/0|1|0|5|0|0|3|64| |keccak_table|0|0|0/0|0|0|5|0|0|3|56| |sig_table|0|0|0/0|1|0|9|0|0|3|88| |u8_table|0|0|0/0|1|0|0|0|0|3|34| |u10_table|0|0|0/0|1|0|0|0|0|3|34| |u16_table|0|0|0/0|1|0|0|0|0|3|34| |keccak|2523|105|-89/207|18|0|198|0|123|4|3000| |pi|21|2|0/1|3|7|10|15|3|9|754| |tx|2|2|0/1|13|4|6|9|6|6|780| |bytecode|23|2|0/1|5|0|6|0|2|8|342| |copy|34|3|0/2|1|1|14|0|12|9|466| |state|203|3|-1/1|3|0|49|0|36|10|2224| |exp|44|11|0/10|0|1|10|0|0|5|142| |evm|42318|21|0/20|5|3|131|3|53|7|2976| |super|45168|106|-89/207|57|16|498|25|235|10|21736| PD: Yes, the estimation is 21TB of memory for a super circuit proof :( Nevertheless there are various things we can do to improve this.
- Loading branch information