Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vm: skip _runStepHook method if no step event listener #1676

Merged
merged 2 commits into from
Feb 1, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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