Skip to content
This repository has been archived by the owner on Apr 6, 2020. It is now read-only.

Adds definition for HF Muir Glacier #75

Merged
merged 11 commits into from
Dec 9, 2019
6 changes: 6 additions & 0 deletions src/chains/mainnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@
"block": 9069000,
"consensus": "pow",
"finality": null
},
{
"name": "muirGlacier",
"block": 9200000,
"consensus": "pow",
"finality": null
}
],
"bootstrapNodes": [
Expand Down
6 changes: 6 additions & 0 deletions src/chains/ropsten.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@
"block": 6485846,
"consensus": "pow",
"finality": null
},
{
"name": "muirGlacier",
"block": 7117117,
"consensus": "pow",
"finality": null
holgerd77 marked this conversation as resolved.
Show resolved Hide resolved
}
],
"bootstrapNodes": [
Expand Down
1 change: 1 addition & 0 deletions src/hardforks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ export const hardforks = [
['constantinople', require('./constantinople.json')],
['petersburg', require('./petersburg.json')],
['istanbul', require('./istanbul.json')],
['muirGlacier', require('./muirGlacier.json')],
]
14 changes: 14 additions & 0 deletions src/hardforks/muirGlacier.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "muirGlacier",
"comment": "HF to delay the difficulty bomb",
"eip": {
"url": "https://eips.ethereum.org/EIPS/eip-2384",
"status": "PR"
evertonfraga marked this conversation as resolved.
Show resolved Hide resolved
},
"gasConfig": {},
"gasPrices": {},
"vm": {},
"pow": {},
"casper": {},
"sharding": {}
}
20 changes: 16 additions & 4 deletions tests/hardforks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ tape('[Common]: Hardfork logic', function(t: tape.Test) {

t.test('activeHardforks()', function(st: tape.Test) {
let c = new Common('ropsten')
let msg = 'should return 8 active hardforks for Ropsten'
st.equal(c.activeHardforks().length, 8, msg)
let msg = 'should return 9 active hardforks for Ropsten'
st.equal(c.activeHardforks().length, 9, msg)

msg = 'should return the correct HF data for Ropsten'
st.equal(c.activeHardforks()[3]['name'], 'spuriousDragon', msg)
Expand All @@ -80,13 +80,17 @@ tape('[Common]: Hardfork logic', function(t: tape.Test) {
msg = 'should return 2 active HFs when restricted to supported HFs'
st.equal(c.activeHardforks(null, { onlySupported: true }).length, 2, msg)

c = new Common('mainnet')
msg = 'should return 10 active HFs for mainnet'
st.equal(c.activeHardforks().length, 10, msg)

evertonfraga marked this conversation as resolved.
Show resolved Hide resolved
st.end()
})

t.test('activeHardfork()', function(st: tape.Test) {
let c = new Common('ropsten')
let msg = 'should return istanbul as latest active HF for Ropsten'
st.equal(c.activeHardfork(), 'istanbul', msg)
let msg = 'should return muirGlacier as latest active HF for Ropsten'
st.equal(c.activeHardfork(), 'muirGlacier', msg)

evertonfraga marked this conversation as resolved.
Show resolved Hide resolved
msg = 'should return spuriousDragon as latest active HF for Ropsten for block 10'
st.equal(c.activeHardfork(10), 'spuriousDragon', msg)
Expand Down Expand Up @@ -164,6 +168,14 @@ tape('[Common]: Hardfork logic', function(t: tape.Test) {
st.end()
})

t.test('hardforkGteHardfork() ropsten', function(st: tape.Test) {
const c = new Common('ropsten')
const msg = 'ropsten, spuriousDragon >= muirGlacier (provided) -> false'
st.equal(c.hardforkGteHardfork('spuriousDragon', 'muirGlacier'), false, msg)

st.end()
})

t.test('hardforkIsActiveOnChain()', function(st: tape.Test) {
let c = new Common('ropsten')
let msg = 'should return true for byzantium (provided) on Ropsten'
Expand Down