From 7bb538406b84b94811fba22b3c1cc5554b766882 Mon Sep 17 00:00:00 2001 From: krlosMata Date: Fri, 13 Jan 2023 16:57:52 +0100 Subject: [PATCH] safe range max counters --- main/constants.zkasm | 23 ++++++--- main/opcodes/arithmetic.zkasm | 40 ++++++---------- main/opcodes/block.zkasm | 16 +++---- main/opcodes/calldata-returndata-code.zkasm | 31 +++++------- main/opcodes/comparison.zkasm | 38 +++++++-------- main/opcodes/context-information.zkasm | 16 +++---- main/opcodes/create-terminate-context.zkasm | 53 ++++++++------------- main/opcodes/crypto.zkasm | 8 +--- main/opcodes/flow-control.zkasm | 12 ++--- main/opcodes/logs.zkasm | 4 +- main/opcodes/stack-operations.zkasm | 10 ++-- main/opcodes/storage-memory.zkasm | 27 +++-------- 12 files changed, 116 insertions(+), 162 deletions(-) diff --git a/main/constants.zkasm b/main/constants.zkasm index d2207523..f0bb8c19 100644 --- a/main/constants.zkasm +++ b/main/constants.zkasm @@ -67,17 +67,28 @@ CONST %SSTORE_SET_GAS_REDUCED = 19900 ; sstore gas cost reduced base_dynamic_gas CONST %SSTORE_RESET_GAS = 2900 CONST %SSTORE_RESET_GAS_REDUCED = 2800 ; sstore update gas cost reduced base_dynamic_gas(original_value == 0) - base_dynamic_gas(100) CONST %SSTORE_CLEARS_SCHEDULE = 15000 + ; COUNTERS CONST %MIN_STEPS_FINISH_BATCH = 200 ; min steps to finish tx CONST %TOTAL_STEPS = 2**23 CONST %MAX_CNT_STEPS = %TOTAL_STEPS - %MIN_STEPS_FINISH_BATCH -CONST %MAX_CNT_ARITH = %TOTAL_STEPS / 32 -CONST %MAX_CNT_BINARY = %TOTAL_STEPS / 16 -CONST %MAX_CNT_MEM_ALIGN = %TOTAL_STEPS / 32 -CONST %MAX_CNT_KECCAK_F = (%TOTAL_STEPS / 155286) * 44 -CONST %MAX_CNT_PADDING_PG = (%TOTAL_STEPS / 56) -CONST %MAX_CNT_POSEIDON_G = (%TOTAL_STEPS / 30) +CONST %MAX_CNT_ARITH_LIMIT = %TOTAL_STEPS / 32 +CONST %MAX_CNT_BINARY_LIMIT = %TOTAL_STEPS / 16 +CONST %MAX_CNT_MEM_ALIGN_LIMIT = %TOTAL_STEPS / 32 +CONST %MAX_CNT_KECCAK_F_LIMIT = (%TOTAL_STEPS / 155286) * 44 +CONST %MAX_CNT_PADDING_PG_LIMIT = (%TOTAL_STEPS / 56) +CONST %MAX_CNT_POSEIDON_G_LIMIT = (%TOTAL_STEPS / 30) + +CONST %SAFE_RANGE = 20 ; safe guard counters to not take into account (%RANGE = 1 / SAFE_RANGE) + +CONST %MAX_CNT_ARITH = %MAX_CNT_ARITH_LIMIT - (%MAX_CNT_ARITH_LIMIT / %SAFE_RANGE) +CONST %MAX_CNT_BINARY = %MAX_CNT_BINARY_LIMIT - (%MAX_CNT_BINARY_LIMIT / %SAFE_RANGE) +CONST %MAX_CNT_MEM_ALIGN = %MAX_CNT_MEM_ALIGN_LIMIT - (%MAX_CNT_MEM_ALIGN_LIMIT / %SAFE_RANGE) +CONST %MAX_CNT_KECCAK_F = %MAX_CNT_KECCAK_F_LIMIT - (%MAX_CNT_KECCAK_F_LIMIT / %SAFE_RANGE) +CONST %MAX_CNT_PADDING_PG = %MAX_CNT_PADDING_PG_LIMIT - (%MAX_CNT_PADDING_PG_LIMIT / %SAFE_RANGE) +CONST %MAX_CNT_POSEIDON_G = %MAX_CNT_POSEIDON_G_LIMIT - (%MAX_CNT_POSEIDON_G_LIMIT / %SAFE_RANGE) + CONST %MIN_CNT_KECCAK_BATCH = 1 ; minimum necessary keccaks to compute global hash ; ETHEREUM CONSTANTS diff --git a/main/opcodes/arithmetic.zkasm b/main/opcodes/arithmetic.zkasm index 33dd8100..ae78d117 100644 --- a/main/opcodes/arithmetic.zkasm +++ b/main/opcodes/arithmetic.zkasm @@ -2,8 +2,8 @@ /** * @link [Link EVM behaviour --> evm.codes?] * @zk-counters + * - 20 steps * - 1 binary - * - 100 steps * @process-opcode * - stack input: [a, b] * - stack output: [a + b] @@ -30,8 +30,7 @@ opADD: /** * @link [https://www.evm.codes/#02?fork=berlin] * @zk-counters - * - 1 arith - * - 100 steps + * - 20 steps * @process-opcode * - stack input: [a, b] * - stack output: [a * b] @@ -58,8 +57,8 @@ opMUL: /** * @link [https://www.evm.codes/#03?fork=berlin] * @zk-counters - * - 1 arith - * - 100 steps + * - 20 steps + * - 1 binary * @process-opcode * - stack input: [a, b] * - stack output: [a - b] @@ -81,9 +80,7 @@ opSUB: /** * @link [https://www.evm.codes/#04?fork=berlin] * @zk-counters - * - 1 arith - * - 2 binary - * - 100 steps + * - 20 steps * @process-opcode * - stack input: [a, b] * - stack output: [a / b] @@ -109,9 +106,8 @@ opDIV: /** * @link [https://www.evm.codes/#05?fork=berlin] * @zk-counters - * - 1 arith - * - 2 binary - * - 100 steps + * - 50 steps + * - 1 binary * @process-opcode * - stack input: [a, b] * - stack output: [a / b] @@ -148,9 +144,7 @@ SDIVNeg: /** * @link [https://www.evm.codes/#06?fork=berlin] * @zk-counters - * - 1 arith - * - 2 binary - * - 100 steps + * - 20 steps * @process-opcode * - stack input: [a, b] * - stack output: [a % b] @@ -174,9 +168,8 @@ opMOD: /** * @link [https://www.evm.codes/#07?fork=berlin] * @zk-counters - * - 1 arith - * - 8 binary - * - 100 steps + * - 20 steps + * - 1 binary * @process-opcode * - stack input: [a, b] * - stack output: [a % b] @@ -210,9 +203,9 @@ opSMODNeg: /** * @link [https://www.evm.codes/#08?fork=berlin] * @zk-counters - * - 1 arith - * - 4 binary * - 80 steps + * - 3 binary + * - 1 arith * @process-opcode * - stack input: [a, b, N] * - stack output: [(a + b) % N] @@ -262,9 +255,7 @@ zeroOneAddMod: /** * @link [https://www.evm.codes/#09?fork=berlin] * @zk-counters - * - 3 arith - * - 3 binary - * - 100 steps + * - 20 steps * @process-opcode * - stack input: [a, b, N] * - stack output: [(a * b) % N] @@ -287,8 +278,7 @@ opMULMOD: /** * @link [https://www.evm.codes/#0A?fork=berlin] * @zk-counters - * - 5 binary - * - 100 steps + * - 20 steps * @process-opcode * - stack input: [a, exp] * - stack output: [a ** exp] @@ -319,8 +309,8 @@ opEXP: /** * @link [https://www.evm.codes/#0B?fork=berlin] * @zk-counters - * - 6 arith * - 100 steps + * - 6 binary * @process-opcode * - stack input: [b,x] * - stack output: [y] diff --git a/main/opcodes/block.zkasm b/main/opcodes/block.zkasm index a9d23e84..d7b1ecae 100644 --- a/main/opcodes/block.zkasm +++ b/main/opcodes/block.zkasm @@ -1,8 +1,8 @@ /** * @link [https://www.evm.codes/#40?fork=berlin] * @zk-counters - * - 1 keccak * - 255 poseidon + * - 1 keccak * - 100 steps * @process-opcode * - stack input: [blockNumber] @@ -54,7 +54,7 @@ opBLOCKHASHzero: /** * @link [https://www.evm.codes/#41?fork=berlin] * @zk-counters - * - 100 steps + * - 10 steps * @process-opcode * - stack input: [] * - stack output: [address] @@ -74,7 +74,7 @@ opCOINBASE: /** * @link [https://www.evm.codes/#42?fork=berlin] * @zk-counters - * - 100 steps + * - 10 steps * @process-opcode * - stack input: [] * - stack output: [timestamp] @@ -93,7 +93,7 @@ opTIMESTAMP: /** * @link [https://www.evm.codes/#43?fork=berlin] * @zk-counters - * - 100 steps + * - 10 steps * @process-opcode * - stack input: [] * - stack output: [blockNumber] @@ -113,7 +113,7 @@ opNUMBER: /** * @link [https://www.evm.codes/#44?fork=berlin] * @zk-counters - * - 100 steps + * - 10 steps * @process-opcode * - stack input: [] * - stack output: [difficulty] @@ -133,7 +133,7 @@ opDIFFICULTY: /** * @link [https://www.evm.codes/#45?fork=berlin] * @zk-counters - * - 100 steps + * - 10 steps * @process-opcode * - stack input: [] * - stack output: [gasLimit] @@ -153,7 +153,7 @@ opGASLIMIT: /** * @link [https://www.evm.codes/#46?fork=berlin] * @zk-counters - * - 100 steps + * - 10 steps * @process-opcode * - stack input: [] * - stack output: [chainId] @@ -172,7 +172,7 @@ opCHAINID: /** * @link [https://www.evm.codes/#48?fork=berlin] * @zk-counters - * - 100 steps + * - 10 steps * @process-opcode * - stack input: [] * - stack output: [baseFee] diff --git a/main/opcodes/calldata-returndata-code.zkasm b/main/opcodes/calldata-returndata-code.zkasm index d19c8689..4b1fc9c3 100644 --- a/main/opcodes/calldata-returndata-code.zkasm +++ b/main/opcodes/calldata-returndata-code.zkasm @@ -2,8 +2,7 @@ /** * @link [https://www.evm.codes/#35?fork=berlin] * @zk-counters - * - 64 arith - * - 66 binary + * - 1 binary * - 100 steps * @process-opcode * - stack input: [offset] @@ -82,10 +81,8 @@ opCALLDATASIZEdep: /** * @link [https://www.evm.codes/#37?fork=berlin] * @zk-counters - * - 192 arith - * - 192 binary - * - 1 mem align * - 100 steps + * - 2 binary * @process-opcode * - stack input: [destOffset, offset, size] * - stack output: [] @@ -224,8 +221,8 @@ opCALLDATACOPYend: /** * @link [https://www.evm.codes/#38?fork=berlin] * @zk-counters - * - 252 poseidon - * - 100 steps + * - 255 poseidon + * - 30 steps * @process-opcode * - stack input: [] * - stack output: [size] @@ -263,7 +260,7 @@ VAR GLOBAL memInteger /** * @link [https://www.evm.codes/#39?fork=berlin] * @zk-counters - * - dynamic binary: 100 * size + * - dynamic binary: 2 * size * - dynamic mem align: 2 * size * - dynamic poseidon: 510 * size * - dynamic steps: 100 * size @@ -366,8 +363,8 @@ readValueBytecode: /** * @link [https://www.evm.codes/#3B?fork=berlin] * @zk-counters - * - 255 poseidon * - 100 steps + * - 255 poseidon * @process-opcode * - stack input: [address] * - stack output: [size] @@ -399,11 +396,8 @@ VAR GLOBAL tmpContractLength /** * @link [https://www.evm.codes/#51?fork=berlin] * @zk-counters - * - 11 padding - * - dynamic binary: 100 * size - * - dynamic mem align: 2 * size - * - dynamic poseidon: 510 * size - * - dynamic steps: 100 * size + * - dynamic: 100 + * - dynamic poseidon: 255 + f(size) * @process-opcode * - stack input: [address, destOffset, offset, size] * - stack output: [] @@ -507,7 +501,7 @@ opEXTCODECOPYCheckHashEnd: * @link [https://www.evm.codes/#3D?fork=berlin] * @zk-counters * - 1 binary - * - 100 steps + * - 20 steps * @process-opcode * - stack input: [] * - stack output: [size] @@ -537,10 +531,7 @@ endOpRETURNDATASIZE: /** * @link [https://www.evm.codes/#3E?fork=berlin] * @zk-counters - * - 32 arith - * - 32 binary - * - 2 mem align - * - 510 poseidon + * - 2 binary * - dynamic steps: 400 + 100 * size * @process-opcode * - stack input: [destOffset, offset, size] @@ -631,8 +622,8 @@ opRETURNDATACOPYEmpty: /** * @link [https://www.evm.codes/#3F?fork=berlin] * @zk-counters - * - 255 poseidon * - 100 steps + * - 255 poseidon * @process-opcode * - stack input: [address] * - stack output: [hash] diff --git a/main/opcodes/comparison.zkasm b/main/opcodes/comparison.zkasm index c0a38be7..87e0abd0 100644 --- a/main/opcodes/comparison.zkasm +++ b/main/opcodes/comparison.zkasm @@ -2,7 +2,7 @@ * @link [https://www.evm.codes/#10?fork=berlin] * @zk-counters * - 1 binary - * - 120 steps + * - 20 steps * @process-opcode * - stack input: [a, b] * - stack output: [a < b] @@ -31,7 +31,7 @@ opLT: * @link [https://www.evm.codes/#11?fork=berlin] * @zk-counters * - 1 binary - * - 120 steps + * - 20 steps * @process-opcode * - stack input: [a, b] * - stack output: [a > b] @@ -60,7 +60,7 @@ opGT: * @link [https://www.evm.codes/#12?fork=berlin] * @zk-counters * - 1 binary - * - 120 steps + * - 20 steps * @process-opcode * - stack input: [a, b] * - stack output: [signed(a < b)] @@ -89,7 +89,7 @@ opSLT: * @link [https://www.evm.codes/#13?fork=berlin] * @zk-counters * - 1 binary - * - 120 steps + * - 20 steps * @process-opcode * - stack input: [a, b] * - stack output: [signed(a > b)] @@ -118,7 +118,7 @@ opSGT: * @link [https://www.evm.codes/#14?fork=berlin] * @zk-counters * - 1 binary - * - 120 steps + * - 20 steps * @process-opcode * - stack input: [a, b] * - stack output: [a == b] @@ -147,7 +147,7 @@ opEQ: * @link [https://www.evm.codes/#15?fork=berlin] * @zk-counters * - 1 binary - * - 120 steps + * - 20 steps * @process-opcode * - stack input: [a] * - stack output: [a == 0] @@ -175,7 +175,7 @@ opISZERO: * @link [https://www.evm.codes/#16?fork=berlin] * @zk-counters * - 1 binary - * - 120 steps + * - 20 steps * @process-opcode * - stack input: [a, b] * - stack output: [a & b] @@ -204,7 +204,7 @@ opAND: * @link [https://www.evm.codes/#17?fork=berlin] * @zk-counters * - 1 binary - * - 120 steps + * - 20 steps * @process-opcode * - stack input: [a, b] * - stack output: [a | b] @@ -233,7 +233,7 @@ opOR: * @link [https://www.evm.codes/#18?fork=berlin] * @zk-counters * - 1 binary - * - 120 steps + * - 20 steps * @process-opcode * - stack input: [a, b] * - stack output: [a ^ b] @@ -262,7 +262,7 @@ opXOR: * @link [https://www.evm.codes/#19?fork=berlin] * @zk-counters * - 1 binary - * - 120 steps + * - 20 steps * @process-opcode * - stack input: [a] * - stack output: [ ~a ] @@ -287,9 +287,8 @@ opNOT: /** * @link [https://www.evm.codes/#1a?fork=berlin] * @zk-counters - * - 2 arith - * - 4 binary - * - 120 steps + * - 30 steps + * - 2 binary * @process-opcode * - stack input: [byte offset, 32-byte value] * - stack output: [byte] @@ -328,9 +327,7 @@ opBYTE0: /** * @link [https://www.evm.codes/#1c?fork=berlin] * @zk-counters - * - 1 arith - * - 3 binary - * - 120 steps + * - 20 steps * @process-opcode * - stack input: [shift, value] * - stack output: [value >> shift] @@ -355,9 +352,7 @@ opSHR: /** * @link [https://www.evm.codes/#1b?fork=berlin] * @zk-counters - * - 1 arith - * - 3 binary - * - 120 steps + * - 20 steps * @process-opcode * - stack input: [shift, value] * - stack output: [value << shift] @@ -384,9 +379,8 @@ opSHL: /** * @link [https://www.evm.codes/#1d?fork=berlin] * @zk-counters - * - 1 arith - * - 9 binary - * - 200 steps + * - 5 binary + * - 100 steps * @process-opcode * - stack input: [shift, value] * - stack output: [value >> shift (signed)] diff --git a/main/opcodes/context-information.zkasm b/main/opcodes/context-information.zkasm index 6247a616..ef7aa358 100644 --- a/main/opcodes/context-information.zkasm +++ b/main/opcodes/context-information.zkasm @@ -1,7 +1,7 @@ /** * @link [https://www.evm.codes/#30?fork=berlin] * @zk-counters - * - 100 steps + * - 20 steps * @process-opcode * - stack input: [] * - stack output: [address] @@ -29,7 +29,7 @@ opADDRESSend: * @link [https://www.evm.codes/#47?fork=berlin] * @zk-counters * - 255 poseidon - * - 100 steps + * - 10 steps * @process-opcode * - stack input: [] * - stack output: [balance] @@ -54,7 +54,7 @@ opSELFBALANCE: * @link [https://www.evm.codes/#31?fork=berlin] * @zk-counters * - 255 poseidon - * - 100 steps + * - 10 steps * @process-opcode * - stack input: [address] * - stack output: [balance] @@ -78,7 +78,7 @@ opBALANCE: /** * @link [https://www.evm.codes/#32?fork=berlin] * @zk-counters - * - 100 steps + * - 10 steps * @process-opcode * - stack input: [] * - stack output: [address] @@ -97,7 +97,7 @@ opORIGIN: /** * @link [https://www.evm.codes/#33?fork=berlin] * @zk-counters - * - 100 steps + * - 10 steps * @process-opcode * - stack input: [] * - stack output: [address] @@ -116,7 +116,7 @@ opCALLER: /** * @link [https://www.evm.codes/#34?fork=berlin] * @zk-counters - * - 100 steps + * - 10 steps * @process-opcode * - stack input: [] * - stack output: [value] @@ -135,7 +135,7 @@ opCALLVALUE: /** * @link [https://www.evm.codes/#3A?fork=berlin] * @zk-counters - * - 100 steps + * - 10 steps * @process-opcode * - stack input: [] * - stack output: [price] @@ -154,7 +154,7 @@ opGASPRICE: /** * @link [https://www.evm.codes/#5A?fork=berlin] * @zk-counters - * - 100 steps + * - 10 steps * @process-opcode * - stack input: [] * - stack output: [gas] diff --git a/main/opcodes/create-terminate-context.zkasm b/main/opcodes/create-terminate-context.zkasm index 5cbcf02a..a57b9c4a 100644 --- a/main/opcodes/create-terminate-context.zkasm +++ b/main/opcodes/create-terminate-context.zkasm @@ -1,6 +1,7 @@ /** * @link [https://www.evm.codes/#00?fork=berlin] * @zk-counters + * - 20 steps * @process-opcode * - stack input: none * - stack output: none @@ -43,11 +44,9 @@ opSTOPend: /** * @link [https://www.evm.codes/#f0?fork=berlin] * @zk-counters - * - 32 arith - * - 32 binary - * - 2 mem align - * - 510 poseidon - * - 600 steps + * - 200 steps + * - 2 binary + * - 255*3 poseidon * @process-opcode * - stack input: [value, offset, size] * - stack output: [address] @@ -160,10 +159,8 @@ opCreateFail: /** * @link [https://www.evm.codes/#f1?fork=berlin] * @zk-counters - * - 32 arith - * - 32 binary - * - 510 poseidon - * - 1200 steps + * - 200 steps + * - 3 binary * @process-opcode * - stack input: [gas, address, value, argsOffset, argsSize, retOffset, retSize] * - stack output: [success] @@ -284,10 +281,8 @@ opCALLend: /** * @link [https://www.evm.codes/#f1?fork=berlin] * @zk-counters - * - 32 arith - * - 32 binary - * - 510 poseidon - * - 1200 steps + * - 200 steps + * - 2 binary * @process-opcode * - stack input: [gas, address, value, argsOffset, argsSize, retOffset, retSize] * - stack output: [success] @@ -393,10 +388,8 @@ opCALLCODEend: /** * @link [https://www.evm.codes/#f3?fork=berlin] * @zk-counters - * - 32 arith - * - 32 binary - * - 510 poseidon - * - 600 steps + * - 400 steps + * - 1 binary * @process-opcode * - stack input: [offset, size] * - stack output: none @@ -549,10 +542,7 @@ opRETURNcreateEnd: /** * @link [https://www.evm.codes/#f4?fork=berlin] * @zk-counters - * - 32 arith - * - 32 binary - * - 510 poseidon - * - 1200 steps + * - 400 steps * @process-opcode * - stack input: [gas, address, argsOffset, argsSize, retOffset, retSize] * - stack output: [success] @@ -646,11 +636,9 @@ opDELEGATECALLend: /** * @link [https://www.evm.codes/#f5?fork=berlin] * @zk-counters - * - 32 arith - * - 32 binary - * - 2 mem align + * - 400 steps + * - 3 binary * - 510 poseidon - * - 600 steps * @process-opcode * - stack input: [value, offset, size, salt] * - stack output: [address] @@ -769,10 +757,7 @@ opCREATE2: /** * @link [https://www.evm.codes/#fa?fork=berlin] * @zk-counters - * - 32 arith - * - 32 binary - * - 510 poseidon - * - 1200 steps + * - 300 steps * @process-opcode * - stack input: [gas, address, argsOffset, argsSize, retOffset, retSize] * - stack output: [success] @@ -853,7 +838,7 @@ opSTATICCALL: /** * @link [https://www.evm.codes/#fd?fork=berlin] * @zk-counters - * - 1000 steps + * - 400 steps * @process-opcode * - stack input: [offset, size] * - stack output: none @@ -945,9 +930,9 @@ opREVERTend: /** * @link [https://www.evm.codes/#ff?fork=berlin] (selfdestruct) * @zk-counters - * - 10 binary - * - 2040 poseidon - * - 600 steps + * - 400 steps + * - 2 binary + * - 255*4 poseidon * @process-opcode * - stack input: [address] * - stack output: none @@ -1038,7 +1023,7 @@ opSENDALLend: /** * @link [https://www.evm.codes/#fe?fork=berlin] * @zk-counters - * - 120 steps + * - 100 steps * @process-opcode * - stack input: none * - stack output: none diff --git a/main/opcodes/crypto.zkasm b/main/opcodes/crypto.zkasm index 66a07e55..3d76626b 100644 --- a/main/opcodes/crypto.zkasm +++ b/main/opcodes/crypto.zkasm @@ -1,12 +1,8 @@ /** * @link [https://www.evm.codes/#20?fork=berlin] * @zk-counters - * - 192 arith - * - dynamic binary: 193 + length - * - 2 mem align - * - 2 keccak - * - 10 poseidon - * - dynamic steps: 200 + 100 * length + * - dynamic steps: 400 + 100 * length + * - dynamic keccaks: f(length) * @process-opcode * - stack input: [offset, size] * - stack output: [hash] diff --git a/main/opcodes/flow-control.zkasm b/main/opcodes/flow-control.zkasm index 6eab01c9..7078b26d 100644 --- a/main/opcodes/flow-control.zkasm +++ b/main/opcodes/flow-control.zkasm @@ -2,8 +2,8 @@ /** * @link [https://www.evm.codes/#56?fork=berlin] * @zk-counters - * - 32 binary - * - 120 steps + * - 100 steps + * - 2 binary * @process-opcode * - stack input: [counter] * - stack output: none @@ -24,8 +24,8 @@ opJUMP: /** * @link [https://www.evm.codes/#57?fork=berlin] * @zk-counters - * - 32 binary - * - 120 steps + * - 100 steps + * - 2 binary * @process-opcode * - stack input: [counter, value] * - stack output: none @@ -90,7 +90,7 @@ checkJumpDestDeploymentCreate: /** * @link [https://www.evm.codes/#58?fork=berlin] * @zk-counters - * - dynamic steps: 120 * pushed bytes + * - 20 steps * @process-opcode * - stack input: none * - stack output: [PC] @@ -110,7 +110,7 @@ opPC: /** * @link [https://www.evm.codes/#5B?fork=berlin] * @zk-counters - * - dynamic steps: 120 * pushed bytes + * - 10 steps * @process-opcode * - stack input: none * - stack output: none diff --git a/main/opcodes/logs.zkasm b/main/opcodes/logs.zkasm index fab193f4..b73e1dcb 100644 --- a/main/opcodes/logs.zkasm +++ b/main/opcodes/logs.zkasm @@ -1,8 +1,8 @@ /** * @link [https://www.evm.codes/#a0?fork=berlin] * @zk-counters - * - dynamic binary - * - 200 steps + * - 100 steps + * - 1 binary * @process-opcode * - stack input: [offset, size, topic] * - stack output: none diff --git a/main/opcodes/stack-operations.zkasm b/main/opcodes/stack-operations.zkasm index 0b306e6a..9147494f 100644 --- a/main/opcodes/stack-operations.zkasm +++ b/main/opcodes/stack-operations.zkasm @@ -1,8 +1,8 @@ /** * @link [https://www.evm.codes/#60?fork=berlin] * @zk-counters - * - dynamic binary: 4 * pushed bytes - * - dynamic steps: 120 * pushed bytes + * - 100 steps (stack) || 400 steps (calldata) + * - 1 binary (stack) || 0 binary (calldata) * @process-opcode * - stack input: none * - stack output: [pushed_value] @@ -218,7 +218,7 @@ opAuxPUSHBcreate: /** * @link [https://www.evm.codes/#80?fork=berlin] * @zk-counters - * - 120 steps + * - 100 steps * @process-opcode * - stack input: [value] * - stack output: [duplicated_value, original_value] @@ -424,7 +424,7 @@ opDUP16: /** * @link [https://www.evm.codes/#90?fork=berlin] * @zk-counters - * - 120 steps + * - 100 steps * @process-opcode * - stack input: [value_to_swap_a, value_to_swap_b] * - stack output: [swapped_value_a, swapped_value_b] @@ -645,7 +645,7 @@ opSWAP16: /** * @link [https://www.evm.codes/#50?fork=berlin] * @zk-counters - * - 120 steps + * - 100 steps * @process-opcode * - stack input: [stack_item] * - stack output: none diff --git a/main/opcodes/storage-memory.zkasm b/main/opcodes/storage-memory.zkasm index 9e4fdcd6..012094f1 100644 --- a/main/opcodes/storage-memory.zkasm +++ b/main/opcodes/storage-memory.zkasm @@ -1,11 +1,7 @@ /** * @link [https://www.evm.codes/#51?fork=berlin] * @zk-counters - * - 32 arith - * - 32 binary - * - 1 mem align - * - 255 poseidon - * - 120 steps + * - 100 steps * @process-opcode * - stack input: [offset] * - stack output: [value] @@ -32,11 +28,7 @@ opMLOAD: /** * @link [https://www.evm.codes/#52?fork=berlin] * @zk-counters - * - 32 arith - * - 32 binary - * - 1 mem align - * - 255 poseidon - * - 120 steps + * - 100 steps * @process-opcode * - stack input: [offset, value] * - stack output: none @@ -65,10 +57,8 @@ opMLOAD: /** * @link [https://www.evm.codes/#53?fork=berlin] * @zk-counters - * - 32 binary + * - 100 steps * - 1 mem align - * - 255 poseidon - * - 120 steps * @process-opcode * - stack input: [offset, value] * - stack output: none @@ -101,9 +91,7 @@ opMSTORE8: /** * @link [https://www.evm.codes/#59?fork=berlin] * @zk-counters - * - 1 arith - * - 3 binary - * - 200 steps + * - 100 steps * @process-opcode * - stack input: none * - stack output: [size] @@ -139,8 +127,8 @@ MSIZEend: /** * @link [https://www.evm.codes/#54?fork=berlin] * @zk-counters + * - 100 steps * - 255 poseidon - * - 120 steps * @process-opcode * - stack input: [key] * - stack output: [value] @@ -168,10 +156,9 @@ VAR GLOBAL tmpVarCsstore /** * @link [https://www.evm.codes/#55?fork=berlin] * @zk-counters + * - 400 steps * - 10 binary - * - 1 mem align - * - 765 poseidon - * - 120 steps + * - 255*3 poseidon * @process-opcode * - stack input: [key, value] * - stack output: none