Skip to content

Commit

Permalink
Execute JUMPDEST immediately after JUMP/JUMPI
Browse files Browse the repository at this point in the history
  • Loading branch information
0xVolosnikov committed Aug 19, 2024
1 parent 462f011 commit 6691c88
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
8 changes: 8 additions & 0 deletions system-contracts/contracts/EvmInterpreterLoop.template.yul
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,10 @@ for { } true { } {
if iszero(eq(nextOpcode, 0x5B)) {
revertWithGas(evmGasLeft)
}

// execute JUMPDEST immediately
evmGasLeft := chargeGas(evmGasLeft, 1)
ip := add(ip, 1)
}
case 0x57 { // OP_JUMPI
evmGasLeft := chargeGas(evmGasLeft, 10)
Expand All @@ -764,6 +768,10 @@ for { } true { } {
if iszero(eq(nextOpcode, 0x5B)) {
revertWithGas(evmGasLeft)
}

// execute JUMPDEST immediately
evmGasLeft := chargeGas(evmGasLeft, 1)
ip := add(ip, 1)
}
case 0x58 { // OP_PC
evmGasLeft := chargeGas(evmGasLeft, 2)
Expand Down
16 changes: 16 additions & 0 deletions system-contracts/contracts/EvmInterpreterPreprocessed.yul
Original file line number Diff line number Diff line change
Expand Up @@ -2290,6 +2290,10 @@ object "EVMInterpreter" {
if iszero(eq(nextOpcode, 0x5B)) {
revertWithGas(evmGasLeft)
}

// execute JUMPDEST immediately
evmGasLeft := chargeGas(evmGasLeft, 1)
ip := add(ip, 1)
}
case 0x57 { // OP_JUMPI
evmGasLeft := chargeGas(evmGasLeft, 10)
Expand All @@ -2312,6 +2316,10 @@ object "EVMInterpreter" {
if iszero(eq(nextOpcode, 0x5B)) {
revertWithGas(evmGasLeft)
}

// execute JUMPDEST immediately
evmGasLeft := chargeGas(evmGasLeft, 1)
ip := add(ip, 1)
}
case 0x58 { // OP_PC
evmGasLeft := chargeGas(evmGasLeft, 2)
Expand Down Expand Up @@ -5286,6 +5294,10 @@ object "EVMInterpreter" {
if iszero(eq(nextOpcode, 0x5B)) {
revertWithGas(evmGasLeft)
}

// execute JUMPDEST immediately
evmGasLeft := chargeGas(evmGasLeft, 1)
ip := add(ip, 1)
}
case 0x57 { // OP_JUMPI
evmGasLeft := chargeGas(evmGasLeft, 10)
Expand All @@ -5308,6 +5320,10 @@ object "EVMInterpreter" {
if iszero(eq(nextOpcode, 0x5B)) {
revertWithGas(evmGasLeft)
}

// execute JUMPDEST immediately
evmGasLeft := chargeGas(evmGasLeft, 1)
ip := add(ip, 1)
}
case 0x58 { // OP_PC
evmGasLeft := chargeGas(evmGasLeft, 2)
Expand Down

0 comments on commit 6691c88

Please sign in to comment.