flag non recording execution

pull/3285/head^2
yann300 2 years ago committed by Aniket
parent b99632043a
commit dac2072c27
  1. 11
      libs/remix-simulator/src/VmProxy.ts
  2. 1
      libs/remix-simulator/src/methods/transactions.ts

@ -43,6 +43,7 @@ export class VmProxy {
txsMapBlock
blocks
stateCopy: StateManager
flagDoNotRecordEVMSteps: boolean
constructor (vmContext: VMContext) {
this.vmContext = vmContext
@ -109,7 +110,12 @@ export class VmProxy {
return ret
}
flagNextAsDoNotRecordEvmSteps () {
this.flagDoNotRecordEVMSteps = true
}
async txWillProcess (data: TypedTransaction) {
if (this.flagDoNotRecordEVMSteps) return
this.stateCopy = await this.vm.stateManager.copy()
this.incr++
this.processingHash = bufferToHex(data.hash())
@ -148,6 +154,10 @@ export class VmProxy {
}
async txProcessed (data: AfterTxEvent) {
if (this.flagDoNotRecordEVMSteps) {
this.flagDoNotRecordEVMSteps = false
return
}
const lastOp = this.vmTraces[this.processingHash].structLogs[this.processingIndex - 1]
if (lastOp) {
lastOp.error = lastOp.op !== 'RETURN' && lastOp.op !== 'STOP' && lastOp.op !== 'DESTRUCT'
@ -205,6 +215,7 @@ export class VmProxy {
}
async pushTrace (data: InterpreterStep) {
if (this.flagDoNotRecordEVMSteps) return
try {
const depth = data.depth + 1 // geth starts the depth from 1
if (!this.processingHash) {

@ -155,6 +155,7 @@ export class Transactions {
payload.params[0].gas = 10000000 * 10
this.vmContext.web3().flagNextAsDoNotRecordEvmSteps()
processTx(this.txRunnerInstance, payload, true, (error, value: VMexecutionResult) => {
const result: RunTxResult = value.result
if (error) return cb(error)

Loading…
Cancel
Save