zkevm-circuits
zkevm-circuits copied to clipboard
Meta: Minimal Tx with ether + Minimal ERC20 interaction - Milestone-1
Goal
The final goal of the Milestone-1 is to have a ZKEVM PoC that is able to:
- Send a minimal transaction with ETH
- Be able to interact with a minimal ERC20 contract.
Relaxation
The following features are postponed to further milestones:
- EIP1559 dynamic block gas limit and basefee calculation
- EIP2930 tx level access list
- Tx Trie
- Receipt Trie.
There are also some pieces required for this PoC which are being currently implemented and will probably be mocked at the beginning until we can fully integrate them. They are marked with (*) in the list of tasks. For example:
- Keccak circuit + Padding + state incrementally update implementation
- MPT circuit + single-key update implementation
- ECDSA circuit
- Aggregator circuit
TO DO list:
- [ ] Circuit
- [ ] ZKEVM circuit
- [ ] EVM circuit
- [ ] Execution result implementation
- [x]
BeginTx
: https://github.com/appliedzkp/zkevm-circuits/pull/230 - [x]
CALL
: (spec: https://github.com/appliedzkp/zkevm-specs/pull/82, circuit: https://github.com/appliedzkp/zkevm-circuits/pull/278) - [x]
EndTx
(Specs: https://github.com/appliedzkp/zkevm-specs/pull/88) https://github.com/appliedzkp/zkevm-circuits/pull/312 - [x]
STOP
https://github.com/appliedzkp/zkevm-specs/issues/146 (spec PR, circuit PR) - [x] RETURN (spec issue, circuit issue)
- [x] SHA3 (spec issue, circuit issue)
- [x]
EndBlock
(Currently we have a placeholder) (maybe this step can be generated in the circuit witness converter phase) (circuit issue) - [x] CircuitInputBuilder: generate CircuitSteps not associated with GethExecSteps (
- [x]
- [ ] Execution result implementation
- [ ] State circuit (@z2trillion and @DreamWuGit are working on this) (meta issue)
- [x] Consistency check implementation (https://github.com/appliedzkp/zkevm-specs/issues/64)
- [x] Implement updated specs https://github.com/appliedzkp/zkevm-specs/pull/118
- [x]
TxAccessListAccount
good first issue
- [x]
TxRefund
good first issue
- [x]
Account
good first issue
- [x]
CallContext
https://github.com/appliedzkp/zkevm-circuits/issues/225good first issue
- [x]
Stack
- [x]
Memory
- [x]
Storage
- [x]
- [ ] (*) State trie incrementally update implementation (connection to MPT circuit) using https://github.com/miha-stopar/mpt
- [x] Bytecode circuit
- [x] Bytecode hash check implementation
- [x] Tx circuit (Specs needed: https://github.com/appliedzkp/zkevm-specs/issues/65)
- [x] (*)
0x32
:ORIGIN
: tx lookup, stack push https://github.com/appliedzkp/zkevm-circuits/pull/360 - [x] (*)
0x3A
:GASPRICE
: tx lookup, stack push https://github.com/appliedzkp/zkevm-circuits/pull/422 - [x] (*) Tx hash check implementation
- [x] Signature check implementation
- [x] (*)
- [x] (*) ECDSA circuit
- [x] ECDSA chip implementation for signature verification: https://github.com/appliedzkp/halo2wrong/blob/master/ecdsa/src/ecdsa.rs
- [ ] (*) MPT circuit (@miha-stopar and @ChihChengLiang are working on this)
- [ ] MPT single-key update implementation: https://github.com/appliedzkp/zkevm-circuits/pull/253
- [ ] (*) Keccak256 circuit (@CPerezz and @ChihChengLiang are working on this)
- [x] Keccak state incrementally update implementation: https://github.com/appliedzkp/zkevm-circuits/issues/276
- [ ] EVM circuit
- [ ] (*) Aggregation circuit (Pending to create a crate for it once ECDSA is finished). (@han0110 and @scroll-dev are working on this)
- [ ] ZKEVM circuit
- [ ] Solidity verifier (@pinkiebell is working on this)
- [ ] Aggregation circuit proof verification
- [ ] circuit input generator
- [ ] calldata
- [ ] block constants
- [ ] (*) Deposit
- [ ] Prover
- [ ] Witness generation https://github.com/appliedzkp/zkevm-circuits/issues/222
- [x] Prover benchmarking
- [x] (*) Deposits / Withdraws (@pinkiebell is working on this)
- [x] PublicInputs Circuit (@davidnevadoc is working on this) (spec PR, circuit issue)
First iteration
Milestone 0 will be the first iteration where we apply the relaxations mentioned above by mocking some modules.
Overview
- evm circuit
- state circuit
- mock mpt circuit
- tx circuit
- hashes not proved
- mock signature circuit
- state circuit
Instead of aggregating all the circuits above with an aggregation circuit to generate a single proof, we consider the proof to be the list of circuit proofs, and its verification the verification of each proof individually.
Since we won't yet have smart contracts in L2, we skip the deposit/withdrawal functionality that moves ETH from L1 to L2. We can set some accounts with positive balance in the L2 genesis to test the transfers.
The L1 contract will receive the list of proofs for a block, prepare all the public inputs (and build necessary tables) and verify each proof. It will also calculate the hash for each tx to pass as public inputs.
@ed255 can you confirm the tx circuit part is all done ? I marked them as finished just now ;)
@ed255 can you confirm the tx circuit part is all done ? I marked them as finished just now ;)
Lacks keccak integration for sure(has a placeholder now). I think nothing else aside. But @ed255 can you confirm?
@ed255 can you confirm the tx circuit part is all done ? I marked them as finished just now ;)
That's correct! The Tx Circuit is done :)
As @CPerezz says, the Tx Circuit is currently not connected to the keccak; but I think this applies to all circuits that do lookups to other circuits, and I guess this will depend on the aggregation circuit.
contract deployment will be in next milestone?
contract deployment will be in next milestone?
We haven't defined a next milestone yet, but that could be included considering that we're not too far from having that feature.
As we've completed the ERC20 milestone, we can safely close this. 🎉