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

Circuit for opcode `BALANCE`

Open silathdiir opened this issue 3 years ago • 2 comments

Spec: https://github.com/privacy-scaling-explorations/zkevm-specs/pull/248

Summary

  1. Update BALANCE bus-mapping and add circuit.
  2. Fix to lookup Balance if account exists, otherwise lookup NonExisting.
  3. Add a HashSet to save non-existent account addresses in both bus-mapping and circuit ExeSteps.

~~Not confirm if necessary to constrain "If the given account doesn't exist, then it will push 0 onto the stack instead." in the circuit. And is there a method (could be used in circuit) to lookup if account is existing? Thanks.~~

~~Blocked by PR https://github.com/privacy-scaling-explorations/zkevm-circuits/pull/907~~

silathdiir avatar Aug 16 '22 07:08 silathdiir

Blocked by https://github.com/privacy-scaling-explorations/zkevm-specs/pull/248 which is at the same time blocked by https://github.com/privacy-scaling-explorations/zkevm-specs/issues/249

CPerezz avatar Aug 19 '22 09:08 CPerezz

Will try to update this PR since https://github.com/privacy-scaling-explorations/zkevm-circuits/pull/907 has been merged.

silathdiir avatar Dec 03 '22 11:12 silathdiir

Hi @CPerezz , I updated this BALANCE circuit with non-existing proofs. Could you help review again when you have time? Thanks.

silathdiir avatar Dec 15 '22 13:12 silathdiir

LGTM! I'd want another review from someone at Scroll before merging this! @icemelon or @silathdiir could you ping someone? 😄

Yes. I will ping others to help review. Thanks a lot.

silathdiir avatar Dec 20 '22 08:12 silathdiir

need to modify https://github.com/privacy-scaling-explorations/zkevm-circuits/blob/3da1888cfdea1f05062477279d9c5088e01fac19/zkevm-circuits/src/witness/step.rs#L184

lispc avatar Dec 21 '22 05:12 lispc

need to modify

https://github.com/privacy-scaling-explorations/zkevm-circuits/blob/3da1888cfdea1f05062477279d9c5088e01fac19/zkevm-circuits/src/witness/step.rs#L184

Sorry for the wrong revert. Fixed to OpcodeId::BALANCE => ExecutionState::BALANCE and moved to next one of ADDRESS.

silathdiir avatar Dec 21 '22 06:12 silathdiir