diff --git a/libs/remix-lib/src/execution/txRunnerVM.ts b/libs/remix-lib/src/execution/txRunnerVM.ts index da5ad0e7b2..11c5ce7b5c 100644 --- a/libs/remix-lib/src/execution/txRunnerVM.ts +++ b/libs/remix-lib/src/execution/txRunnerVM.ts @@ -128,7 +128,14 @@ export class TxRunnerVM { transactions: [tx] }, { common: this.commonContext }) - if (!this.standaloneTx) { + // standaloneTx represents a gas estimation call + if (this.standaloneTx || useCall) { + const root = await this.getVMObject().stateManager.getStateRoot() + this.runBlockInVm(tx, block, async (err, result) => { + await this.getVMObject().stateManager.setStateRoot(root) + callback(err, result) + }) + } else { this.blockParentHash = block.hash() this.runBlockInVm(tx, block, async (err, result) => { if (!err) { @@ -139,12 +146,6 @@ export class TxRunnerVM { } callback(err, result) }) - } else { - const root = await this.getVMObject().stateManager.getStateRoot() - this.runBlockInVm(tx, block, async (err, result) => { - await this.getVMObject().stateManager.setStateRoot(root) - callback(err, result) - }) } } catch (e) { callback(e)