privacy-scaling-explorations / zkevm-circuits

https://privacy-scaling-explorations.github.io/zkevm-circuits/
Other
818 stars 852 forks source link

Implement the 8-bit word encoding #17

Closed ChihChengLiang closed 3 years ago

ChihChengLiang commented 3 years ago

What's wrong

We plan to use the BN254 curve that supports a max integer of 2**254, which is less than a typical 256-bit word in EVM.

To work with EVM values in the circuit, we need to encode a 256-bit value into 8 bits chunks. Take word256 = 1 example, the corresponding 8 bit words is word8s = [1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0].

Other details are specified here https://hackmd.io/@liangcc/zkvmbook/https%3A%2F%2Fhackmd.io%2FQUiYS3MnTu29s62yg9EtLQ

How are we fixing this

ChihChengLiang commented 3 years ago

Related https://github.com/appliedzkp/zkevm-specs/pull/12