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

Migrate multi-packed keccak witness assignment to `Value<F>` API

Open CPerezz opened this issue 3 years ago • 0 comments

I made an effort to migrate Part<F> and PartValue<F> and the witness assignment/generation in general to use the Value<F> struct from halo2 API in https://github.com/privacy-scaling-explorations/zkevm-circuits/pull/925. During the process, I found several problems on the path that discouraged me from continuing with the task although I think is doable without changes to the Halo2 Value API.

  1. It feels really tricky to extract the byte representation from a Value<F>. It feels like if you're cheating to the API constantly (using .map() to gain access to the underlying F so that you can do extra things with it such as decompose it into bytes actually).
  2. Since the struct doesn't implement PartialEq it's challenging to perform some sanity checks.
  3. IIRC, XOR/AND are not implemented for Value. And that also complicates certain things as you need again to nest multiple map()s to perform the operations with the underlying F's.

For these reasons, right now extract_field function was added. And the goal is to get ridd of it fixing the witness assignment/generation to be done with the Value<F> API.

CPerezz avatar Nov 28 '22 17:11 CPerezz