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

Meta: Opcode spec + implementation status #477

Closed
ed255 opened this issue Apr 27, 2022 · 11 comments
Closed

Meta: Opcode spec + implementation status #477

ed255 opened this issue Apr 27, 2022 · 11 comments
Labels
crate-bus-mapping Issues related to the bus-mapping workspace member crate-zkevm-circuits Issues related to the zkevm-circuits workspace member T-opcode Type: opcode-related and focused PR/Issue

Comments

@ed255
Copy link
Member

ed255 commented Apr 27, 2022

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 x x SAR privacy-scaling-explorations/zkevm-specs#263 #727 #1036
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 x REVERT privacy-scaling-explorations/zkevm-specs#317
SHA3 x x x SHA3
ADDRESS x x x ADDRESS
BALANCE x x x BALANCE #683
ORIGIN x x x ORIGIN
CALLER x x x CALLER
CALLVALUE x x x CALLVALUE
GASPRICE x x x GASPRICE
EXTCODESIZE x x x EXTCODESIZE #993
EXTCODECOPY x x x EXTCODECOPY #720
EXTCODEHASH x x x EXTCODEHASH
RETURNDATASIZE x x x RETURNDATASIZE
RETURNDATACOPY x x x RETURNDATACOPY #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 x x x CREATE privacy-scaling-explorations/zkevm-specs#371 #1356 #1357 #1358
CREATE2 x x x CREATE2 privacy-scaling-explorations/zkevm-specs#371 #1356 #1357 #1358
CALL x x x CALL #278
CALLCODE x x x CALLCODE #932
DELEGATECALL x x x DELEGATECALL #847
STATICCALL x x x STATICCALL #801
SELFDESTRUCT SELFDESTRUCT (no intent to implement this)

Error states

There are constant gas cases and dynamic gas cases. See #1305

spec circuit bus-mapping ExecutionState Notes
x x x ErrorInvalidOpcode #1138
x x x ErrorStackOverflow privacy-scaling-explorations/zkevm-specs#301 #873
x x x ErrorStackUnderflow privacy-scaling-explorations/zkevm-specs#301 #873
x x x ErrorWriteProtection privacy-scaling-explorations/zkevm-specs#441, privacy-scaling-explorations/zkevm-specs#365 #1001
x x x ErrorDepth #1312 (CALL) #1430 (CREATE)
x x x ErrorInsufficientBalance CALL: privacy-scaling-explorations/zkevm-specs#442 #998 CREATE: privacy-scaling-explorations/zkevm-specs#416 #1425 #1430
x x x ErrorContractAddressCollision privacy-scaling-explorations/zkevm-specs#443 #1309
x x x ErrorInvalidCreationCode privacy-scaling-explorations/zkevm-specs#400 privacy-scaling-explorations/zkevm-specs#434 #1291
x x x ErrorMaxCodeSizeExceeded privacy-scaling-explorations/zkevm-specs#393 privacy-scaling-explorations/zkevm-specs#445 #1259
x x x ErrorInvalidJump privacy-scaling-explorations/zkevm-specs#297 #841
x x x ErrorReturnDataOutOfBound privacy-scaling-explorations/zkevm-specs#446 #1017
x x x ErrorOutOfGasConstant privacy-scaling-explorations/zkevm-specs#266
x x x ErrorOutOfGasStaticMemoryExpansion #312 #398 privacy-scaling-explorations/zkevm-specs#455 #1518
x x x ErrorOutOfGasDynamicMemoryExpansion #398 privacy-scaling-explorations/zkevm-specs#456 #1519
x x x ErrorOutOfGasMemoryCopy privacy-scaling-explorations/zkevm-specs#414 privacy-scaling-explorations/zkevm-specs#397 #1288
x x x ErrorOutOfGasAccountAccess privacy-scaling-explorations/zkevm-specs#447 #1349
x x x ErrorOutOfGasCodeStore privacy-scaling-explorations/zkevm-specs#393 privacy-scaling-explorations/zkevm-specs#445 #1259
x x x ErrorOutOfGasLOG privacy-scaling-explorations/zkevm-specs#448 #1134
x x x ErrorOutOfGasEXP privacy-scaling-explorations/zkevm-specs#449 #1231
x x x ErrorOutOfGasSHA3 privacy-scaling-explorations/zkevm-specs#450 #1520
x x x ErrorOutOfGasEXTCODECOPY privacy-scaling-explorations/zkevm-specs#451 #1521
x x x ErrorOutOfGasSLOAD #1119 privacy-scaling-explorations/zkevm-specs#382 privacy-scaling-explorations/zkevm-specs#452
x x x ErrorOutOfGasSSTORE #1119 privacy-scaling-explorations/zkevm-specs#382 privacy-scaling-explorations/zkevm-specs#453
x x x ErrorOutOfGasCALL privacy-scaling-explorations/zkevm-specs#287 #827
x x x ErrorOutOfGasCALLCODE #1127 privacy-scaling-explorations/zkevm-specs#368
x x x ErrorOutOfGasDELEGATECALL #1127 privacy-scaling-explorations/zkevm-specs#368
x x x ErrorOutOfGasSTATICCALL #1127 privacy-scaling-explorations/zkevm-specs#368
x x x ErrorOutOfGasCREATE2 privacy-scaling-explorations/zkevm-specs#454 #1522
x - - ErrorGasUintOverflow privacy-scaling-explorations/zkevm-specs#436 privacy-scaling-explorations/zkevm-specs#421 #1526 #1564
ErrorOutOfGasSELFDESTRUCT
@ed255 ed255 added crate-bus-mapping Issues related to the bus-mapping workspace member crate-zkevm-circuits Issues related to the zkevm-circuits workspace member T-opcode Type: opcode-related and focused PR/Issue labels Apr 27, 2022
@ed255
Copy link
Member Author

ed255 commented Apr 27, 2022

In #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, #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)

@CPerezz
Copy link
Member

CPerezz commented Apr 27, 2022

Ye! Makes sense to me!
Thanks for putting some effort on improve the traceability of this!

@roynalnaruto
Copy link
Collaborator

roynalnaruto commented May 3, 2022

CODESIZE is in progress:

@icemelon
Copy link
Collaborator

icemelon commented May 5, 2022

We currently have SHL, SHR, SDIV, and SMOD WIP.

@ChihChengLiang
Copy link
Collaborator

I did an update on the status of completion on 2023-04-28. Great work for all the progress :)

@KimiWu123
Copy link
Contributor

Updated Error states table and created corresponding issues for un-implemented error states on July 6, 2023.

@KimiWu123
Copy link
Contributor

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.

@KimiWu123
Copy link
Contributor

Updated on Sep. 19, 2023
All the error states were done except one minor case (GasUintOverflow in invalid txs)!

@lispc
Copy link
Collaborator

lispc commented Sep 19, 2023

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.

@ChihChengLiang
Copy link
Collaborator

ChihChengLiang commented Sep 19, 2023

@KimiWu123
Copy link
Contributor

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!!

@ChihChengLiang ChihChengLiang unpinned this issue Dec 18, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
crate-bus-mapping Issues related to the bus-mapping workspace member crate-zkevm-circuits Issues related to the zkevm-circuits workspace member T-opcode Type: opcode-related and focused PR/Issue
Projects
Status: Done
Development

No branches or pull requests

7 participants