fix libs tests

pull/3951/head
Oleksii Kosynskyi 1 year ago
parent 92a08145ed
commit a72a3a6ed7
No known key found for this signature in database
GPG Key ID: B4A8D3CCE22EA65E
  1. 9
      libs/remix-simulator/src/methods/transactions.ts
  2. 8
      libs/remix-simulator/src/methods/txProcess.ts

@ -153,7 +153,6 @@ export class Transactions {
}
payload.params[0].gas = 10000000 * 10
this.vmContext.web3().flagNextAsDoNotRecordEvmSteps()
processTx(this.txRunnerInstance, payload, true, (error, value: VMexecutionResult) => {
if (error) return cb(error)
@ -168,12 +167,12 @@ export class Transactions {
return cb(e.message)
}
}
let gasUsed = result.execResult.executionGasUsed
let gasUsed = Number(toNumber(result.execResult.executionGasUsed))
if (result.execResult.gasRefund) {
gasUsed += result.execResult.gasRefund
gasUsed += Number(toNumber(result.execResult.gasRefund))
}
gasUsed = gasUsed + value.tx.getBaseFee()
cb(null, Math.ceil(Number(gasUsed) + (15 * Number(gasUsed)) / 100))
gasUsed = gasUsed + Number(toNumber(value.tx.getBaseFee()))
cb(null, Math.ceil(gasUsed + (15 * gasUsed) / 100))
})
}

@ -35,7 +35,7 @@ function createContract (payload, from, data, value, gasLimit, txRunner, callbac
}
export function processTx (txRunnerInstance, payload, isCall, callback) {
let { from, to, data, value, gas } = payload.params[0] // eslint-disable-line
let { from, to, data, input, value, gas } = payload.params[0] // eslint-disable-line
gas = gas || 3000000
const callbacks = {
@ -54,10 +54,10 @@ export function processTx (txRunnerInstance, payload, isCall, callback) {
}
if (isCall) {
runCall(payload, from, to, data, value, gas, txRunnerInstance, callbacks, callback)
runCall(payload, from, to, data||input, value, gas, txRunnerInstance, callbacks, callback)
} else if (to) {
runTx(payload, from, to, data, value, gas, txRunnerInstance, callbacks, callback)
runTx(payload, from, to, data||input, value, gas, txRunnerInstance, callbacks, callback)
} else {
createContract(payload, from, data, value, gas, txRunnerInstance, callbacks, callback)
createContract(payload, from, data||input, value, gas, txRunnerInstance, callbacks, callback)
}
}

Loading…
Cancel
Save