Skip to content

Commit

Permalink
vm: skip _runStepHook method if no step event listener (#1676)
Browse files Browse the repository at this point in the history
Co-authored-by: Holger Drewes <Holger.Drewes@gmail.com>
  • Loading branch information
acolytec3 and holgerd77 committed Feb 1, 2022
1 parent 06bdad5 commit b224247
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/vm/src/evm/interpreter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,11 @@ export default class Interpreter {
await dynamicGasHandler(this._runState, gas, this._vm._common)
}

await this._runStepHook(gas, gasLimitClone)
if (this._vm.listenerCount('step') > 0) {
// Only run this stepHook function if there is an event listener (e.g. test runner)
// since its sole purpose is to emit the step event which is not used anywhere else
await this._runStepHook(gas, gasLimitClone)
}

// Check for invalid opcode
if (opInfo.name === 'INVALID') {
Expand Down

0 comments on commit b224247

Please sign in to comment.