@@ -4,12 +4,11 @@ const Trie = require('merkle-patricia-tree/secure')
4
4
const ethUtil = require ( 'ethereumjs-util' )
5
5
const Account = require ( 'ethereumjs-account' ) . default
6
6
const BN = ethUtil . BN
7
- const { getRequiredForkConfigAlias } = require ( './util' )
8
7
9
- function parseTestCases ( forkConfig , testData , data , gasLimit , value ) {
8
+ function parseTestCases ( forkConfigTestSuite , testData , data , gasLimit , value ) {
10
9
let testCases = [ ]
11
- if ( testData [ 'post' ] [ forkConfig ] ) {
12
- testCases = testData [ 'post' ] [ forkConfig ] . map ( testCase => {
10
+ if ( testData [ 'post' ] [ forkConfigTestSuite ] ) {
11
+ testCases = testData [ 'post' ] [ forkConfigTestSuite ] . map ( testCase => {
13
12
let testIndexes = testCase [ 'indexes' ]
14
13
let tx = { ...testData . transaction }
15
14
if ( data !== undefined && testIndexes [ 'data' ] !== data ) {
@@ -57,12 +56,12 @@ function runTestCase (options, testData, t, cb) {
57
56
}
58
57
vm = new VM ( {
59
58
state : state ,
60
- hardfork : options . forkConfig . toLowerCase ( )
59
+ hardfork : options . forkConfigVM
61
60
} )
62
61
testUtil . setupPreConditions ( state , testData , done )
63
62
} ,
64
63
function ( done ) {
65
- var tx = testUtil . makeTx ( testData . transaction , options . forkConfig . toLowerCase ( ) )
64
+ var tx = testUtil . makeTx ( testData . transaction , options . forkConfigVM )
66
65
block = testUtil . makeBlockFromEnv ( testData . env )
67
66
tx . _homestead = true
68
67
tx . enableHomestead = true
@@ -146,19 +145,18 @@ function runTestCase (options, testData, t, cb) {
146
145
}
147
146
148
147
module . exports = function runStateTest ( options , testData , t , cb ) {
149
- const forkConfig = getRequiredForkConfigAlias ( options . forkConfig )
150
148
try {
151
- const testCases = parseTestCases ( forkConfig , testData , options . data , options . gasLimit , options . value )
149
+ const testCases = parseTestCases ( options . forkConfigTestSuite , testData , options . data , options . gasLimit , options . value )
152
150
if ( testCases . length > 0 ) {
153
151
async . eachSeries ( testCases ,
154
152
( testCase , done ) => runTestCase ( options , testCase , t , done ) ,
155
153
cb )
156
154
} else {
157
- t . comment ( `No ${ forkConfig } post state defined, skip test` )
155
+ t . comment ( `No ${ options . forkConfigTestSuite } post state defined, skip test` )
158
156
cb ( )
159
157
}
160
158
} catch ( e ) {
161
- t . fail ( 'error running test case for fork: ' + forkConfig )
159
+ t . fail ( 'error running test case for fork: ' + options . forkConfigTestSuite )
162
160
console . log ( 'error:' , e )
163
161
cb ( )
164
162
}
0 commit comments