zkevm-circuits
zkevm-circuits copied to clipboard
Add units tests for StackOnlyOp in bus-mapping
There are a lot of stack-only opcodes in bus-mapping. Meanwhile, the unit tests are few.
As @CPerezz mentioned in #939. Some StackOnly opcodes, like COINBASE, have been tested associated. So, we have to specify the stack-only opcodes which need unit tests first.
I specify them by checking whether they have related Gadget in evm-circuit.
-
ones associated with Gadget They don't need the unit tests for them in bus-mapping. If they did, better to remove.
-
ones non-associated with Gadget, we'd better add unit tests for them in bus-mapping.
The stack-only-opcode needs unit tests:
- [x] 0x05 SDIV
- [x] 0x06 MOD
- [x] 0x07 SMOD
- [x] 0x11 GT
- [x] 0x10 LT
- [x] 0x12 SLT
- [x] 0x13 SGT
- [x] 0x16 AND
- [x] 0x17 OR
- [x] 0x18 XOR
- [x] 0x19 NOT
- [x] 0x44 DIFFICULTY
- [x] 0x45 GASLIMIT
- [x] 0x48 BASEFEE
meanwhile, I'd like to display the Gadget-associated stack-only-opcode.
0x01 ADD 0x02 MUL 0x03 SUB 0x04 DIV 0x08 ADDMOD 0x09 MULMOD 0x0b SIGNEXTEND 0x14 EQ 0x15 ISZERO 0x1a BYTE 0x1B SHL 0x1C SHR 0x1D SAR 0x40 BLOCKHASH 0x41 COINBASE 0x42 TIMESTAMP 0x43 NUMBER 0x44 PREVRANDAO 0x46 CHAINID 0x50 POP 0x56 JUMP 0x57 JUMPI 0x58 PC 0x59 MSIZE 0x5A GAS
I'd suggest you to just include in the table the ones that need testing. Also, specify in the issue that you are referring to bus-mapping tests only and not circuit ones.
@CPerezz Thanks for your suggestion. I've edited them.
Thanks @ChengYueJia !! And thanks for picking up this work BTW!! Just ping me when you are done and want a review or if you need some help with anything!
@CPerezz Hi, there are done. please have a view.
Cause the pr #939 has been merged, I'll close this issue.