Skip to content
This repository was archived by the owner on Apr 6, 2020. It is now read-only.
Closed
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
10 changes: 3 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
language: node_js
node_js:
- "7"
- "8"
- "10"
- "12"
env:
- CXX=g++-4.8
addons:
firefox: latest
chrome: stable
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-4.8
before_install:
- sh -e /etc/init.d/xvfb start
env:
global:
- DISPLAY=:99.0
Expand All @@ -27,9 +26,6 @@ matrix:
- os: linux
node_js: "8"
env: CXX=g++-4.8 TEST_SUITE=lint
- os: linux
node_js: "7"
env: CXX=g++-4.8 TEST_SUITE=test:node
- os: linux
node_js: "8"
env: CXX=g++-4.8 TEST_SUITE=test:node
Expand Down
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,27 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
(modification: no type change headlines) and this project adheres to
[Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [2.2.2] - 2019-12-17
**MuirGlacier** support by updating to the new difficulty formula as stated
in [EIP-2384](https://eips.ethereum.org/EIPS/eip-2384).

Please note that this release does not contain all the changes merged into
master since the `v2.2.0` release and only backports the difficulty formula
adjustments to support MuirGlacier without having to go through migration to
the `v3.0.0` which contains breaking changes.

[2.2.2]: https://github.com/ethereumjs/ethereumjs-block/compare/v2.2.1...v2.2.2

## [2.2.1] - 2019-11-14
**Istanbul** support by updating to the most recent `ethereumjs-tx` version
[v2.1.1](https://github.com/ethereumjs/ethereumjs-tx/releases/tag/v2.1.1).

Please note that this release does not contain all the changes merged into
master since the `v2.2.0` release and only backports the most recent
`ethereumjs-tx` version to allow users to support Istanbul without having
to go through migration to the `v3.0.0` which contains breaking changes.

[2.2.1]: https://github.com/ethereumjs/ethereumjs-block/compare/v2.2.0...v2.2.1

## [2.2.0] - 2019-02-06
**Petersburg** (aka `constantinopleFix`) as well as **Goerli**
Expand Down
2 changes: 1 addition & 1 deletion from-rpc.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict'
const Transaction = require('ethereumjs-tx')
const { Transaction } = require('ethereumjs-tx')
const ethUtil = require('ethereumjs-util')
const Block = require('./')
const blockHeaderFromRpc = require('./header-from-rpc')
Expand Down
8 changes: 7 additions & 1 deletion header.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,13 @@ BlockHeader.prototype.canonicalDifficulty = function (parentBlock) {
dif = parentDif.add(offset.mul(a))
}

if (this._common.hardforkGteHardfork(hardfork, 'constantinople')) {
if (this._common.hardforkGteHardfork(hardfork, 'muirGlacier')) {
// Istanbul/Berlin difficulty bomb delay (EIP2384)
num.isubn(9000000)
if (num.ltn(0)) {
num = new BN(0)
}
} else if (this._common.hardforkGteHardfork(hardfork, 'constantinople')) {
// Constantinople difficulty bomb delay (EIP1234)
num.isubn(5000000)
if (num.ltn(0)) {
Expand Down
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const Common = require('ethereumjs-common').default
const ethUtil = require('ethereumjs-util')
const Tx = require('ethereumjs-tx')
const { Transaction } = require('ethereumjs-tx')
const Trie = require('merkle-patricia-tree')
const BN = ethUtil.BN
const rlp = ethUtil.rlp
Expand Down Expand Up @@ -72,7 +72,7 @@ var Block = module.exports = function (data, opts) {

// parse transactions
for (i = 0; i < rawTransactions.length; i++) {
var tx = new Tx(rawTransactions[i])
var tx = new Transaction(rawTransactions[i], opts)
tx._homestead = true
this.transactions.push(tx)
}
Expand Down
4 changes: 0 additions & 4 deletions karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ module.exports = function (config) {
enabled: true,
usePhantomJS: false,
postDetection: function (availableBrowser) {
if (process.env.TRAVIS) {
return ['Firefox']
}

var browsers = ['Chrome', 'Firefox']
return browsers.filter(function (browser) {
return availableBrowser.indexOf(browser) !== -1
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ethereumjs-block",
"version": "2.2.0",
"version": "2.2.2",
"description": "Provides Block serialization and help functions",
"main": "index.js",
"files": [
Expand Down Expand Up @@ -31,8 +31,8 @@
"homepage": "https://github.com/ethereumjs/ethereumjs-block#readme",
"dependencies": {
"async": "^2.0.1",
"ethereumjs-common": "^1.1.0",
"ethereumjs-tx": "^1.2.2",
"ethereumjs-common": "^1.5.0",
"ethereumjs-tx": "^2.1.1",
"ethereumjs-util": "^5.0.0",
"merkle-patricia-tree": "^2.1.2"
},
Expand Down
27 changes: 21 additions & 6 deletions tests/difficulty.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,15 @@ tape('[Header]: difficulty tests', t => {
}

const hardforkTestData = {
'chainstart': require('./difficultyFrontier.json').tests,
'homestead': require('./difficultyHomestead.json').tests,
'byzantium': require('./difficultyByzantium.json').tests,
'constantinople': require('./difficultyConstantinople.json').tests
chainstart: require('./difficultyFrontier.json').tests,
homestead: require('./difficultyHomestead.json').tests,
byzantium: require('./difficultyByzantium.json').tests,
constantinople: require('./difficultyConstantinople.json').tests,
muirGlacier: Object.assign(
require('./difficultyEIP2384.json').tests,
require('./difficultyEIP2384_random.json').tests,
require('./difficultyEIP2384_random_to20M.json').tests,
)
}
for (let hardfork in hardforkTestData) {
const testData = hardforkTestData[hardfork]
Expand All @@ -40,7 +45,12 @@ tape('[Header]: difficulty tests', t => {
block.header.difficulty = test.currentDifficulty
block.header.number = test.currentBlockNumber

runDifficultyTests(test, parentBlock, block, 'fork determination by hardfork param')
runDifficultyTests(
test,
parentBlock,
block,
`fork determination by hardfork param (${hardfork})`,
)
}
}

Expand All @@ -62,7 +72,12 @@ tape('[Header]: difficulty tests', t => {
block.header.difficulty = test.currentDifficulty
block.header.number = test.currentBlockNumber

runDifficultyTests(test, parentBlock, block, 'fork determination by block number')
runDifficultyTests(
test,
parentBlock,
block,
`fork determination by block number (${test.currentBlockNumber})`,
)
}
}

Expand Down
Loading