ethereumjs-vm
Advanced tools
Comparing version 1.0.3 to 1.0.4
@@ -78,4 +78,5 @@ // This will demonstrate running code contained within a transaction. | ||
console.log('returen: ' + results.vm.return.toString('hex')) | ||
if (createdAddress) | ||
if (createdAddress) { | ||
console.log('address created: ' + createdAddress.toString('hex')) | ||
} | ||
@@ -82,0 +83,0 @@ cb(err) |
@@ -19,2 +19,3 @@ var VM = require('../index.js') | ||
console.log('gasUsed: ' + results.gasUsed.toString()) | ||
console.log(err) | ||
}) |
@@ -12,3 +12,3 @@ var data = '6107608061000e6000396000f30060003560e060020a90048063141961bc1461006e57806319ac74bd146100cf578063278ecde1146100e75780632c0f7b6f146100f8578063a87430ba1461010a578063ac273aa21461011f578063c06f4c1d14610133578063c1cbbca714610159578063e11523431461016a57005b610079600435610183565b8b6000528a60205289600160a060020a031660405288600160a060020a0316606052876080528660a0528560c0528460e05283610100528261012052816101405280600160a060020a0316610160526101806000f35b6100dd6004356024356106e8565b8060005260206000f35b6100f2600435610454565b60006000f35b61010061017c565b8060005260206000f35b6101156004356101da565b8060005260206000f35b61012d600435602435610729565b60006000f35b61015360043560243560443560643560843560a43560c43560e4356101ee565b60006000f35b610164600435610302565b60006000f35b6101756004356105dd565b60006000f35b5b60005481565b5b6000526001602052604060002080549080600101549080600201549080600301549080600401549080600501549080600601549080600701549080600801549080600901549080600c01549080600d015490508c565b5b600052600260205260406000208054905081565b600060006000600060008811801561020557504287115b61020e576102f4565b600080549081600101905593506001600085815260200190815260200160002092508b83819055508a83600101819055503383600201819055508883600301819055508783600501819055508683600401819055508583600701819055508983600c01819055508483600d01819055506002600033600160a060020a03168152602001908152602001600020915081805490816001019055905083826001016000838152602001908152602001600020819055508333600160a060020a03167f882da991e52c8933ce57314c9ba3f934798d912d862790c40d0feeb7025af08a60006000a35b505050505050505050505050565b600060006000600034116103155761044e565b600160008581526020019081526020016000209250428360040154101561033b5761044d565b82600901805490816001019055915082600a0160008381526020019081526020016000209050338181905550348160010181905550806001015483600601818154019150819055508183600b01600033600160a060020a03168152602001908152602001600020819055508333600160a060020a03167fc5e578961e5bd7481ccf1d1bdfbad97b9f1ddfad520f061ca764a57018f3febe6000866006015481526020016000a3600083600d0154600160a060020a031614156103fc5761044c565b82600d0154600160a060020a03166249f068600060008260e060020a02600052600488815260200133600160a060020a03168152602001348152602001600060008660325a03f161044957005b50505b5b5b50505050565b60006000600160008481526020019081526020016000209150816004015442118015610487575081600501548260060154105b8015610497575060008260060154115b6104a0576105d8565b81600a01600083600b01600033600160a060020a03168152602001908152602001600020548152602001908152602001600020905060008160010154116104e6576105d7565b8054600160a060020a0316600082600101546000600060006000848787f161050a57005b505050806001015482600601818154039150819055508233600160a060020a03167fe139691e7435f1fb40ec50ed3729009226be49087fd00e9e5bac276c2a8f40cf6000846001015481526020016000a360008160010181905550600082600d0154600160a060020a03161415610580576105d6565b81600d0154600160a060020a031663b71f3cde600060008260e060020a0260005260048781526020018554600160a060020a0316815260200185600101548152602001600060008660325a03f16105d357005b50505b5b5b505050565b6000600160008381526020019081526020016000209050806005015481600601541015610609576106e4565b8060030154600160a060020a0316600082600601546000600060006000848787f161063057005b5050508133600160a060020a03167f6be92574b1386f424263a096e8b66ff6cc223ab0f9d18702563aa339a372cf986000846006015481526020016000a36000816006018190555060018160080181905550600081600d0154600160a060020a0316141561069d576106e3565b80600d0154600160a060020a031663484ec26c600060008260e060020a02600052600486815260200185600601548152602001600060008660325a03f16106e057005b50505b5b5050565b600060006002600085600160a060020a0316815260200190815260200160002090508060010160008481526020019081526020016000205491505092915050565b6000600060016000858152602001908152602001600020905080600a0160008481526020019081526020016000209150509291505056' | ||
var pc = i | ||
var curOpCode = opcodes(raw[pc], true).opcode | ||
var curOpCode = opcodes(raw[pc], true).name | ||
@@ -26,3 +26,2 @@ // no destinations into the middle of PUSH | ||
} | ||
} | ||
@@ -29,0 +28,0 @@ |
@@ -63,6 +63,7 @@ const Tree = require('functional-red-black-tree') | ||
self._trie.get(address, function (err, raw) { | ||
if (err) return cb(err) | ||
var account = new Account(raw) | ||
var exists = !!raw | ||
account.exists = exists | ||
cb(err, account, exists) | ||
cb(null, account, exists) | ||
}) | ||
@@ -69,0 +70,0 @@ } |
@@ -40,3 +40,3 @@ const async = require('async') | ||
var r | ||
if (b.toString() === '0') { | ||
if (b.isZero()) { | ||
r = [0] | ||
@@ -53,3 +53,3 @@ } else { | ||
var r | ||
if (b.toString() === '0') { | ||
if (b.isZero()) { | ||
r = new Buffer([0]) | ||
@@ -67,3 +67,3 @@ } else { | ||
if (b.toString() === '0') { | ||
if (b.isZero()) { | ||
r = [0] | ||
@@ -81,3 +81,3 @@ } else { | ||
if (b.toString() === '0') { | ||
if (b.isZero()) { | ||
r = new Buffer([0]) | ||
@@ -99,3 +99,3 @@ } else { | ||
if (c.toString() === '0') { | ||
if (c.isZero()) { | ||
r = [0] | ||
@@ -113,3 +113,3 @@ } else { | ||
if (c.toString() === '0') { | ||
if (c.isZero()) { | ||
r = [0] | ||
@@ -130,3 +130,3 @@ } else { | ||
if (exponent.cmpn(0) !== 0) { | ||
if (!exponent.isZero()) { | ||
var bytes = 1 + logTable(exponent) | ||
@@ -577,3 +577,3 @@ subGas(runState, new BN(bytes).muln(fees.expByteGas.v)) | ||
// add stipend | ||
if (value.cmpn(0) !== 0) { | ||
if (!value.isZero()) { | ||
runState.gasLeft.iadd(new BN(fees.callStipend.v)) | ||
@@ -622,3 +622,3 @@ subGas(runState, new BN(fees.callValueTransferGas.v)) | ||
// add stipend | ||
if (value.cmpn(0) !== 0) { | ||
if (!value.isZero()) { | ||
runState.gasLeft.isub(new BN(fees.callValueTransferGas.v)).iadd(new BN(fees.callStipend.v)) | ||
@@ -625,0 +625,0 @@ options.gasLimit.iadd(new BN(fees.callStipend.v)) |
const utils = require('ethereumjs-util') | ||
const BN = require('bn.js') | ||
const error = require('../constants.js').ERROR | ||
const fees = require('ethereum-common') | ||
@@ -37,3 +38,3 @@ const ecdsa = require('secp256k1') | ||
results.exception = 0 // 0 means VM fail (in this case because of OOG) | ||
results.exceptionError = 'out of gas' | ||
results.exceptionError = error.OUT_OF_GAS | ||
return results | ||
@@ -40,0 +41,0 @@ } |
@@ -6,3 +6,7 @@ const async = require('async') | ||
const Account = require('ethereumjs-account') | ||
const constants = require('./constants.js') | ||
const ERROR = constants.ERROR | ||
/** | ||
@@ -152,3 +156,3 @@ * runs a CALL operation | ||
results.exception = 0 | ||
results.exceptionError = 'out of gas' | ||
results.exceptionError = ERROR.OUT_OF_GAS | ||
results.return = new Buffer([]) | ||
@@ -155,0 +159,0 @@ } |
@@ -68,2 +68,5 @@ const Trie = require('merkle-patricia-tree/secure.js') | ||
self.getAccount(address, function (err, account) { | ||
if (err) { | ||
cb(err) | ||
} | ||
account.balance = balance | ||
@@ -78,2 +81,5 @@ self._putAccount(address, account, cb) | ||
self.getAccount(address, function (err, account) { | ||
if (err) { | ||
cb(err) | ||
} | ||
// TODO: setCode use trie.setRaw which creates a storage leak | ||
@@ -236,2 +242,5 @@ account.setCode(self.trie, value, function (err) { | ||
self._getStorageTrie(address, function (err, trie) { | ||
if (err) { | ||
cb(err) | ||
} | ||
var storage = {} | ||
@@ -238,0 +247,0 @@ var stream = trie.createReadStream() |
{ | ||
"name": "ethereumjs-vm", | ||
"version": "1.0.3", | ||
"version": "1.0.4", | ||
"description": "an ethereum VM implementation", | ||
@@ -9,3 +9,3 @@ "main": "index.js", | ||
"async-eventemitter": "^0.2.2", | ||
"bn.js": "^4.3.0", | ||
"bn.js": "^4.5.0", | ||
"es6-shim": "^0.33.6", | ||
@@ -26,2 +26,4 @@ "ethereum-common": "0.0.10", | ||
"level": "^1.4.0", | ||
"leveldown": "^1.4.2", | ||
"levelup": "^1.3.0", | ||
"memdown": "^1.1.0", | ||
@@ -35,3 +37,7 @@ "minimist": "^1.1.1", | ||
"build": "browserify --s EthVm index.js > ./dist/ethereumjs-vm.js", | ||
"test": "standard *js && ./tests/tester -a" | ||
"testVM": "./tests/tester -v", | ||
"testState": "./tests/tester -s", | ||
"testBlockchain": "./tests/tester -b", | ||
"lint": "standard", | ||
"test": "./tests/tester -a" | ||
}, | ||
@@ -52,5 +58,8 @@ "repository": { | ||
"homepage": "https://github.com/ethereum/ethereumjs-vm", | ||
"browser": { | ||
"secp256k1": "secp256k1-browserify" | ||
"standard": { | ||
"ignore": [ | ||
"dist/**", | ||
"examples/runcode-browserify.js" | ||
] | ||
} | ||
} |
@@ -1,5 +0,8 @@ | ||
SYNOPSIS | ||
=========== | ||
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://github.com/feross/standard) [![Build Status](https://travis-ci.org/ethereum/ethereumjs-vm.svg?branch=master)](https://travis-ci.org/ethereum/ethereumjs-vm) [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/ethereum/ethereumjs-lib?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) or #ethereumjs on freenode | ||
# SYNOPSIS | ||
[![NPM Package](https://img.shields.io/npm/v/ethereumjs-tx.svg?style=flat-square)](https://www.npmjs.org/package/ethereumjs-vm) | ||
[![Build Status](https://img.shields.io/travis/ethereumjs/ethereumjs-vm.svg?branch=master&style=flat-square)](https://travis-ci.org/ethereumjs/ethereumjs-vm) | ||
[![Gitter](https://img.shields.io/gitter/room/ethereum/ethereumjs-lib.svg?style=flat-square)](https://gitter.im/ethereum/ethereumjs-lib) or #ethereumjs on freenode | ||
[![js-standard-style](https://cdn.rawgit.com/feross/standard/master/badge.svg)](https://github.com/feross/standard) | ||
Implements Ethereum's VM in JS | ||
@@ -6,0 +9,0 @@ |
@@ -11,3 +11,3 @@ const async = require('async') | ||
var cacheDB = Level('./.cachedb') | ||
var cacheDB = new Level('./.cachedb') | ||
module.exports = function runBlockchainTest (options, testData, t, cb) { | ||
@@ -14,0 +14,0 @@ var blockchainDB = new Level('', { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9210537
103
128319
199
11
Updatedbn.js@^4.5.0