Skip to content

Commit ada597a

Browse files
authored
Merge branch 'master' into updateReadmeBrowser
2 parents 4de032b + 7ca2dcf commit ada597a

File tree

8 files changed

+105
-147
lines changed

8 files changed

+105
-147
lines changed

.github/workflows/labeler.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: 'Pull Request Labeler'
1+
name: 'PR Labeler'
22
on:
33
- pull_request
44

.github/workflows/vm-coverage.yml

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: vm-coverage
1+
name: 'VM Coverage'
22
on: [push, pull_request]
33
jobs:
44
coverage:
@@ -21,9 +21,8 @@ jobs:
2121
if: steps.cache-node-modules.outputs.cache-hit != 'true'
2222

2323
- run: npm run coverage
24-
- run: npm run coveralls
2524

26-
- name: Post coverage data to coveralls.io for analysis
25+
- name: Post coverage data to Coveralls
2726
uses: coverallsapp/github-action@master
2827
with:
2928
github-token: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/vm-lint.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: vm-lint
1+
name: 'VM Lint'
22
on: [push, pull_request]
33
jobs:
44
lint:

.github/workflows/vm-nightly-test.yml

+16-24
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: vm-nightly-test # without caching
1+
name: 'VM Nightly Test' # without caching
22
on:
33
schedule:
44
- cron: '0 0 * * *' # once a day at midnight
@@ -9,55 +9,47 @@ jobs:
99
- uses: actions/setup-node@v1
1010
with:
1111
node-version: 8.x
12-
1312
- uses: actions/checkout@v1
14-
1513
- run: npm install
16-
17-
- run: npm run testAPI
14+
- run: npm run test:API
1815
env:
1916
CI: true
20-
21-
- run: npm run testAPI:browser
17+
- run: npm run test:API:browser
2218
env:
2319
CI: true
2420

2521
test-state:
2622
runs-on: ubuntu-latest
27-
strategy:
28-
matrix:
29-
hardfork: ['Byzantium', 'Constantinople', 'Petersburg', 'Istanbul']
30-
3123
steps:
3224
- uses: actions/setup-node@v1
3325
with:
3426
node-version: 8.x
35-
3627
- uses: actions/checkout@v1
37-
3828
- run: npm install
39-
40-
- name: Run ${{ matrix.hardfork }} state tests
41-
run: npm run ${{ format('testState{0}', matrix.hardfork) }}
29+
- run: npm run test:state:allForks
4230
env:
4331
CI: true
4432

4533
test-blockchain:
4634
runs-on: ubuntu-latest
47-
strategy:
48-
matrix:
49-
hardfork: ['', 'Petersburg']
50-
5135
steps:
5236
- uses: actions/setup-node@v1
5337
with:
5438
node-version: 8.x
55-
5639
- uses: actions/checkout@v1
57-
5840
- run: npm install
41+
- run: npm run test:blockchain
42+
env:
43+
CI: true
5944

60-
- name: Run ${{ matrix.hardfork }} blockchain state tests
61-
run: npm run ${{ format('testBlockchain{0}', matrix.hardfork) }}
45+
slow-tests:
46+
runs-on: ubuntu-latest
47+
steps:
48+
- uses: actions/setup-node@v1
49+
with:
50+
node-version: 8.x
51+
- uses: actions/checkout@v1
52+
- run: npm install
53+
- run: npm run test:state:slow
6254
env:
6355
CI: true

.github/workflows/vm-test.yml

+5-15
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: vm-test
1+
name: 'VM Test'
22
on: [push, pull_request]
33
jobs:
44
test-api:
@@ -20,20 +20,16 @@ jobs:
2020
- run: npm install
2121
if: steps.cache-node-modules.outputs.cache-hit != 'true'
2222

23-
- run: npm run testAPI
23+
- run: npm run test:API
2424
env:
2525
CI: true
2626

27-
- run: npm run testAPI:browser
27+
- run: npm run test:API:browser
2828
env:
2929
CI: true
3030

3131
test-state:
3232
runs-on: ubuntu-latest
33-
strategy:
34-
matrix:
35-
hardfork: ['Byzantium', 'Constantinople', 'Petersburg', 'Istanbul']
36-
3733
steps:
3834
- uses: actions/setup-node@v1
3935
with:
@@ -51,17 +47,12 @@ jobs:
5147
- run: npm install
5248
if: steps.cache-node-modules.outputs.cache-hit != 'true'
5349

