Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade ethereumjs-blockchain and level #414

Merged
merged 1 commit into from
Jan 7, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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