Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Entrypoint for EVM circuit and specification for BEGIN_TX #52

Merged

Conversation

han0110
Copy link
Collaborator

@han0110 han0110 commented Oct 14, 2021

This PR aims to:

  • Provide a entrypoint verify_steps to better describe EVM circuit.
  • Naively setup all used lookup tables' interface (except keccak256_table).
  • Naively enumerate all possible execution result. (resolves EVM errors  #29)
  • Spec BEGIN_TX to verify the beginning of a transaction.
  • Implement ADD and PUSH using newly introduced Instruction as sample code.
  • Take is_code annotation for JUMP* #66 into consideration in bytecode_table for further implementation.

Some changes have been made including:

  • Bus mapping is split into multiple tables corresponding their provider. In the end we can still merge them into same lookup table with some selector, but it depends on the dimension and desired capacity.
  • global_counter is renamed to rw_counter cause only writable data are time-aware.
  • Error cases is separated from success cases to avoid redundant implementation and test. See ExecutionResult for all possible cases.
  • Introduce Instruciton to simulate both verifier (constrain some relation) and prover (calculate some non-qudratic relation).

@han0110 han0110 marked this pull request as draft October 14, 2021 13:23
@han0110 han0110 changed the title [WIP] Entrypoint for EVM circuit [WIP] Entrypoint for EVM circuit and specification for CALL Oct 14, 2021
@han0110 han0110 marked this pull request as ready for review October 21, 2021 08:02
This was referenced Oct 21, 2021
Copy link
Contributor

@gaswhat gaswhat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My concern is that the allocations in each Step is quite difficult to write for the test cases in the current way. For a stack push/pop, you need to manually set the lookup entry. Is it possible that we could mimic the approach in the circuit repo that separates the execution steps from the bus mapping lookup?

src/zkevm_specs/util/arithmetic.py Outdated Show resolved Hide resolved
src/zkevm_specs/evm/step.py Outdated Show resolved Hide resolved
src/zkevm_specs/evm/step.py Outdated Show resolved Hide resolved
@han0110 han0110 changed the title [WIP] Entrypoint for EVM circuit and specification for CALL Entrypoint for EVM circuit and specification for CALL Oct 28, 2021
@scroll-dev scroll-dev mentioned this pull request Nov 5, 2021
Copy link
Collaborator

@ChihChengLiang ChihChengLiang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did not give a thorough look, just reading through the previous review discussions. If there's nothing more to add to this PR, we can merge and unblock the future PR.

Copy link
Collaborator

@DreamWuGit DreamWuGit left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@han0110 han0110 marked this pull request as draft November 12, 2021 04:19
@han0110 han0110 changed the title Entrypoint for EVM circuit and specification for CALL Entrypoint for EVM circuit and specification for BEGIN_TX Nov 26, 2021
@han0110 han0110 marked this pull request as ready for review November 26, 2021 10:43
@han0110 han0110 mentioned this pull request Nov 26, 2021
@han0110
Copy link
Collaborator Author

han0110 commented Dec 8, 2021

Merge for unblocking further PRs.

@han0110 han0110 merged commit 9d90c49 into privacy-scaling-explorations:master Dec 8, 2021
@han0110 han0110 deleted the feature/evm-circuit branch December 8, 2021 13:36
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

EVM errors
6 participants