Reset state root for gas estimate calls and use calls

pull/5370/head
ioedeveloper 8 months ago committed by Aniket
parent 6f92030292
commit dd26f948dc
  1. 15
      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)

Loading…
Cancel
Save