zkevm-circuits
zkevm-circuits copied to clipboard
Meta: Opcode spec + implementation status
opcode | spec | circuit | bus-mapping | ExecutionState | Notes |
---|---|---|---|---|---|
STOP | x | x | x | STOP | |
ADD | x | x | x | ADD_SUB | |
MUL | x | x | x | MUL_DIV_MOD | MulDivModGadget |
SUB | x | x | x | ADD_SUB | |
DIV | x | x | x | MUL_DIV_MOD | MulDivModGadget |
SDIV | x | x | x | SDIV | |
MOD | x | x | x | MUL_DIV_MOD | MulDivModGadget |
SMOD | x | x | x | SMOD | |
ADDMOD | x | x | x | ADDMOD | |
MULMOD | x | x | x | MULMOD | |
EXP | x | x | x | EXP | |
SIGNEXTEND | x(*) | x | x | SIGNEXTEND | |
LT | x(*) | x | x | CMP | |
GT | x(*) | x | x | CMP | |
SLT | x | x | x | SCMP | |
SGT | x | x | x | SCMP | |
EQ | x(*) | x | x | CMP | |
ISZERO | x | x | x | ISZERO | |
AND | x(*) | x | x | BITWISE | |
OR | x(*) | x | x | BITWISE | |
XOR | x(*) | x | x | BITWISE | |
NOT | x | x | x | NOT | |
BYTE | x(*) | x | x | BYTE | |
CALLDATALOAD | x | x | x | CALLDATALOAD | |
CALLDATASIZE | x | x | x | CALLDATASIZE | |
CALLDATACOPY | x | x | x | CALLDATACOPY | |
CODESIZE | x | x | x | CODESIZE | |
CODECOPY | x | x | x | CODECOPY | |
SHL | x | x | x | SHL | |
SHR | x | x | x | SHR | |
SAR | x | SAR | WIP https://github.com/privacy-scaling-explorations/zkevm-specs/pull/263 #727 | ||
POP | x(*) | x | x | POP | |
MLOAD | x(*) | x | x | MEMORY | |
MSTORE | x(*) | x | x | MEMORY | |
MSTORE8 | x(*) | x | x | MEMORY | |
JUMP | x | x | x | JUMP | |
JUMPI | x | x | x | JUMPI | |
PC | x | x | x | PC | |
MSIZE | x(*) | x | x | MSIZE | |
JUMPDEST | x | x | x | JUMPDEST | |
PUSH_N | x | x | x | PUSH | |
DUP_N | x | x | x | DUP | |
SWAP_N | x | x | x | SWAP | |
RETURN | x | x | x | RETURN | |
REVERT | x | x | REVERT | ||
SHA3 | x | x | x | SHA3 | |
ADDRESS | x | x | x | ADDRESS | |
BALANCE | x | BALANCE | WIP #683 | ||
ORIGIN | x | x | x | ORIGIN | |
CALLER | x | x | x | CALLER | |
CALLVALUE | x | x | x | CALLVALUE | |
GASPRICE | x | x | x | GASPRICE | |
EXTCODESIZE | EXTCODESIZE | ||||
EXTCODECOPY | x | EXTCODECOPY | WIP #720 | ||
EXTCODEHASH | x | x | x | EXTCODEHASH | |
RETURNDATASIZE | x | x | x | RETURNDATASIZE | |
RETURNDATACOPY | x | RETURNDATACOPY | WIP #779 | ||
BLOCKHASH | x | x | x | BLOCKHASH | |
COINBASE | x | x | x | BLOCKCTXU160 | BlockCtxGadget |
TIMESTAMP | x | x | x | BLOCKCTXU64 | BlockCtxGadget |
NUMBER | x | x | x | BLOCKCTXU64 | BlockCtxGadget |
DIFFICULTY | x | x | x | BLOCKCTXU256 | BlockCtxGadget |
GASLIMIT | x | x | x | BLOCKCTXU64 | BlockCtxGadget |
CHAINID | x | x | x | CHAINID | |
SELFBALANCE | x | x | x | SELFBALANCE | |
BASEFEE | x | x | x | BLOCKCTXU256 | BlockCtxGadget |
SLOAD | x | x | x | SLOAD | |
SSTORE | x | x | x | SSTORE | |
GAS | x | x | x | GAS | |
LOG_N | x | x | x | LOG | |
CREATE | CREATE | ||||
CREATE2 | CREATE2 | ||||
CALL | x | x | x | CALL | |
CALLCODE | x | CALLCODE | |||
DELEGATECALL | x | DELEGATECALL | WIP #847 | ||
STATICCALL | x | x | x | STATICCALL | |
SELFDESTRUCT | SELFDESTRUCT |
(*): Python spec is implemented in an outdated API: https://github.com/privacy-scaling-explorations/zkevm-specs/issues/230
Error states
spec | circuit | bus-mapping | ExecutionState | Notes |
---|---|---|---|---|
ErrorInvalidOpcode | ||||
ErrorStackOverflow | WIP https://github.com/privacy-scaling-explorations/zkevm-specs/pull/301 #873 | |||
ErrorStackUnderflow | WIP https://github.com/privacy-scaling-explorations/zkevm-specs/pull/301 #873 | |||
ErrorWriteProtection | ||||
ErrorDepth | ||||
ErrorInsufficientBalance | ||||
ErrorContractAddressCollision | ||||
ErrorInvalidCreationCode | ||||
ErrorMaxCodeSizeExceeded | ||||
ErrorInvalidJump | ||||
ErrorReturnDataOutOfBound | ||||
x | ErrorOutOfGasConstant | |||
x | ErrorOutOfGasStaticMemoryExpansion | |||
ErrorOutOfGasDynamicMemoryExpansion | ||||
ErrorOutOfGasMemoryCopy | ||||
ErrorOutOfGasAccountAccess | ||||
ErrorOutOfGasCodeStore | ||||
ErrorOutOfGasLOG | ||||
ErrorOutOfGasEXP | ||||
ErrorOutOfGasSHA3 | ||||
ErrorOutOfGasEXTCODECOPY | ||||
ErrorOutOfGasSLOAD | ||||
ErrorOutOfGasSSTORE | ||||
ErrorOutOfGasCALL | WIP https://github.com/privacy-scaling-explorations/zkevm-specs/pull/287 #827 | |||
ErrorOutOfGasCALLCODE | ||||
ErrorOutOfGasDELEGATECALL | ||||
ErrorOutOfGasCREATE2 | ||||
ErrorOutOfGasSTATICCALL | ||||
ErrorOutOfGasSELFDESTRUCT |
In https://github.com/appliedzkp/zkevm-circuits/issues/83 we kept track of opcode implementations in the bus-mapping, but I often missed quickly knowing the status of the opcode specs and circuit implementation. I've extended the list from #83 into a table to include the spec and circuit status.
With this issue, https://github.com/appliedzkp/zkevm-circuits/issues/83 becomes redundant. @CPerezz do you think we can close the old issue? Or alternative rename the old issue and update it with this table (I didn't do that because I didn't want to confuse anyone)
Ye! Makes sense to me! Thanks for putting some effort on improve the traceability of this!
CODESIZE
is in progress:
- [x] Specs: https://github.com/appliedzkp/zkevm-specs/pull/191
- [x] Circuit and Bus Mapping: https://github.com/appliedzkp/zkevm-circuits/pull/483
We currently have SHL
, SHR
, SDIV
, and SMOD
WIP.
I did an update on the status of completion on 2023-04-28. Great work for all the progress :)
Updated Error states
table and created corresponding issues for un-implemented error states on July 6, 2023.
Updated the status of completion on Aug 9, 2023.
All the specs were done, except ErrorOutOfGasCREATE2
is still under review. Still have 7 circuits not finished.
Updated on Sep. 19, 2023 All the error states were done except one minor case (GasUintOverflow in invalid txs)!
oh btw i can upstream better bus-mapping handling of self-destruct. It helps build correct statedb. Soon.
https://github.com/scroll-tech/zkevm-circuits/blob/2723b82fb5d538d6fcc7b2dd0d84d3df8818499f/bus-mapping/src/evm/opcodes.rs#L499. it is battle tested with mainnet.
@lispc https://github.com/scroll-tech/zkevm-circuits/blob/2723b82fb5d538d6fcc7b2dd0d84d3df8818499f/bus-mapping/src/evm/opcodes.rs#L499 Looks fantastic! It would be great to upstream it. Update: #1612 is the issue
Updated on Dec. 18, 2023.
After we decided not to implement ErrorGasUintOverflow
in invalid tx
case, then all error states and opcodes listed were addressed!!