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

Add support for ethereumjs-block 2.x and ethereumjs-blockchain 3.2.x #325

Merged
merged 1 commit into from
Aug 29, 2018
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
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
"async": "^2.1.2",
"async-eventemitter": "^0.2.2",
"ethereumjs-account": "^2.0.3",
"ethereumjs-block": "~1.7.0",
"ethereumjs-block": "~2.0.1",
"ethereumjs-common": "~0.4.0",
"ethereumjs-util": "^5.2.0",
"fake-merkle-patricia-tree": "^1.0.1",
Expand All @@ -50,7 +50,7 @@
"babel-cli": "^6.26.0",
"babel-preset-env": "^1.6.1",
"coveralls": "^3.0.0",
"ethereumjs-blockchain": "~2.1.0",
"ethereumjs-blockchain": "~3.2.1",
"ethereumjs-testing": "git+https://github.com/ethereumjs/ethereumjs-testing.git#v1.1.1",
"ethereumjs-tx": "1.3.3",
"level": "^1.4.0",
Expand Down
15 changes: 11 additions & 4 deletions tests/BlockchainTestsRunner.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ module.exports = function runBlockchainTest (options, testData, t, cb) {
db: require('memdown')
})
var state = new Trie()
var blockchain = new Blockchain(blockchainDB)
var blockchain = new Blockchain({
db: blockchainDB,
hardfork: options.forkConfig.toLowerCase()
})
blockchain.ethash.cacheDB = cacheDB
var VM
if (options.dist) {
Expand All @@ -26,7 +29,7 @@ module.exports = function runBlockchainTest (options, testData, t, cb) {
blockchain: blockchain,
hardfork: options.forkConfig.toLowerCase()
})
var genesisBlock = new Block()
var genesisBlock = new Block({ hardfork: options.forkConfig.toLowerCase() })

testData.homestead = true
if (testData.homestead) {
Expand All @@ -48,7 +51,9 @@ module.exports = function runBlockchainTest (options, testData, t, cb) {
},
function (done) {
// create and add genesis block
genesisBlock.header = new BlockHeader(formatBlockHeader(testData.genesisBlockHeader))
genesisBlock.header = new BlockHeader(formatBlockHeader(testData.genesisBlockHeader), {
hardfork: options.forkConfig.toLowerCase()
})
t.equal(state.root.toString('hex'), genesisBlock.header.stateRoot.toString('hex'), 'correct pre stateRoot')
if (testData.genesisRLP) {
t.equal(genesisBlock.serialize().toString('hex'), testData.genesisRLP.slice(2), 'correct genesis RLP')
Expand All @@ -60,7 +65,9 @@ module.exports = function runBlockchainTest (options, testData, t, cb) {
function (done) {
async.eachSeries(testData.blocks, function (raw, cb) {
try {
var block = new Block(Buffer.from(raw.rlp.slice(2), 'hex'))
var block = new Block(Buffer.from(raw.rlp.slice(2), 'hex'), {
hardfork: options.forkConfig.toLowerCase()
})
// forces the block into thinking they are homestead
if (testData.homestead) {
block.header.isHomestead = function () {
Expand Down