Skip to content

Commit 664369c

Browse files
authored
test: fix ecmul_0-3_5616_28000_96 (ethereumjs#473)
1 parent 9720565 commit 664369c

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed

tests/GeneralStateTestsRunner.js

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ const async = require('async')
22
const testUtil = require('./util')
33
const Trie = require('merkle-patricia-tree/secure')
44
const ethUtil = require('ethereumjs-util')
5+
const Account = require('ethereumjs-account')
56
const BN = ethUtil.BN
67
const { getRequiredForkConfigAlias } = require('./util')
78

@@ -100,8 +101,31 @@ function runTestCase (options, testData, t, cb) {
100101
tx: tx,
101102
block: block
102103
}, function (err, r) {
103-
err = null
104-
done()
104+
// If tx is invalid and coinbase is empty, the test harness
105+
// expects the coinbase account to be deleted from state.
106+
// Without this ecmul_0-3_5616_28000_96 would fail.
107+
if (err) {
108+
vm.stateManager.getAccount(block.header.coinbase, function (err, account) {
109+
if (err) {
110+
done()
111+
return
112+
}
113+
if (new BN(account.balance).isZero()) {
114+
async.series([
115+
(cb) => vm.stateManager.putAccount(block.header.coinbase, new Account(), cb),
116+
(cb) => vm.stateManager.cleanupTouchedAccounts(cb),
117+
(cb) => vm.stateManager._cache.flush(cb)
118+
], (err) => {
119+
err = null
120+
done()
121+
})
122+
} else {
123+
done()
124+
}
125+
})
126+
} else {
127+
done()
128+
}
105129
})
106130
} else {
107131
done()

tests/tester.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ const {
99
} = require('./util')
1010
// tests which should be fixed
1111
const skipBroken = [
12-
'ecmul_0-3_5616_28000_96', // temporary till fixed (2018-09-20)
1312
'dynamicAccountOverwriteEmpty' // temporary till fixed (2019-01-30), skipped along constantinopleFix work time constraints
1413
]
1514
// tests skipped due to system specifics / design considerations

0 commit comments

Comments
 (0)