From 3a0edf93e6c789517cab450b92f253643880c94c Mon Sep 17 00:00:00 2001 From: Gabriel Rocheleau Date: Thu, 19 May 2022 12:05:33 +0200 Subject: [PATCH] VM: unify interpreter and evm DEBUG property --- packages/vm/src/evm/interpreter.ts | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/packages/vm/src/evm/interpreter.ts b/packages/vm/src/evm/interpreter.ts index e503c6e7700..baf3646cb5d 100644 --- a/packages/vm/src/evm/interpreter.ts +++ b/packages/vm/src/evm/interpreter.ts @@ -68,8 +68,6 @@ export default class Interpreter { _common: Common _evm: EVM - protected readonly DEBUG: boolean = false - // Opcode debuggers (e.g. { 'push': [debug Object], 'sstore': [debug Object], ...}) private opDebuggers: { [key: string]: (debug: string) => void } = {} @@ -92,11 +90,6 @@ export default class Interpreter { eei: this._eei, shouldDoJumpAnalysis: true, } - - // Safeguard if "process" is not available (browser) - if (process !== undefined && process.env.DEBUG) { - this.DEBUG = true - } } async run(code: Buffer, opts: InterpreterOpts = {}): Promise { @@ -197,7 +190,7 @@ export default class Interpreter { gas = await dynamicGasHandler(this._runState, gas, this._common) } - if (this._evm.listenerCount('step') > 0 || this.DEBUG) { + if (this._evm.listenerCount('step') > 0 || this._evm.DEBUG) { // Only run this stepHook function if there is an event listener (e.g. test runner) // or if the vm is running in debug mode (to display opcode debug logs) await this._runStepHook(gas, gasLimitClone) @@ -261,7 +254,7 @@ export default class Interpreter { codeAddress: this._eei._env.codeAddress, } - if (this.DEBUG) { + if (this._evm.DEBUG) { // Create opTrace for debug functionality let hexStack = [] hexStack = eventObj.stack.map((item: any) => {