flag non recording execution

pull/5370/head
yann300 2 years ago committed by Aniket
parent beccb86077
commit f48d48a9fe
  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 txsMapBlock
blocks blocks
stateCopy: StateManager stateCopy: StateManager
flagDoNotRecordEVMSteps: boolean
constructor (vmContext: VMContext) { constructor (vmContext: VMContext) {
this.vmContext = vmContext this.vmContext = vmContext
@ -109,7 +110,12 @@ export class VmProxy {
return ret return ret
} }
flagNextAsDoNotRecordEvmSteps () {
this.flagDoNotRecordEVMSteps = true
}
async txWillProcess (data: TypedTransaction) { async txWillProcess (data: TypedTransaction) {
if (this.flagDoNotRecordEVMSteps) return
this.stateCopy = await this.vm.stateManager.copy() this.stateCopy = await this.vm.stateManager.copy()
this.incr++ this.incr++
this.processingHash = bufferToHex(data.hash()) this.processingHash = bufferToHex(data.hash())
@ -148,6 +154,10 @@ export class VmProxy {
} }
async txProcessed (data: AfterTxEvent) { async txProcessed (data: AfterTxEvent) {
if (this.flagDoNotRecordEVMSteps) {
this.flagDoNotRecordEVMSteps = false
return
}
const lastOp = this.vmTraces[this.processingHash].structLogs[this.processingIndex - 1] const lastOp = this.vmTraces[this.processingHash].structLogs[this.processingIndex - 1]
if (lastOp) { if (lastOp) {
lastOp.error = lastOp.op !== 'RETURN' && lastOp.op !== 'STOP' && lastOp.op !== 'DESTRUCT' lastOp.error = lastOp.op !== 'RETURN' && lastOp.op !== 'STOP' && lastOp.op !== 'DESTRUCT'
@ -205,6 +215,7 @@ export class VmProxy {
} }
async pushTrace (data: InterpreterStep) { async pushTrace (data: InterpreterStep) {
if (this.flagDoNotRecordEVMSteps) return
try { try {
const depth = data.depth + 1 // geth starts the depth from 1 const depth = data.depth + 1 // geth starts the depth from 1
if (!this.processingHash) { if (!this.processingHash) {

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

Loading…
Cancel
Save