diff --git a/system-contracts/contracts/EvmInterpreter.yul b/system-contracts/contracts/EvmInterpreter.yul index a848321a4..b16daad6a 100644 --- a/system-contracts/contracts/EvmInterpreter.yul +++ b/system-contracts/contracts/EvmInterpreter.yul @@ -2722,11 +2722,10 @@ object "EVMInterpreter" { revertWithGas(evmGasLeft) } - let offset, size, topic1 + let offset, size popStackCheck(sp, evmGasLeft, 3) offset, sp := popStackItemWithoutCheck(sp) size, sp := popStackItemWithoutCheck(sp) - topic1, sp := popStackItemWithoutCheck(sp) checkOverflow(offset, size, evmGasLeft) checkMemOverflowByOffset(add(offset, size), evmGasLeft) @@ -2736,7 +2735,11 @@ object "EVMInterpreter" { dynamicGas := add(dynamicGas, 375) evmGasLeft := chargeGas(evmGasLeft, dynamicGas) - log1(add(offset, MEM_OFFSET_INNER()), size, topic1) + { + let topic1 + topic1, sp := popStackItemWithoutCheck(sp) + log1(add(offset, MEM_OFFSET_INNER()), size, topic1) + } ip := add(ip, 1) } case 0xA2 { // OP_LOG2 @@ -2746,7 +2749,7 @@ object "EVMInterpreter" { } let offset, size - popStackCheck(sp, evmGasLeft, 2) + popStackCheck(sp, evmGasLeft, 4) offset, sp := popStackItemWithoutCheck(sp) size, sp := popStackItemWithoutCheck(sp) @@ -2760,7 +2763,6 @@ object "EVMInterpreter" { { let topic1, topic2 - popStackCheck(sp, evmGasLeft, 2) topic1, sp := popStackItemWithoutCheck(sp) topic2, sp := popStackItemWithoutCheck(sp) log2(add(offset, MEM_OFFSET_INNER()), size, topic1, topic2) @@ -2775,7 +2777,7 @@ object "EVMInterpreter" { } let offset, size - popStackCheck(sp, evmGasLeft, 2) + popStackCheck(sp, evmGasLeft, 5) offset, sp := popStackItemWithoutCheck(sp) size, sp := popStackItemWithoutCheck(sp) @@ -2789,7 +2791,6 @@ object "EVMInterpreter" { { let topic1, topic2, topic3 - popStackCheck(sp, evmGasLeft, 3) topic1, sp := popStackItemWithoutCheck(sp) topic2, sp := popStackItemWithoutCheck(sp) topic3, sp := popStackItemWithoutCheck(sp) @@ -2805,7 +2806,7 @@ object "EVMInterpreter" { } let offset, size - popStackCheck(sp, evmGasLeft, 2) + popStackCheck(sp, evmGasLeft, 6) offset, sp := popStackItemWithoutCheck(sp) size, sp := popStackItemWithoutCheck(sp) @@ -2819,7 +2820,6 @@ object "EVMInterpreter" { { let topic1, topic2, topic3, topic4 - popStackCheck(sp, evmGasLeft, 4) topic1, sp := popStackItemWithoutCheck(sp) topic2, sp := popStackItemWithoutCheck(sp) topic3, sp := popStackItemWithoutCheck(sp) @@ -5588,11 +5588,10 @@ object "EVMInterpreter" { revertWithGas(evmGasLeft) } - let offset, size, topic1 + let offset, size popStackCheck(sp, evmGasLeft, 3) offset, sp := popStackItemWithoutCheck(sp) size, sp := popStackItemWithoutCheck(sp) - topic1, sp := popStackItemWithoutCheck(sp) checkOverflow(offset, size, evmGasLeft) checkMemOverflowByOffset(add(offset, size), evmGasLeft) @@ -5602,7 +5601,11 @@ object "EVMInterpreter" { dynamicGas := add(dynamicGas, 375) evmGasLeft := chargeGas(evmGasLeft, dynamicGas) - log1(add(offset, MEM_OFFSET_INNER()), size, topic1) + { + let topic1 + topic1, sp := popStackItemWithoutCheck(sp) + log1(add(offset, MEM_OFFSET_INNER()), size, topic1) + } ip := add(ip, 1) } case 0xA2 { // OP_LOG2 @@ -5612,7 +5615,7 @@ object "EVMInterpreter" { } let offset, size - popStackCheck(sp, evmGasLeft, 2) + popStackCheck(sp, evmGasLeft, 4) offset, sp := popStackItemWithoutCheck(sp) size, sp := popStackItemWithoutCheck(sp) @@ -5626,7 +5629,6 @@ object "EVMInterpreter" { { let topic1, topic2 - popStackCheck(sp, evmGasLeft, 2) topic1, sp := popStackItemWithoutCheck(sp) topic2, sp := popStackItemWithoutCheck(sp) log2(add(offset, MEM_OFFSET_INNER()), size, topic1, topic2) @@ -5641,7 +5643,7 @@ object "EVMInterpreter" { } let offset, size - popStackCheck(sp, evmGasLeft, 2) + popStackCheck(sp, evmGasLeft, 5) offset, sp := popStackItemWithoutCheck(sp) size, sp := popStackItemWithoutCheck(sp) @@ -5655,7 +5657,6 @@ object "EVMInterpreter" { { let topic1, topic2, topic3 - popStackCheck(sp, evmGasLeft, 3) topic1, sp := popStackItemWithoutCheck(sp) topic2, sp := popStackItemWithoutCheck(sp) topic3, sp := popStackItemWithoutCheck(sp) @@ -5671,7 +5672,7 @@ object "EVMInterpreter" { } let offset, size - popStackCheck(sp, evmGasLeft, 2) + popStackCheck(sp, evmGasLeft, 6) offset, sp := popStackItemWithoutCheck(sp) size, sp := popStackItemWithoutCheck(sp) @@ -5685,7 +5686,6 @@ object "EVMInterpreter" { { let topic1, topic2, topic3, topic4 - popStackCheck(sp, evmGasLeft, 4) topic1, sp := popStackItemWithoutCheck(sp) topic2, sp := popStackItemWithoutCheck(sp) topic3, sp := popStackItemWithoutCheck(sp) diff --git a/system-contracts/evm-interpreter/EvmInterpreterLoop.template.yul b/system-contracts/evm-interpreter/EvmInterpreterLoop.template.yul index eb2cac4ec..ae64735c0 100644 --- a/system-contracts/evm-interpreter/EvmInterpreterLoop.template.yul +++ b/system-contracts/evm-interpreter/EvmInterpreterLoop.template.yul @@ -1272,11 +1272,10 @@ for { } true { } { revertWithGas(evmGasLeft) } - let offset, size, topic1 + let offset, size popStackCheck(sp, evmGasLeft, 3) offset, sp := popStackItemWithoutCheck(sp) size, sp := popStackItemWithoutCheck(sp) - topic1, sp := popStackItemWithoutCheck(sp) checkOverflow(offset, size, evmGasLeft) checkMemOverflowByOffset(add(offset, size), evmGasLeft) @@ -1286,7 +1285,11 @@ for { } true { } { dynamicGas := add(dynamicGas, 375) evmGasLeft := chargeGas(evmGasLeft, dynamicGas) - log1(add(offset, MEM_OFFSET_INNER()), size, topic1) + { + let topic1 + topic1, sp := popStackItemWithoutCheck(sp) + log1(add(offset, MEM_OFFSET_INNER()), size, topic1) + } ip := add(ip, 1) } case 0xA2 { // OP_LOG2 @@ -1296,7 +1299,7 @@ for { } true { } { } let offset, size - popStackCheck(sp, evmGasLeft, 2) + popStackCheck(sp, evmGasLeft, 4) offset, sp := popStackItemWithoutCheck(sp) size, sp := popStackItemWithoutCheck(sp) @@ -1310,7 +1313,6 @@ for { } true { } { { let topic1, topic2 - popStackCheck(sp, evmGasLeft, 2) topic1, sp := popStackItemWithoutCheck(sp) topic2, sp := popStackItemWithoutCheck(sp) log2(add(offset, MEM_OFFSET_INNER()), size, topic1, topic2) @@ -1325,7 +1327,7 @@ for { } true { } { } let offset, size - popStackCheck(sp, evmGasLeft, 2) + popStackCheck(sp, evmGasLeft, 5) offset, sp := popStackItemWithoutCheck(sp) size, sp := popStackItemWithoutCheck(sp) @@ -1339,7 +1341,6 @@ for { } true { } { { let topic1, topic2, topic3 - popStackCheck(sp, evmGasLeft, 3) topic1, sp := popStackItemWithoutCheck(sp) topic2, sp := popStackItemWithoutCheck(sp) topic3, sp := popStackItemWithoutCheck(sp) @@ -1355,7 +1356,7 @@ for { } true { } { } let offset, size - popStackCheck(sp, evmGasLeft, 2) + popStackCheck(sp, evmGasLeft, 6) offset, sp := popStackItemWithoutCheck(sp) size, sp := popStackItemWithoutCheck(sp) @@ -1369,7 +1370,6 @@ for { } true { } { { let topic1, topic2, topic3, topic4 - popStackCheck(sp, evmGasLeft, 4) topic1, sp := popStackItemWithoutCheck(sp) topic2, sp := popStackItemWithoutCheck(sp) topic3, sp := popStackItemWithoutCheck(sp)