Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
VmSubprovider.prototype.runVm = function(payload, cb) {
const self = this;
var blockData = self.currentBlock;
var block = blockFromBlockData(blockData);
var blockNumber = ethUtil.addHexPrefix(blockData.number.toString("hex"));
// create vm with state lookup intercepted
var vm = (self.vm = createVm(self.engine, blockNumber, {
enableHomestead: true
}));
if (self.opts.debug) {
vm.on("step", function(data) {
console.log(data.opcode.name);
});
}
// create tx
var txParams = payload.params[0];
// console.log('params:', payload.params)
const normalizedTxParams = {
to: txParams.to ? ethUtil.addHexPrefix(txParams.to) : undefined,
from: txParams.from ? ethUtil.addHexPrefix(txParams.from) : undefined,
VmSubprovider.prototype.runVm = function(payload, cb){
const self = this
var blockData = self.currentBlock
var block = blockFromBlockData(blockData)
var blockNumber = ethUtil.addHexPrefix(blockData.number.toString('hex'))
// create vm with state lookup intercepted
var vm = self.vm = createVm(self.engine, blockNumber, {
enableHomestead: true
})
if (self.opts.debug) {
vm.on('step', function (data) {
console.log(data.opcode.name)
})
}
// create tx
var txParams = payload.params[0]
// console.log('params:', payload.params)
const normalizedTxParams = {
to: txParams.to ? ethUtil.addHexPrefix(txParams.to) : undefined,
from: txParams.from ? ethUtil.addHexPrefix(txParams.from) : undefined,
function runVm (req, block, cb) {
const txParams = Object.assign({}, req.params[0])
const blockRef = req.params[1]
// opting to use blockRef as specified
// instead of hardening to resolved block's number
// for compatiblity with eth-json-rpc-ipfs
// const blockRef = block.number.toNumber()
// create vm with state lookup intercepted
const vm = createVm(provider, blockRef, {
enableHomestead: true
})
// create tx
txParams.from = txParams.from || '0x0000000000000000000000000000000000000000'
txParams.gasLimit = txParams.gasLimit || ('0x' + block.header.gasLimit.toString('hex'))
const tx = new FakeTransaction(txParams)
vm.runTx({
tx: tx,
block: block,
skipNonce: true,
skipBalance: true
}, function (err, results) {
if (err) return cb(err)
if (results.error) {