Skip to content

Commit bc9d567

Browse files
add util.promisify as a dependency to blockchain
[VM] fix browser test [VM] promisify util
1 parent 45e7b5d commit bc9d567

File tree

3 files changed

+11
-8
lines changed

3 files changed

+11
-8
lines changed

packages/blockchain/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@
4444
"level-mem": "^3.0.1",
4545
"lru-cache": "^5.1.1",
4646
"rlp": "^2.2.3",
47-
"semaphore": "^1.1.0"
47+
"semaphore": "^1.1.0",
48+
"util.promisify": "^1.0.1"
4849
},
4950
"devDependencies": {
5051
"@ethereumjs/config-nyc": "^1.1.1",

packages/vm/tests/api/state/stateManager.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,11 +162,14 @@ tape('StateManager', t => {
162162
},
163163
)
164164
t.test('should generate the genesis state root correctly for mainnet from ethereum/tests data', async st => {
165+
if (isRunningInKarma()) {
166+
st.skip('skip slow test when running in karma')
167+
return st.end()
168+
}
165169
const genesisData = require('ethereumjs-testing').getSingleFile(
166170
'BasicTests/genesishashestest.json',
167-
)
171+
)
168172
const stateManager = new StateManager()
169-
170173
await stateManager.generateCanonicalGenesis()
171174
let stateRoot = await stateManager.getStateRoot()
172175
st.equals(

packages/vm/tests/util.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ const { BN, rlp, keccak256, stripHexPrefix, setLengthLeft } = require('ethereumj
22
const Account = require('@ethereumjs/account').default
33
const Transaction = require('@ethereumjs/tx').Transaction
44
const Block = require('@ethereumjs/block').Block
5+
const promisify = require('util.promisify')
56

67
exports.dumpState = function (state, cb) {
78
function readAccounts(state) {
@@ -126,11 +127,9 @@ exports.verifyPostConditions = function (state, testData, t, cb) {
126127
delete keyMap[key]
127128

128129
if (testData) {
129-
q.push(new Promise((resolve, reject) => {
130-
exports.verifyAccountPostConditions(state, address, account, testData, t, function() {
131-
resolve()
132-
})
133-
}))
130+
q.push(
131+
promisify(exports.verifyAccountPostConditions)(state, address, account, testData, t)
132+
)
134133
} else {
135134
t.fail('invalid account in the trie: ' + key)
136135
}

0 commit comments

Comments
 (0)