This repository was archived by the owner on Apr 18, 2025. It is now read-only.
OOG error Circuit for EXP#323
Closed
silathdiir wants to merge 9 commits into
Closed
Conversation
b6625fd to
6c34f7a
Compare
### Description The `CREATE2` input length and `RLC(input)` were not tested during the #1164 merge. This PR adds and enables a test for CREATE2 specific `input_len` and `input_rlc` calculation. ### Type of change - [ ] Bug fix (non-breaking change which fixes an issue) - [x] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] This change requires a documentation update ### How Has This Been Tested? The helper container can test both `CREATE` and `CREATE2` inputs (length and `RLC(input_bytes)`). These inputs are then used as inputs to do a lookup to the Keccak table. ### Related PRs - #1164 - #1140 (needs rebasing after this is merged) --------- Co-authored-by: adria0.eth <5526331+adria0@users.noreply.github.com>
### Description Constrain SSTORE with gas reentrancy sentry. Gas reentrancy sentry could be referenced in [this go-ethereum code](https://github.com/ethereum/go-ethereum/blob/master/core/vm/operations_acl.go#L30). ### Issue Link Close privacy-ethereum#1214 ### Type of change - [X] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] This change requires a documentation update ### Contents - [_item_] ### Rationale [_design decisions and extended information_] ### How Has This Been Tested? Could be tested with previous SSTORE gadget test cases. <hr> ## How to fill a PR description Please give a concise description of your PR. The target readers could be future developers, reviewers, and auditors. By reading your description, they should easily understand the changes proposed in this pull request. MUST: Reference the issue to resolve ### Single responsability Is RECOMMENDED to create single responsibility commits, but not mandatory. Anyway, you MUST enumerate the changes in a unitary way, e.g. ``` This PR contains: - Cleanup of xxxx, yyyy - Changed xxxx to yyyy in order to bla bla - Added xxxx function to ... - Refactored .... ``` ### Design choices RECOMMENDED to: - What types of design choices did you face? - What decisions you have made? - Any valuable information that could help reviewers to think critically
Close privacy-ethereum#1136 Add `shf_lt256` to constrain `shift < 256 when divisor != 0 or shift >= 256 when divisor == 0`. --------- Co-authored-by: Zhang Zhuo <mycinbrin@gmail.com>
a6d1871 to
301bc12
Compare
This PR aims to enhance the reporting functionality for github actions-triggered circuit benchmarks. Results are saved in postgresql and accessible via grafana - [ ] Bug fix (non-breaking change which fixes an issue) - [x] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] This change requires a documentation update - New python module introduced for results processing and saving. - getSysStats.sh will now only display the test timers - New action step: Calculate Benchmark Result prints a grafana url linking to detailed test results and downloadable prover log file - New sysstat collection script (sadf.sh) now handles statistics for test that span beyond 00.00 hrs - execBench.sh : Added missing bench tests (bytecode, exp, copy, pi) --------- Co-authored-by: Chih Cheng Liang <chihchengliang@gmail.com>
### Description feat: Add copy circuit stats by exec state like the ones we had for evm circuit and state circuit. refactor: move duplicate code used to get circuit stats by exec state into a new module, which also contains a helper struct to draw formatted tables feat: add the `warn-unimplemented` fature in `zkevm-circuits` so that it can be enabled/disabled when using the zkevm-circuits crate. ### Type of change - [ ] Bug fix (non-breaking change which fixes an issue) - [x] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] This change requires a documentation update ### Contents Here are the stats for the Copy Circuit | state | opcode | h | g | h/g | | -------------- | -------------- | ---- | ----- | ------ | | CALLDATACOPY | CALLDATACOPY | 8192 | 803 | 10.202 | | CODECOPY | CODECOPY | 8192 | 803 | 10.202 | | EXTCODECOPY | EXTCODECOPY | 8192 | 900 | 9.102 | | RETURNDATACOPY | RETURNDATACOPY | 8192 | 803 | 10.202 | | LOG | LOG0 | 8192 | 33559 | 0.244 | | LOG | LOG1 | 8192 | 33934 | 0.241 | | LOG | LOG2 | 8192 | 34309 | 0.239 | | LOG | LOG3 | 8192 | 34684 | 0.236 | | LOG | LOG4 | 8192 | 35059 | 0.234 | | RETURN_REVERT | RETURN | 8192 | 416 | 19.692 | | RETURN_REVERT | REVERT | 8192 | 416 | 19.692 | <details><summary>Updated stats for EVM Circuit</summary> | state | opcode | h | g | h/g | | -------------- | -------------- | -- | ----- | ----- | | STOP | STOP | 2 | 0 | inf | | ADD_SUB | ADD | 5 | 3 | 1.667 | | ADD_SUB | SUB | 5 | 3 | 1.667 | | MUL_DIV_MOD | MUL | 8 | 5 | 1.600 | | MUL_DIV_MOD | DIV | 8 | 5 | 1.600 | | MUL_DIV_MOD | MOD | 8 | 5 | 1.600 | | SDIV_SMOD | SDIV | 19 | 5 | 3.800 | | SDIV_SMOD | SMOD | 19 | 5 | 3.800 | | SHL_SHR | SHL | 10 | 3 | 3.333 | | SHL_SHR | SHR | 10 | 3 | 3.333 | | ADDMOD | ADDMOD | 17 | 8 | 2.125 | | MULMOD | MULMOD | 20 | 8 | 2.500 | | EXP | EXP | 7 | 60 | 0.117 | | SIGNEXTEND | SIGNEXTEND | 3 | 5 | 0.600 | | CMP | LT | 5 | 3 | 1.667 | | CMP | GT | 5 | 3 | 1.667 | | CMP | EQ | 5 | 3 | 1.667 | | SCMP | SLT | 5 | 3 | 1.667 | | SCMP | SGT | 5 | 3 | 1.667 | | ISZERO | ISZERO | 2 | 3 | 0.667 | | BITWISE | AND | 5 | 3 | 1.667 | | BITWISE | OR | 5 | 3 | 1.667 | | BITWISE | XOR | 5 | 3 | 1.667 | | NOT | NOT | 5 | 3 | 1.667 | | BYTE | BYTE | 3 | 3 | 1.000 | | SAR | SAR | 10 | 3 | 3.333 | | SHA3 | SHA3 | 4 | 57 | 0.070 | | ADDRESS | ADDRESS | 2 | 2 | 1.000 | | BALANCE | BALANCE | 2 | 2600 | 0.001 | | ORIGIN | ORIGIN | 2 | 2 | 1.000 | | CALLER | CALLER | 2 | 2 | 1.000 | | CALLVALUE | CALLVALUE | 1 | 2 | 0.500 | | CALLDATALOAD | CALLDATALOAD | 8 | 3 | 2.667 | | CALLDATASIZE | CALLDATASIZE | 1 | 2 | 0.500 | | CALLDATACOPY | CALLDATACOPY | 3 | 21 | 0.143 | | CODESIZE | CODESIZE | 1 | 2 | 0.500 | | CODECOPY | CODECOPY | 3 | 21 | 0.143 | | GASPRICE | GASPRICE | 1 | 2 | 0.500 | | EXTCODESIZE | EXTCODESIZE | 2 | 2600 | 0.001 | | EXTCODECOPY | EXTCODECOPY | 4 | 2612 | 0.002 | | RETURNDATASIZE | RETURNDATASIZE | 1 | 2 | 0.500 | | RETURNDATACOPY | RETURNDATACOPY | 3 | 9 | 0.333 | | EXTCODEHASH | EXTCODEHASH | 2 | 2600 | 0.001 | | BLOCKHASH | BLOCKHASH | 3 | 20 | 0.150 | | BLOCKCTXU64 | TIMESTAMP | 1 | 2 | 0.500 | | BLOCKCTXU64 | NUMBER | 1 | 2 | 0.500 | | BLOCKCTXU64 | GASLIMIT | 1 | 2 | 0.500 | | BLOCKCTXU160 | COINBASE | 2 | 2 | 1.000 | | BLOCKCTXU256 | DIFFICULTY | 2 | 2 | 1.000 | | BLOCKCTXU256 | BASEFEE | 2 | 2 | 1.000 | | CHAINID | CHAINID | 1 | 2 | 0.500 | | SELFBALANCE | SELFBALANCE | 1 | 5 | 0.200 | | POP | POP | 1 | 2 | 0.500 | | MEMORY | MLOAD | 5 | 15 | 0.333 | | MEMORY | MSTORE | 5 | 15 | 0.333 | | MEMORY | MSTORE8 | 5 | 12 | 0.417 | | SLOAD | SLOAD | 2 | 2100 | 0.001 | | SSTORE | SSTORE | 12 | 22100 | 0.001 | | JUMP | JUMP | 1 | 8 | 0.125 | | JUMPI | JUMPI | 3 | 10 | 0.300 | | PC | PC | 1 | 2 | 0.500 | | MSIZE | MSIZE | 1 | 2 | 0.500 | | GAS | GAS | 1 | 2 | 0.500 | | JUMPDEST | JUMPDEST | 1 | 1 | 1.000 | | PUSH | PUSH1 | 9 | 3 | 3.000 | | PUSH | PUSH2 | 9 | 3 | 3.000 | | PUSH | PUSH3 | 9 | 3 | 3.000 | | PUSH | PUSH4 | 9 | 3 | 3.000 | | PUSH | PUSH5 | 9 | 3 | 3.000 | | PUSH | PUSH6 | 9 | 3 | 3.000 | | PUSH | PUSH7 | 9 | 3 | 3.000 | | PUSH | PUSH8 | 9 | 3 | 3.000 | | PUSH | PUSH9 | 9 | 3 | 3.000 | | PUSH | PUSH10 | 9 | 3 | 3.000 | | PUSH | PUSH11 | 9 | 3 | 3.000 | | PUSH | PUSH12 | 9 | 3 | 3.000 | | PUSH | PUSH13 | 9 | 3 | 3.000 | | PUSH | PUSH14 | 9 | 3 | 3.000 | | PUSH | PUSH15 | 9 | 3 | 3.000 | | PUSH | PUSH16 | 9 | 3 | 3.000 | | PUSH | PUSH17 | 9 | 3 | 3.000 | | PUSH | PUSH18 | 9 | 3 | 3.000 | | PUSH | PUSH19 | 9 | 3 | 3.000 | | PUSH | PUSH20 | 9 | 3 | 3.000 | | PUSH | PUSH21 | 9 | 3 | 3.000 | | PUSH | PUSH22 | 9 | 3 | 3.000 | | PUSH | PUSH23 | 9 | 3 | 3.000 | | PUSH | PUSH24 | 9 | 3 | 3.000 | | PUSH | PUSH25 | 9 | 3 | 3.000 | | PUSH | PUSH26 | 9 | 3 | 3.000 | | PUSH | PUSH27 | 9 | 3 | 3.000 | | PUSH | PUSH28 | 9 | 3 | 3.000 | | PUSH | PUSH29 | 9 | 3 | 3.000 | | PUSH | PUSH30 | 9 | 3 | 3.000 | | PUSH | PUSH31 | 9 | 3 | 3.000 | | PUSH | PUSH32 | 9 | 3 | 3.000 | | DUP | DUP1 | 1 | 3 | 0.333 | | DUP | DUP2 | 1 | 3 | 0.333 | | DUP | DUP3 | 1 | 3 | 0.333 | | DUP | DUP4 | 1 | 3 | 0.333 | | DUP | DUP5 | 1 | 3 | 0.333 | | DUP | DUP6 | 1 | 3 | 0.333 | | DUP | DUP7 | 1 | 3 | 0.333 | | DUP | DUP8 | 1 | 3 | 0.333 | | DUP | DUP9 | 1 | 3 | 0.333 | | DUP | DUP10 | 1 | 3 | 0.333 | | DUP | DUP11 | 1 | 3 | 0.333 | | DUP | DUP12 | 1 | 3 | 0.333 | | DUP | DUP13 | 1 | 3 | 0.333 | | DUP | DUP14 | 1 | 3 | 0.333 | | DUP | DUP15 | 1 | 3 | 0.333 | | DUP | DUP16 | 1 | 3 | 0.333 | | SWAP | SWAP1 | 1 | 3 | 0.333 | | SWAP | SWAP2 | 1 | 3 | 0.333 | | SWAP | SWAP3 | 1 | 3 | 0.333 | | SWAP | SWAP4 | 1 | 3 | 0.333 | | SWAP | SWAP5 | 1 | 3 | 0.333 | | SWAP | SWAP6 | 1 | 3 | 0.333 | | SWAP | SWAP7 | 1 | 3 | 0.333 | | SWAP | SWAP8 | 1 | 3 | 0.333 | | SWAP | SWAP9 | 1 | 3 | 0.333 | | SWAP | SWAP10 | 1 | 3 | 0.333 | | SWAP | SWAP11 | 1 | 3 | 0.333 | | SWAP | SWAP12 | 1 | 3 | 0.333 | | SWAP | SWAP13 | 1 | 3 | 0.333 | | SWAP | SWAP14 | 1 | 3 | 0.333 | | SWAP | SWAP15 | 1 | 3 | 0.333 | | SWAP | SWAP16 | 1 | 3 | 0.333 | | LOG | LOG0 | 2 | 902 | 0.002 | | LOG | LOG1 | 2 | 1277 | 0.002 | | LOG | LOG2 | 2 | 1652 | 0.001 | | LOG | LOG3 | 2 | 2027 | 0.001 | | LOG | LOG4 | 2 | 2402 | 0.001 | | CALL_OP | CALL | 21 | 36686 | 0.001 | | CALL_OP | CALLCODE | 21 | 11686 | 0.002 | | CALL_OP | DELEGATECALL | 21 | 2689 | 0.008 | | CALL_OP | STATICCALL | 21 | 2689 | 0.008 | | RETURN_REVERT | RETURN | 3 | 15 | 0.200 | | RETURN_REVERT | REVERT | 3 | 15 | 0.200 | </details> <details><summary>Updated stats for State Circuit</summary> | state | opcode | h | g | h/g | | -------------- | -------------- | ---- | ----- | ------ | | STOP | STOP | 13 | 0 | inf | | ADD_SUB | ADD | 3 | 3 | 1.000 | | ADD_SUB | SUB | 3 | 3 | 1.000 | | MUL_DIV_MOD | MUL | 3 | 5 | 0.600 | | MUL_DIV_MOD | DIV | 3 | 5 | 0.600 | | MUL_DIV_MOD | MOD | 3 | 5 | 0.600 | | SDIV_SMOD | SDIV | 3 | 5 | 0.600 | | SDIV_SMOD | SMOD | 3 | 5 | 0.600 | | SHL_SHR | SHL | 3 | 3 | 1.000 | | SHL_SHR | SHR | 3 | 3 | 1.000 | | ADDMOD | ADDMOD | 4 | 8 | 0.500 | | MULMOD | MULMOD | 4 | 8 | 0.500 | | EXP | EXP | 3 | 60 | 0.050 | | SIGNEXTEND | SIGNEXTEND | 3 | 5 | 0.600 | | CMP | LT | 3 | 3 | 1.000 | | CMP | GT | 3 | 3 | 1.000 | | CMP | EQ | 3 | 3 | 1.000 | | SCMP | SLT | 3 | 3 | 1.000 | | SCMP | SGT | 3 | 3 | 1.000 | | ISZERO | ISZERO | 2 | 3 | 0.667 | | BITWISE | AND | 3 | 3 | 1.000 | | BITWISE | OR | 3 | 3 | 1.000 | | BITWISE | XOR | 3 | 3 | 1.000 | | NOT | NOT | 2 | 3 | 0.667 | | BYTE | BYTE | 3 | 3 | 1.000 | | SAR | SAR | 3 | 3 | 1.000 | | SHA3 | SHA3 | 4099 | 1214 | 3.376 | | ADDRESS | ADDRESS | 2 | 2 | 1.000 | | BALANCE | BALANCE | 7 | 2600 | 0.003 | | ORIGIN | ORIGIN | 2 | 2 | 1.000 | | CALLER | CALLER | 2 | 2 | 1.000 | | CALLVALUE | CALLVALUE | 2 | 2 | 1.000 | | CALLDATALOAD | CALLDATALOAD | 5 | 3 | 1.667 | | CALLDATASIZE | CALLDATASIZE | 2 | 2 | 1.000 | | CALLDATACOPY | CALLDATACOPY | 4102 | 803 | 5.108 | | CODESIZE | CODESIZE | 1 | 2 | 0.500 | | CODECOPY | CODECOPY | 4099 | 803 | 5.105 | | GASPRICE | GASPRICE | 2 | 2 | 1.000 | | EXTCODESIZE | EXTCODESIZE | 7 | 2600 | 0.003 | | EXTCODECOPY | EXTCODECOPY | 4105 | 900 | 4.561 | | RETURNDATASIZE | RETURNDATASIZE | 2 | 2 | 1.000 | | RETURNDATACOPY | RETURNDATACOPY | 8198 | 803 | 10.209 | | EXTCODEHASH | EXTCODEHASH | 7 | 2600 | 0.003 | | BLOCKHASH | BLOCKHASH | 2 | 20 | 0.100 | | BLOCKCTXU64 | TIMESTAMP | 1 | 2 | 0.500 | | BLOCKCTXU64 | NUMBER | 1 | 2 | 0.500 | | BLOCKCTXU64 | GASLIMIT | 1 | 2 | 0.500 | | BLOCKCTXU160 | COINBASE | 1 | 2 | 0.500 | | BLOCKCTXU256 | DIFFICULTY | 1 | 2 | 0.500 | | BLOCKCTXU256 | BASEFEE | 1 | 2 | 0.500 | | CHAINID | CHAINID | 1 | 2 | 0.500 | | SELFBALANCE | SELFBALANCE | 3 | 5 | 0.600 | | POP | POP | 1 | 2 | 0.500 | | MEMORY | MLOAD | 34 | 15 | 2.267 | | MEMORY | MSTORE | 34 | 15 | 2.267 | | MEMORY | MSTORE8 | 3 | 12 | 0.250 | | SLOAD | SLOAD | 8 | 2100 | 0.004 | | SSTORE | SSTORE | 10 | 22100 | 0.000 | | JUMP | JUMP | 16 | 8 | 2.000 | | JUMPI | JUMPI | 17 | 10 | 1.700 | | PC | PC | 1 | 2 | 0.500 | | MSIZE | MSIZE | 1 | 2 | 0.500 | | GAS | GAS | 1 | 2 | 0.500 | | JUMPDEST | JUMPDEST | 0 | 1 | 0.000 | | PUSH | PUSH1 | 1 | 3 | 0.333 | | PUSH | PUSH2 | 1 | 3 | 0.333 | | PUSH | PUSH3 | 1 | 3 | 0.333 | | PUSH | PUSH4 | 1 | 3 | 0.333 | | PUSH | PUSH5 | 1 | 3 | 0.333 | | PUSH | PUSH6 | 1 | 3 | 0.333 | | PUSH | PUSH7 | 1 | 3 | 0.333 | | PUSH | PUSH8 | 1 | 3 | 0.333 | | PUSH | PUSH9 | 1 | 3 | 0.333 | | PUSH | PUSH10 | 1 | 3 | 0.333 | | PUSH | PUSH11 | 1 | 3 | 0.333 | | PUSH | PUSH12 | 1 | 3 | 0.333 | | PUSH | PUSH13 | 1 | 3 | 0.333 | | PUSH | PUSH14 | 1 | 3 | 0.333 | | PUSH | PUSH15 | 1 | 3 | 0.333 | | PUSH | PUSH16 | 1 | 3 | 0.333 | | PUSH | PUSH17 | 1 | 3 | 0.333 | | PUSH | PUSH18 | 1 | 3 | 0.333 | | PUSH | PUSH19 | 1 | 3 | 0.333 | | PUSH | PUSH20 | 1 | 3 | 0.333 | | PUSH | PUSH21 | 1 | 3 | 0.333 | | PUSH | PUSH22 | 1 | 3 | 0.333 | | PUSH | PUSH23 | 1 | 3 | 0.333 | | PUSH | PUSH24 | 1 | 3 | 0.333 | | PUSH | PUSH25 | 1 | 3 | 0.333 | | PUSH | PUSH26 | 1 | 3 | 0.333 | | PUSH | PUSH27 | 1 | 3 | 0.333 | | PUSH | PUSH28 | 1 | 3 | 0.333 | | PUSH | PUSH29 | 1 | 3 | 0.333 | | PUSH | PUSH30 | 1 | 3 | 0.333 | | PUSH | PUSH31 | 1 | 3 | 0.333 | | PUSH | PUSH32 | 1 | 3 | 0.333 | | DUP | DUP1 | 2 | 3 | 0.667 | | DUP | DUP2 | 2 | 3 | 0.667 | | DUP | DUP3 | 2 | 3 | 0.667 | | DUP | DUP4 | 2 | 3 | 0.667 | | DUP | DUP5 | 2 | 3 | 0.667 | | DUP | DUP6 | 2 | 3 | 0.667 | | DUP | DUP7 | 2 | 3 | 0.667 | | DUP | DUP8 | 2 | 3 | 0.667 | | DUP | DUP9 | 2 | 3 | 0.667 | | DUP | DUP10 | 2 | 3 | 0.667 | | DUP | DUP11 | 2 | 3 | 0.667 | | DUP | DUP12 | 2 | 3 | 0.667 | | DUP | DUP13 | 2 | 3 | 0.667 | | DUP | DUP14 | 2 | 3 | 0.667 | | DUP | DUP15 | 2 | 3 | 0.667 | | DUP | DUP16 | 2 | 3 | 0.667 | | SWAP | SWAP1 | 4 | 3 | 1.333 | | SWAP | SWAP2 | 4 | 3 | 1.333 | | SWAP | SWAP3 | 4 | 3 | 1.333 | | SWAP | SWAP4 | 4 | 3 | 1.333 | | SWAP | SWAP5 | 4 | 3 | 1.333 | | SWAP | SWAP6 | 4 | 3 | 1.333 | | SWAP | SWAP7 | 4 | 3 | 1.333 | | SWAP | SWAP8 | 4 | 3 | 1.333 | | SWAP | SWAP9 | 4 | 3 | 1.333 | | SWAP | SWAP10 | 4 | 3 | 1.333 | | SWAP | SWAP11 | 4 | 3 | 1.333 | | SWAP | SWAP12 | 4 | 3 | 1.333 | | SWAP | SWAP13 | 4 | 3 | 1.333 | | SWAP | SWAP14 | 4 | 3 | 1.333 | | SWAP | SWAP15 | 4 | 3 | 1.333 | | SWAP | SWAP16 | 4 | 3 | 1.333 | | LOG | LOG0 | 8199 | 33559 | 0.244 | | LOG | LOG1 | 8201 | 33934 | 0.242 | | LOG | LOG2 | 8203 | 34309 | 0.239 | | LOG | LOG3 | 8205 | 34684 | 0.237 | | LOG | LOG4 | 8207 | 35059 | 0.234 | | CALL_OP | CALL | 24 | 36686 | 0.001 | | CALL_OP | CALLCODE | 22 | 11686 | 0.002 | | CALL_OP | DELEGATECALL | 23 | 2689 | 0.009 | | CALL_OP | STATICCALL | 21 | 2689 | 0.008 | | RETURN_REVERT | RETURN | 8212 | 416 | 19.740 | | RETURN_REVERT | REVERT | 8213 | 416 | 19.743 | </details>
#1163) Close privacy-ethereum#1162 ### Summary Integrate [skip-duplicate-actions](https://github.com/marketplace/actions/skip-duplicate-actions) for below CI features: 1. Cancel workflow runs of outdated commits - [cancel_others](https://github.com/marketplace/actions/skip-duplicate-actions#cancel_others). e.g. A new commit is added when the CI tasks of old commit has not finished. With this fix, the old CI tasks should be cancelled immediately, the new CI tasks should start to run. 2. Skip workflow runs of same content - [same_content_newer](https://github.com/marketplace/actions/skip-duplicate-actions#skip-concurrent-workflow-runs). If the same workflow is running on the exact same content (of files), the new CI runs are skipped. 3. No skip for event `ready_for_review`. Special for zkevm-circuits, CI of `draft` PRs are not run (configured as [this code](https://github.com/privacy-scaling-explorations/zkevm-circuits/blob/main/.github/workflows/ci.yml#L15)). With the above fix `2`, CI tasks are skipped (for same content) and not exactly run when draft. So CI should always run for ready_for_review event. Reference #265 and #266.
Close privacy-ethereum#1154 ### Summary 1. Update `valid_stack_ptr_range` function to `invalid_stack_ptrs`. It returns the invalid stack pointers of specified opcode. 2. Add Enum `ResponsibleOp` and update `ExecutionState::responsible_opcodes` to return a vector of ResponsibleOp. 3. Update `FixedTableTag.ResponsibleOpcode` build for invalid stack pointers, and delete `FixedTableTag.OpcodeStack`. 4. Update `ErrorStack` circuit with `ResponsibleOpcode` lookup.
### Description Boolean checks were missing for a step's `is_create` and `is_root` fields. ### Issue Link Issue originated from Scroll's fork: #325 ### Type of change - [x] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) - [ ] This change requires a documentation update
DreamWuGit
reviewed
Feb 22, 2023
| let opcode = step.opcode.unwrap(); | ||
| let [base, exponent] = [0, 1].map(|idx| block.rws[step.rw_indices[idx]].stack_value()); | ||
|
|
||
| let gas_cost = gas_cost_value(exponent); |
There was a problem hiding this comment.
I think we can usestep.gas_cost directly to save one method.
DreamWuGit
reviewed
Feb 22, 2023
| } | ||
| } | ||
|
|
||
| fn gas_cost_value(exponent: U256) -> u64 { |
DreamWuGit
reviewed
Feb 22, 2023
|
|
||
| // Finally we build an expression for the dynamic gas cost. | ||
| let dynamic_gas_cost = 50.expr() * exponent_byte_size.byte_size(); | ||
| let dynamic_gas_cost = 50.expr() * exponent_byte_size.byte_size_expr(); |
There was a problem hiding this comment.
replace 50 with OpcodeId::EXP.constant_gas_cost().0 ?
Author
There was a problem hiding this comment.
OpcodeId::EXP.constant_gas_cost().0 = 10, it is static_gas.
Added a new constant GasCost::EXP_BYTE_TIMES = 50 (and replaced in both ExpGadget and OogExpGadget).
And add the below comments for gas cost calculation.
gas_cost = static_gas + dynamic_gas
static_gas = 10
dynamic_gas = 50 * exponent_byte_size
e66e3d0 to
0cfd5dd
Compare
Author
|
Thanks for @roynalnaruto and @DreamWuGit 's code review. Moved to upstream privacy-ethereum#1232. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Spec Markdown PR scroll-tech/zkevm-specs#58
Summary
1. Add and exportbyte_size_valuefunction fromByteSizeGadget(which is also used to calculate gas cost inErrorOOGExpGadget). And rename originalbyte_sizetobyte_size_expr.ErrorOOGExpGadgetto handle OOG error ofEXPopcode.