diff --git a/system-contracts/contracts/EvmEmulator.yul b/system-contracts/contracts/EvmEmulator.yul index f9a9c0d75..b3679d547 100644 --- a/system-contracts/contracts/EvmEmulator.yul +++ b/system-contracts/contracts/EvmEmulator.yul @@ -2014,10 +2014,10 @@ object "EvmEmulator" { } case 0x58 { // OP_PC evmGasLeft := chargeGas(evmGasLeft, 2) - ip := add(ip, 1) - // PC = ip - 32 (bytecode size) - 1 (current instruction) - sp, stackHead := pushStackItem(sp, sub(sub(ip, BYTECODE_LEN_OFFSET()), 33), stackHead) + sp, stackHead := pushStackItem(sp, sub(ip, BYTECODE_OFFSET()), stackHead) + + ip := add(ip, 1) } case 0x59 { // OP_MSIZE evmGasLeft := chargeGas(evmGasLeft, 2) @@ -5062,10 +5062,10 @@ object "EvmEmulator" { } case 0x58 { // OP_PC evmGasLeft := chargeGas(evmGasLeft, 2) - ip := add(ip, 1) - // PC = ip - 32 (bytecode size) - 1 (current instruction) - sp, stackHead := pushStackItem(sp, sub(sub(ip, BYTECODE_LEN_OFFSET()), 33), stackHead) + sp, stackHead := pushStackItem(sp, sub(ip, BYTECODE_OFFSET()), stackHead) + + ip := add(ip, 1) } case 0x59 { // OP_MSIZE evmGasLeft := chargeGas(evmGasLeft, 2) diff --git a/system-contracts/evm-emulator/EvmEmulatorLoop.template.yul b/system-contracts/evm-emulator/EvmEmulatorLoop.template.yul index 78e1a5315..1a6391da1 100644 --- a/system-contracts/evm-emulator/EvmEmulatorLoop.template.yul +++ b/system-contracts/evm-emulator/EvmEmulatorLoop.template.yul @@ -789,10 +789,10 @@ for { } true { } { } case 0x58 { // OP_PC evmGasLeft := chargeGas(evmGasLeft, 2) - ip := add(ip, 1) - // PC = ip - 32 (bytecode size) - 1 (current instruction) - sp, stackHead := pushStackItem(sp, sub(sub(ip, BYTECODE_LEN_OFFSET()), 33), stackHead) + sp, stackHead := pushStackItem(sp, sub(ip, BYTECODE_OFFSET()), stackHead) + + ip := add(ip, 1) } case 0x59 { // OP_MSIZE evmGasLeft := chargeGas(evmGasLeft, 2)