diff --git a/examples/run-blockchain/index.js b/examples/run-blockchain/index.js index 6394cb87dd..b10d1c424a 100644 --- a/examples/run-blockchain/index.js +++ b/examples/run-blockchain/index.js @@ -5,19 +5,20 @@ const Block = require('ethereumjs-block') const Blockchain = require('ethereumjs-blockchain') const BlockHeader = require('ethereumjs-block/header.js') const VM = require('../../') -const Level = require('levelup') +const level = require('level') +const levelMem = require('level-mem') const Account = require('ethereumjs-account') const utils = require('ethereumjs-util') const BN = utils.BN const rlp = utils.rlp const testData = require('./test-data') // inMemory blockchainDB -var blockchainDB = new Level('', { db: require('memdown') }) +var blockchainDB = levelMem() var state = new Trie() var blockchain = new Blockchain(blockchainDB) -blockchain.ethash.cacheDB = new Level('./.cachedb') +blockchain.ethash.cacheDB = level('./.cachedb') var vm = new VM({ state: state, diff --git a/package.json b/package.json index a7fc7f4258..0a10158400 100644 --- a/package.json +++ b/package.json @@ -50,13 +50,11 @@ "babel-preset-env": "^1.6.1", "coveralls": "^3.0.0", "documentation": "^8.1.2", - "ethereumjs-blockchain": "~3.3.0", + "ethereumjs-blockchain": "^3.3.3", "ethereumjs-testing": "git+https://github.com/ethereumjs/ethereumjs-testing.git#v1.2.5", "ethereumjs-tx": "1.3.7", - "level": "^1.4.0", - "leveldown": "^1.4.6", - "levelup": "^1.3.2", - "memdown": "^1.1.0", + "level": "^4.0.0", + "level-mem": "^3.0.1", "minimist": "^1.1.1", "nyc": "^12.0.2", "standard": "^10.0.0", diff --git a/tests/BlockchainTestsRunner.js b/tests/BlockchainTestsRunner.js index 3ae18625d3..8c3426d18d 100644 --- a/tests/BlockchainTestsRunner.js +++ b/tests/BlockchainTestsRunner.js @@ -5,13 +5,12 @@ const Trie = require('merkle-patricia-tree/secure') const Block = require('ethereumjs-block') const Blockchain = require('ethereumjs-blockchain') const BlockHeader = require('ethereumjs-block/header.js') -const Level = require('levelup') +const level = require('level') +const levelMem = require('level-mem') -var cacheDB = new Level('./.cachedb') +var cacheDB = level('./.cachedb') module.exports = function runBlockchainTest (options, testData, t, cb) { - var blockchainDB = new Level('', { - db: require('memdown') - }) + var blockchainDB = levelMem() var state = new Trie() var validate = false // Only run with block validation when sealEngine present in test file diff --git a/tests/api/runBlockchain.js b/tests/api/runBlockchain.js index fb9efaea1e..ab1251ccec 100644 --- a/tests/api/runBlockchain.js +++ b/tests/api/runBlockchain.js @@ -1,6 +1,5 @@ const tape = require('tape') -const Levelup = require('levelup') -const Memdown = require('memdown') +const level = require('level-mem') const { promisify } = require('util') const Blockchain = require('ethereumjs-blockchain') const Block = require('ethereumjs-block') @@ -10,7 +9,7 @@ const StateManager = require('../../lib/stateManager') const { createGenesis } = require('./utils') tape('runBlockchain', (t) => { - const blockchainDB = new Levelup('', { db: Memdown }) + const blockchainDB = level() const blockchain = new Blockchain({ db: blockchainDB }) const vm = { stateManager: new StateManager(), blockchain } diff --git a/tests/api/utils.js b/tests/api/utils.js index c833960998..e29555acfe 100644 --- a/tests/api/utils.js +++ b/tests/api/utils.js @@ -1,6 +1,6 @@ const Block = require('ethereumjs-block') const Account = require('ethereumjs-account') -const Level = require('levelup') +const level = require('level-mem') const Blockchain = require('ethereumjs-blockchain') const VM = require('../../lib/index') @@ -21,9 +21,7 @@ function createAccount (nonce, balance) { } function setupVM () { - const db = new Level('', { - db: require('memdown') - }) + const db = level() const blockchain = new Blockchain(db) const vm = new VM({ blockchain })