zkevm-circuits icon indicating copy to clipboard operation
zkevm-circuits copied to clipboard

newbie question regarding how zkevm works

Open zeroxaa opened this issue 3 years ago • 2 comments

hey, I understand one usecase of zkevm circuit project is to generate the proof offchain and verify it onchain via solidity code, that means the circuit itself should be independent of specific block data, in that way we can generate the vk from the circuit and put the vk in verifying contract. While i am looking at some implementation for example pi_circuit.rs, it contains public block data as part of the circuit, that means vk for pi_circuit is not a fixed thing. am i missing something? can someone shed light on how it should work? thanks.

zeroxaa avatar Sep 05 '22 00:09 zeroxaa

Best I can provide is some intro docs I made that I have pending to be published.

See: https://hackmd.io/SJ0e7p_dS9y3ZIq-MmXm4Q?view

CPerezz avatar Sep 06 '22 07:09 CPerezz

While i am looking at some implementation for example pi_circuit.rs, it contains public block data as part of the circuit, that means vk for pi_circuit is not a fixed thing. am i missing something? can someone shed light on how it should work? thanks.

Could you elaborate on where is the public block data part of the circuit? The circuit is defined from:

  • custom gates (the polynomial constraints)
  • lookups
  • fixed columns (either fixed or selectors)
  • copy constraints That's what defines the vk. The public input circuit should not contain any block data as part of those 4 sets. Once the circuit is defined, we fill the advices (witness) with values derived from the public block data in order to calculate a proof, but the same circuit can be reused for different blocks. We do have some circuit parameters that affect the vk like max number of txs, or max call data, but that will be fixed (once a sensible value is decided) and reused for all blocks.

ed255 avatar Sep 06 '22 09:09 ed255

Close due to inactivity. Also, FYI, we have a new video on zkevm-circuit codebase released https://www.youtube.com/watch?v=01U8O2I3quI

ChihChengLiang avatar May 19 '23 09:05 ChihChengLiang