Skip to content

Commit 9bc99c3

Browse files
authored
Merge pull request ethereumjs#281 from ethereumjs/es5-dist
ES5 distribution on npm
2 parents e863b93 + 416e559 commit 9bc99c3

File tree

8 files changed

+61
-42
lines changed

8 files changed

+61
-42
lines changed

.babelrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"presets": [
3+
[
4+
"env"
5+
]
6+
]
7+
}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,4 +64,6 @@ build/Release
6464
node_modules
6565
package-lock.json
6666

67+
# Build folder
68+
dist
6769

.travis.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ os:
44

55
language: node_js
66
node_js:
7-
- "6"
7+
- "8"
8+
- "9"
89

910
addons:
1011
apt:
@@ -23,7 +24,7 @@ env:
2324
global:
2425
- DISPLAY=:99.0
2526
matrix:
26-
- CXX=g++-4.8 TEST_SUITE=testState
27+
- CXX=g++-4.8 TEST_SUITE=testBuildIntegrity
2728

2829
matrix:
2930
fast_finish: true

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,10 @@ Running the Blockchain tests:
222222

223223
`node ./tests/tester -b`
224224

225+
State tests and Blockchain tests can also be run against the ``dist`` folder (default: ``lib``):
226+
227+
`node ./tests/tester -b --dist`
228+
225229
State tests run significantly faster than Blockchain tests, so it is often a good choice to start fixing State tests.
226230

227231
#### Running Specific Tests

package.json

