Skip to content

Commit

Permalink
Upgrade ethereumjs-blockchain and level
Browse files Browse the repository at this point in the history
Signed-off-by: Sina Mahmoodi <itz.s1na@gmail.com>

- Upgrade ethereumjs-blockchain to v3.3.3
- Upgrade devDeps to level v4.0.0 and level-mem v3.0.1
- Fix level dep in api tests
  • Loading branch information
s1na committed Jan 7, 2019
1 parent 2bb7eb4 commit 68a28e8
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 20 deletions.
7 changes: 4 additions & 3 deletions examples/run-blockchain/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 3 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
9 changes: 4 additions & 5 deletions tests/BlockchainTestsRunner.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions tests/api/runBlockchain.js
Original file line number Diff line number Diff line change
@@ -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')
Expand All @@ -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 }

Expand Down
6 changes: 2 additions & 4 deletions tests/api/utils.js
Original file line number Diff line number Diff line change
@@ -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')

Expand All @@ -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 })

Expand Down

0 comments on commit 68a28e8

Please sign in to comment.