54-
- name: Run ${{ matrix.hardfork }} state tests
55-
run: npm run ${{ format('testState{0}', matrix.hardfork) }}
50+
- run: npm run test:state:allForks
5651
env:
5752
CI: true
5853

5954
test-blockchain:
6055
runs-on: ubuntu-latest
61-
strategy:
62-
matrix:
63-
hardfork: ['', 'Petersburg']
64-
6556
steps:
6657
- uses: actions/setup-node@v1
6758
with:
@@ -79,7 +70,6 @@ jobs:
7970
- run: npm install
8071
if: steps.cache-node-modules.outputs.cache-hit != 'true'
8172

82-
- name: Run ${{ matrix.hardfork }} blockchain state tests
83-
run: npm run ${{ format('testBlockchain{0}', matrix.hardfork) }}
73+
- run: npm run test:blockchain
8474
env:
8575
CI: true

developer.md

+31-19
Original file line numberDiff line numberDiff line change
@@ -4,49 +4,61 @@
44

55
### Running Tests
66

7-
Tests can be found in the `tests` directory, with `FORK_CONFIG` set in `tests/tester.js`. There are test runners for [State tests](http://www.ethdocs.org/en/latest/contracts-and-transactions/ethereum-tests/state_tests/index.html) and [Blockchain tests](http://www.ethdocs.org/en/latest/contracts-and-transactions/ethereum-tests/blockchain_tests/index.html). VM tests are disabled since Frontier gas costs are not supported any more. Tests are then executed by the [ethereumjs-testing](https://github.com/ethereumjs/ethereumjs-testing) utility library using the official client-independent [Ethereum tests](https://github.com/ethereum/tests).
7+
Tests can be found in the `tests` directory. There are test runners for [State tests](http://www.ethdocs.org/en/latest/contracts-and-transactions/ethereum-tests/state_tests/index.html) and [Blockchain tests](http://www.ethdocs.org/en/latest/contracts-and-transactions/ethereum-tests/blockchain_tests/index.html). VM tests are disabled since Frontier gas costs are not supported any more. Tests are then executed by the [ethereumjs-testing](https://github.com/ethereumjs/ethereumjs-testing) utility library using the official client-independent [Ethereum tests](https://github.com/ethereum/tests).
88

9-
For a wider picture about how to use tests to implement EIPs you can have a look at this [reddit post](https://www.reddit.com/r/ethereum/comments/6kc5g3/ethereumjs_team_is_seeking_contributors/)
10-
or the associated YouTube video introduction to [core development with Ethereumjs-vm](https://www.youtube.com/watch?v=L0BVDl6HZzk&feature=youtu.be).
9+
For a wider picture about how to use tests to implement EIPs you can have a look at this [Reddit post](https://www.reddit.com/r/ethereum/comments/6kc5g3/ethereumjs_team_is_seeking_contributors/)
10+
or the associated YouTube video introduction to [Core Development with Ethereumjs-vm](https://www.youtube.com/watch?v=L0BVDl6HZzk).
1111

1212
#### Running different Test Types
1313

1414
Running the State tests:
1515

16-
`node ./tests/tester -s`
16+
`node ./tests/tester --state`
1717

1818
Running the Blockchain tests:
1919

20-
`node ./tests/tester -b`
20+
`node ./tests/tester --blockchain`
2121

22-
State tests and Blockchain tests can also be run against the `dist` folder (default: `lib`):
22+
Tests run against source by default. They can be run with the `--dist` flag:
2323

24-
`node ./tests/tester -b --dist`
24+
`npm run build:dist && node ./tests/tester --state --dist`
25+
26+
See `package.json` for all the scripts in the `test:` namespace, such as `npm run test:state` which would execute the above.
27+
28+
Use `--fork` to pass in the desired hardfork:
29+
30+
`node ./tests/tester --state --fork='Constantinople'`
31+
32+
or
33+
34+
`npm run test:state -- --fork='Constantinople'`
35+
36+
By default it is set to use the latest hardfork (`FORK_CONFIG` in `tests/tester.js`).
2537

2638
State tests run significantly faster than Blockchain tests, so it is often a good choice to start fixing State tests.
2739

2840
#### Running Specific Tests
2941

3042
Running all the blockchain tests in a file:
3143

32-
`node ./tests/tester -b --file='randomStatetest303'`
44+
`node ./tests/tester --blockchain --file='randomStatetest303'`
3345

3446
Running tests from a specific directory:
3547

36-
`node ./tests/tester -b --dir='bcBlockGasLimitTest'`
48+
`node ./tests/tester --blockchain --dir='bcBlockGasLimitTest'`
3749

3850
Running a specific state test case:
3951

40-
`node ./tests/tester -s --test='stackOverflow'`
52+
`node ./tests/tester --state --test='stackOverflow'`
4153

4254
Only run test cases with selected `data`, `gas` and/or `value` values (see
4355
[attribute description](http://ethereum-tests.readthedocs.io/en/latest/test_types/state_tests.html) in
4456
test docs), provided by the index of the array element in the test `transaction` section:
4557

46-
`node tests/tester -s --test='CreateCollisionToEmpty' --data=0 --gas=1 --value=0`
58+
`node ./tests/tester --state --test='CreateCollisionToEmpty' --data=0 --gas=1 --value=0`
4759

4860
Run a state test from a specified source file not under the `tests` directory:
49-
`node ./tests/tester -s --customStateTest='{path_to_file}'`
61+
`node ./tests/tester --state --customStateTest='{path_to_file}'`
5062

5163
#### Running tests with a reporter/formatter
5264

@@ -58,7 +70,7 @@ To pipe the results of the API tests through `tap-spec`:
5870

5971
To pipe the results of tests run with a node command through `tap-spec`:
6072

61-
`npm run formatTest -- -t "./tests/tester -b --dir='bcBlockGasLimitTest'"`
73+
`npm run formatTest -- -t "./tests/tester --blockchain --dir='bcBlockGasLimitTest'"`
6274

6375
The `-with` flag allows the specification of a formatter of your choosing:
6476

@@ -72,18 +84,18 @@ can be found in `tests/tester.js`. By default tests from all skip lists are omit
7284

7385
You can change this behaviour with:
7486

75-
`node tests/tester -s --skip=BROKEN,PERMANENT`
87+
`node ./tests/tester --state --skip=BROKEN,PERMANENT`
7688

7789
to skip only the `BROKEN` and `PERMANENT` tests and include the `SLOW` tests.
7890
There are also the keywords `NONE` or `ALL` for convenience.
7991

8092
It is also possible to only run the tests from the skip lists:
8193

82-
`node tests/tester -s --runSkipped=SLOW`
94+
`node ./tests/tester --state --runSkipped=SLOW`
8395

8496
### CI Test Integration
8597

86-
Tests are run on [Actions](https://github.com/ethereumjs/ethereumjs-vm/actions) on every PR, configuration can be found in `.github/workflows`.
98+
Tests and checks are run in CI using [Github Actions](https://github.com/ethereumjs/ethereumjs-vm/actions). The configuration can be found in `.github/workflows`.
8799

88100
### Debugging
89101

@@ -93,7 +105,7 @@ For state tests you can use the `--jsontrace` flag to output opcode trace inform
93105

94106
Blockchain tests support `--debug` to verify the postState:
95107

96-
`node ./tests/tester -b --debug --test='ZeroValue_SELFDESTRUCT_ToOneStorageKey_OOGRevert_d0g0v0_EIP158'`
108+
`node ./tests/tester --blockchain --debug --test='ZeroValue_SELFDESTRUCT_ToOneStorageKey_OOGRevert_d0g0v0_EIP158'`
97109

98110
All/most State tests are replicated as Blockchain tests in a `GeneralStateTests` [sub directory](https://github.com/ethereum/tests/tree/develop/BlockchainTests/GeneralStateTests) in the Ethereum tests repo, so for debugging single test cases the Blockchain test version of the State test can be used.
99111

@@ -125,8 +137,8 @@ An extremely rich and powerful toolbox is the [evmlab](https://github.com/holima
125137

126138
## Profiling
127139

128-
[Clinic](https://github.com/nearform/node-clinic) Allows profiling the VM in the node environment. It supports various profiling methods, among them is [flame](https://github.com/nearform/node-clinic-flame) which can be used for generating flamegraphs to highlight bottlenecks and hot paths. As an example, to generate a flamegraph for the VM blockchain tests, you can run:
140+
[Clinic](https://github.com/nearform/node-clinic) allows profiling the VM in the node environment. It supports various profiling methods, among them is [flame](https://github.com/nearform/node-clinic-flame) which can be used for generating flamegraphs to highlight bottlenecks and hot paths. As an example, to generate a flamegraph for the VM blockchain tests, you can run:
129141

130142
```sh
131-
NODE_OPTIONS="--max-old-space-size=4096" clinic flame -- node ./tests/tester.js -b --excludeDir='GeneralStateTests'
143+
NODE_OPTIONS="--max-old-space-size=4096" clinic flame -- node ./tests/tester.js --blockchain --excludeDir='GeneralStateTests'
132144
```

package.json

+10-13
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,18 @@
1010
"scripts": {
1111
"build:dist": "ethereumjs-config-build",
1212
"prepublishOnly": "npm run lint && npm run build:dist && npm run testBuildIntegrity",
13-
"coverage": "nyc npm run coverageTests && nyc report --reporter=text-lcov > .nyc_output/lcov.info",
14-
"coverageTests": "npm run build:dist && tape './tests/api/**/*.js' ./tests/tester.js -s --dist",
13+
"coverage": "nyc npm run coverage:test && nyc report --reporter=text-lcov > .nyc_output/lcov.info",
14+
"coverage:test": "npm run build:dist && tape './tests/api/**/*.js' ./tests/tester.js --state --dist",
1515
"coveralls": "npm run coverage && if [ -n \"$COVERALLS_REPO_TOKEN\" ]; then coveralls <.nyc_output/lcov.info; fi",
1616
"docs:build": "typedoc lib",
17-
"testVM": "node ./tests/tester -v",
18-
"testStateByzantium": "npm run build:dist && node ./tests/tester -s --fork='Byzantium' --dist",
19-
"testStateConstantinople": "npm run build:dist && node ./tests/tester -s --fork='Constantinople' --dist",
20-
"testStatePetersburg": "npm run build:dist && node ./tests/tester -s --fork='Petersburg' --dist",
21-
"testStateIstanbul": "npm run build:dist && node ./tests/tester -s --fork='Istanbul' --dist",
22-
"testBuildIntegrity": "npm run build:dist && node ./tests/tester -s --dist --test='stackOverflow'",
23-
"testBlockchain": "npm run build:dist && node --stack-size=1500 ./tests/tester -b --fork='Istanbul' --dist --excludeDir='GeneralStateTests'",
24-
"testBlockchainPetersburg": "npm run build:dist && node --stack-size=1500 ./tests/tester -b --fork='Petersburg' --dist --excludeDir='GeneralStateTests'",
25-
"testBlockchainGeneralStateTests": "npm run build:dist && node --stack-size=1500 ./tests/tester -b --dist --dir='GeneralStateTests'",
26-
"testAPI": "npm run build:dist && tape './tests/api/**/*.js'",
27-
"testAPI:browser": "npm run build:dist && karma start karma.conf.js",
17+
"test:vm": "node ./tests/tester --vm",
18+
"test:state": "npm run build:dist && node ./tests/tester --state --dist",
19+
"test:state:allForks": "npm run test:state -- --fork=Byzantium && npm run test:state -- --fork=Constantinople && npm run test:state -- --fork=Petersburg && npm run test:state -- --fork=Istanbul",
20+
"test:state:slow": "npm run test:state -- --runSkipped=slow",
21+
"test:buildIntegrity": "npm run test:state -- --test='stackOverflow'",
22+
"test:blockchain": "npm run build:dist && node --stack-size=1500 ./tests/tester --blockchain --dist",
23+
"test:API": "npm run build:dist && tape './tests/api/**/*.js'",
24+
"test:API:browser": "npm run build:dist && karma start karma.conf.js",
2825
"test": "echo \"[INFO] Generic test cmd not used. See package.json for more specific test run cmds.\"",
2926
"tslint": "ethereumjs-config-tslint",
3027
"tslint:fix": "ethereumjs-config-tslint-fix",

0 commit comments

Comments
 (0)