fix useCall

pull/5370/head
Iuri Matias 5 years ago
parent febf062f95
commit f935b9795b
  1. 2
      remix-lib/src/execution/txExecution.js
  2. 3
      remix-lib/src/execution/txRunner.js
  3. 7
      remix-simulator/src/methods/transactions.js
  4. 7
      remix-simulator/src/methods/txProcess.js

@ -43,7 +43,7 @@ module.exports = {
* @param {Function} finalCallback - last callback.
*/
callFunction: function (from, to, data, value, gasLimit, funAbi, txRunner, callbacks, finalCallback) {
var tx = { from: from, to: to, data: data, useCall: false, value: value, gasLimit: gasLimit }
var tx = { from: from, to: to, data: data, useCall: funAbi.constant, value: value, gasLimit: gasLimit }
txRunner.rawRun(tx, callbacks.confirmationCb, callbacks.gasEstimationForceSend, callbacks.promptCb, (error, txResult) => {
// see universaldapp.js line 660 => 700 to check possible values of txResult (error case)
finalCallback(error, txResult)

@ -133,6 +133,9 @@ class TxRunner {
++self.blockNumber
this.runBlockInVm(tx, block, callback)
} else {
console.dir("============")
console.dir("========= useCall")
console.dir("============")
executionContext.vm().stateManager.checkpoint(() => {
this.runBlockInVm(tx, block, (err, result) => {
executionContext.vm().stateManager.revert(() => {

@ -50,8 +50,8 @@ Transactions.prototype.eth_getTransactionReceipt = function (payload, cb) {
'cumulativeGasUsed': Web3.utils.toHex(receipt.gas),
'contractAddress': receipt.contractAddress,
'logs': receipt.logs,
// 'status': receipt.status
'status': "0x01"
'status': receipt.status
// 'status': "0x01"
}
if (r.blockNumber === '0x') {
@ -83,6 +83,9 @@ Transactions.prototype.eth_call = function (payload, cb) {
if (payload.params && payload.params.length > 0 && payload.params[0].from) {
payload.params[0].from = ethJSUtil.toChecksumAddress(payload.params[0].from)
}
if (payload.params && payload.params.length > 0 && payload.params[0].to) {
payload.params[0].to = ethJSUtil.toChecksumAddress(payload.params[0].to)
}
processTx(this.accounts, payload, true, cb)
}

@ -9,6 +9,9 @@ function runCall (payload, from, to, data, value, gasLimit, txRunner, callbacks,
return callback(err)
}
console.dir(result.result.vm)
console.dir(result.result.vm.error)
console.dir(result.result)
let toReturn = '0x' + result.result.vm.return.toString('hex')
if (toReturn === '0x') {
toReturn = '0x0'
@ -16,7 +19,7 @@ function runCall (payload, from, to, data, value, gasLimit, txRunner, callbacks,
return callback(null, toReturn)
}
TxExecution.callFunction(from, to, data, value, gasLimit, null, txRunner, callbacks, finalCallback, true)
TxExecution.callFunction(from, to, data, value, gasLimit, {constant: true}, txRunner, callbacks, finalCallback, true)
}
function runTx (payload, from, to, data, value, gasLimit, txRunner, callbacks, callback) {
@ -27,7 +30,7 @@ function runTx (payload, from, to, data, value, gasLimit, txRunner, callbacks, c
callback(null, result.transactionHash)
}
TxExecution.callFunction(from, to, data, value, gasLimit, null, txRunner, callbacks, finalCallback, false)
TxExecution.callFunction(from, to, data, value, gasLimit, {constant: false}, txRunner, callbacks, finalCallback, false)
}
function createContract (payload, from, data, value, gasLimit, txRunner, callbacks, callback) {

Loading…
Cancel
Save