Lines changed: 31 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,35 @@
11
{
22
"name": "ethereumjs-vm",
33
"version": "2.3.3",
4-
"description": "an ethereum VM implementation",
5-
"main": "index.js",
4+
"description": "An Ethereum VM implementation",
5+
"main": "dist/index.js",
6+
"files": [
7+
"dist"
8+
],
9+
"scripts": {
10+
"coverage": "istanbul cover ./tests/tester.js -- -s",
11+
"coveralls": "npm run coverage && coveralls <coverage/lcov.info",
12+
"testVM": "node ./tests/tester -v",
13+
"testState": "npm run build:dist && node ./tests/tester -s --dist",
14+
"testBuildIntegrity": "npm run build:dist && node ./tests/tester -s --dist --test='stackOverflow'",
15+
"testBlockchain": "npm run build:dist && node --stack-size=1500 ./tests/tester -b --dist --excludeDir='GeneralStateTests'",
16+
"testBlockchainGeneralStateTests": "npm run build:dist && node --stack-size=1500 ./tests/tester -b --dist --dir='GeneralStateTests'",
17+
"testBlockchainBlockGasLimit": "npm run build:dist && node --stack-size=1500 ./tests/tester -b --dist --dir='bcBlockGasLimitTest'",
18+
"testBlockchainValid": "npm run build:dist && node --stack-size=1500 ./tests/tester -b --dist --dir='bcValidBlockTest'",
19+
"testBlockchainTotalDifficulty": "npm run build:dist && node --stack-size=1500 ./tests/tester -b --dist --dir='bcTotalDifficultyTest'",
20+
"test": "node ./tests/tester -a",
21+
"lint": "standard",
22+
"prepublishOnly": "npm run lint && npm run build:dist && npm run testBuildIntegrity",
23+
"build:dist": "babel lib/ -d dist/"
24+
},
25+
"repository": {
26+
"type": "git",
27+
"url": "git+https://github.com/ethereumjs/ethereumjs-vm.git"
28+
},
29+
"keywords": [
30+
"ethereum",
31+
"VM"
32+
],
633
"dependencies": {
734
"async": "^2.1.2",
835
"async-eventemitter": "^0.2.2",
@@ -17,8 +44,8 @@
1744
"safe-buffer": "^5.1.1"
1845
},
1946
"devDependencies": {
20-
"babel-preset-es2015": "^6.24.0",
21-
"babelify": "^7.3.0",
47+
"babel-cli": "^6.26.0",
48+
"babel-preset-env": "^1.6.1",
2249
"coveralls": "^3.0.0",
2350
"ethereumjs-blockchain": "~2.1.0",
2451
"ethereumjs-testing": "https://github.com/ethereumjs/ethereumjs-testing",
@@ -32,39 +59,6 @@
3259
"standard": "^10.0.0",
3360
"tape": "4.6.3"
3461
},
35-
"browserify": {
36-
"transform": [
37-
[
38-
"babelify",
39-
{
40-
"presets": [
41-
"es2015"
42-
]
43-
}
44-
]
45-
]
46-
},
47-
"scripts": {
48-
"testVM": "node ./tests/tester -v",
49-
"testState": "node ./tests/tester -s",
50-
"testBlockchain": "node --stack-size=1500 ./tests/tester -b --excludeDir='GeneralStateTests'",
51-
"testBlockchainGeneralStateTests": "node --stack-size=1500 ./tests/tester -b --dir='GeneralStateTests'",
52-
"testBlockchainBlockGasLimit": "node --stack-size=1500 ./tests/tester -b --dir='bcBlockGasLimitTest'",
53-
"testBlockchainValid": "node --stack-size=1500 ./tests/tester -b --dir='bcValidBlockTest'",
54-
"testBlockchainTotalDifficulty": "node --stack-size=1500 ./tests/tester -b --dir='bcTotalDifficultyTest'",
55-
"lint": "standard",
56-
"test": "node ./tests/tester -a",
57-
"coverage": "istanbul cover ./tests/tester.js -- -s",
58-
"coveralls": "npm run coverage && coveralls <coverage/lcov.info"
59-
},
60-
"repository": {
61-
"type": "git",
62-
"url": "git+https://github.com/ethereumjs/ethereumjs-vm.git"
63-
},
64-
"keywords": [
65-
"ethereum",
66-
"VM"
67-
],
6862
"author": "mjbecze <[email protected]>",
6963
"contributors": [
7064
"Alex Beregszaszi <[email protected]>"

tests/BlockchainTestsRunner.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ const Trie = require('merkle-patricia-tree/secure')
55
const Block = require('ethereumjs-block')
66
const Blockchain = require('ethereumjs-blockchain')
77
const BlockHeader = require('ethereumjs-block/header.js')
8-
const VM = require('../')
98
const Level = require('levelup')
109

1110
var cacheDB = new Level('./.cachedb')
@@ -16,6 +15,12 @@ module.exports = function runBlockchainTest (options, testData, t, cb) {
1615
var state = new Trie()
1716
var blockchain = new Blockchain(blockchainDB)
1817
blockchain.ethash.cacheDB = cacheDB
18+
var VM
19+
if (options.dist) {
20+
VM = require('../dist/index.js')
21+
} else {
22+
VM = require('../lib/index.js')
23+
}
1924
var vm = new VM({
2025
state: state,
2126
blockchain: blockchain

tests/GeneralStateTestsRunner.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
const async = require('async')
2-
const VM = require('../index.js')
32
const testUtil = require('./util')
43
const Trie = require('merkle-patricia-tree/secure')
54
const ethUtil = require('ethereumjs-util')
@@ -45,6 +44,12 @@ function runTestCase (options, testData, t, cb) {
4544

4645
async.series([
4746
function (done) {
47+
var VM
48+
if (options.dist) {
49+
VM = require('../dist/index.js')
50+
} else {
51+
VM = require('../lib/index.js')
52+
}
4853
vm = new VM({
4954
state: state
5055
})

tests/tester.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ const skipSlow = [
5555
'static_Call1MB1024Calldepth', // slow
5656
'static_Callcode50000', // slow
5757
'static_Return50000', // slow
58-
'static_Return50000_2' // slow
58+
'static_Return50000_2', // slow
59+
'QuadraticComplexitySolidity_CallDataCopy'
5960
]
6061

6162
/*

0 commit comments

Comments
 (0)