From 64378faffda831d5542250b0df2bb6d8f1a76e87 Mon Sep 17 00:00:00 2001 From: Everton Fraga Date: Thu, 21 Nov 2019 16:25:58 -0500 Subject: [PATCH 01/11] Adding information and basic tests for eip2384 --- src/chains/mainnet.json | 6 ++++++ src/hardforks/index.ts | 1 + tests/hardforks.ts | 4 ++++ 3 files changed, 11 insertions(+) diff --git a/src/chains/mainnet.json b/src/chains/mainnet.json index c99db76..c7dc10c 100644 --- a/src/chains/mainnet.json +++ b/src/chains/mainnet.json @@ -67,6 +67,12 @@ "block": 9069000, "consensus": "pow", "finality": null + }, + { + "name": "eip2384", + "block": 9169000, + "consensus": "pow", + "finality": null } ], "bootstrapNodes": [ diff --git a/src/hardforks/index.ts b/src/hardforks/index.ts index 308921f..b8caba0 100644 --- a/src/hardforks/index.ts +++ b/src/hardforks/index.ts @@ -8,4 +8,5 @@ export const hardforks = [ ['constantinople', require('./constantinople.json')], ['petersburg', require('./petersburg.json')], ['istanbul', require('./istanbul.json')], + ['eip2384', require('./eip2384.json')], ] diff --git a/tests/hardforks.ts b/tests/hardforks.ts index 9005d22..446b3fb 100644 --- a/tests/hardforks.ts +++ b/tests/hardforks.ts @@ -80,6 +80,10 @@ 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) + st.end() }) From 63f5d485649ad4393cca4a8794202a464ead2675 Mon Sep 17 00:00:00 2001 From: Everton Fraga Date: Fri, 22 Nov 2019 17:07:49 -0500 Subject: [PATCH 02/11] Adding new fork to Ropsten and adjusting tests --- src/chains/ropsten.json | 6 ++++++ tests/hardforks.ts | 16 ++++++++++++---- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/src/chains/ropsten.json b/src/chains/ropsten.json index cc691bf..f2ed3bc 100644 --- a/src/chains/ropsten.json +++ b/src/chains/ropsten.json @@ -67,6 +67,12 @@ "block": 6485846, "consensus": "pow", "finality": null + }, + { + "name": "eip2384", + "block": 6585846, + "consensus": "pow", + "finality": null } ], "bootstrapNodes": [ diff --git a/tests/hardforks.ts b/tests/hardforks.ts index 446b3fb..6e1cb0c 100644 --- a/tests/hardforks.ts +++ b/tests/hardforks.ts @@ -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) @@ -89,8 +89,8 @@ tape('[Common]: Hardfork logic', function(t: tape.Test) { 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 eip2384 as latest active HF for Ropsten' + st.equal(c.activeHardfork(), 'eip2384', msg) msg = 'should return spuriousDragon as latest active HF for Ropsten for block 10' st.equal(c.activeHardfork(10), 'spuriousDragon', msg) @@ -168,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 >= eip2384 (provided) -> false' + st.equal(c.hardforkGteHardfork('spuriousDragon', 'eip2384'), 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' From c6b12fb71541d0e53ddb640e5cb99241d64c0306 Mon Sep 17 00:00:00 2001 From: Everton Fraga Date: Fri, 22 Nov 2019 17:13:37 -0500 Subject: [PATCH 03/11] renaming eip2384 to mountainGlacier (Meta EIP 2387) --- src/chains/mainnet.json | 2 +- src/chains/ropsten.json | 2 +- src/hardforks/index.ts | 2 +- tests/hardforks.ts | 8 ++++---- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/chains/mainnet.json b/src/chains/mainnet.json index c7dc10c..9a24354 100644 --- a/src/chains/mainnet.json +++ b/src/chains/mainnet.json @@ -69,7 +69,7 @@ "finality": null }, { - "name": "eip2384", + "name": "mountainGlacier", "block": 9169000, "consensus": "pow", "finality": null diff --git a/src/chains/ropsten.json b/src/chains/ropsten.json index f2ed3bc..674c821 100644 --- a/src/chains/ropsten.json +++ b/src/chains/ropsten.json @@ -69,7 +69,7 @@ "finality": null }, { - "name": "eip2384", + "name": "mountainGlacier", "block": 6585846, "consensus": "pow", "finality": null diff --git a/src/hardforks/index.ts b/src/hardforks/index.ts index b8caba0..22a9c57 100644 --- a/src/hardforks/index.ts +++ b/src/hardforks/index.ts @@ -8,5 +8,5 @@ export const hardforks = [ ['constantinople', require('./constantinople.json')], ['petersburg', require('./petersburg.json')], ['istanbul', require('./istanbul.json')], - ['eip2384', require('./eip2384.json')], + ['mountainGlacier', require('./mountainGlacier.json')], ] diff --git a/tests/hardforks.ts b/tests/hardforks.ts index 6e1cb0c..06dd6ba 100644 --- a/tests/hardforks.ts +++ b/tests/hardforks.ts @@ -89,8 +89,8 @@ tape('[Common]: Hardfork logic', function(t: tape.Test) { t.test('activeHardfork()', function(st: tape.Test) { let c = new Common('ropsten') - let msg = 'should return eip2384 as latest active HF for Ropsten' - st.equal(c.activeHardfork(), 'eip2384', msg) + let msg = 'should return mountainGlacier as latest active HF for Ropsten' + st.equal(c.activeHardfork(), 'mountainGlacier', msg) msg = 'should return spuriousDragon as latest active HF for Ropsten for block 10' st.equal(c.activeHardfork(10), 'spuriousDragon', msg) @@ -170,8 +170,8 @@ tape('[Common]: Hardfork logic', function(t: tape.Test) { t.test('hardforkGteHardfork() ropsten', function(st: tape.Test) { const c = new Common('ropsten') - const msg = 'ropsten, spuriousDragon >= eip2384 (provided) -> false' - st.equal(c.hardforkGteHardfork('spuriousDragon', 'eip2384'), false, msg) + const msg = 'ropsten, spuriousDragon >= mountainGlacier (provided) -> false' + st.equal(c.hardforkGteHardfork('spuriousDragon', 'mountainGlacier'), false, msg) st.end() }) From 5fa2d121093f63e7423bb25f7c4ad15aba9f5c18 Mon Sep 17 00:00:00 2001 From: Everton Fraga Date: Sat, 23 Nov 2019 18:31:24 -0500 Subject: [PATCH 04/11] Adding fork file --- src/hardforks/mountainGlacier.json | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 src/hardforks/mountainGlacier.json diff --git a/src/hardforks/mountainGlacier.json b/src/hardforks/mountainGlacier.json new file mode 100644 index 0000000..18bb154 --- /dev/null +++ b/src/hardforks/mountainGlacier.json @@ -0,0 +1,14 @@ +{ + "name": "mountainGlacier", + "comment": "HF to delay the difficulty bomb", + "eip": { + "url": "https://github.com/ethereum/EIPs/pull/2384", + "status": "PR" + }, + "gasConfig": {}, + "gasPrices": {}, + "vm": {}, + "pow": {}, + "casper": {}, + "sharding": {} +} From fa7c6206bbcfb7062e86f50ab73ccadaffb3f4b3 Mon Sep 17 00:00:00 2001 From: Everton Fraga Date: Wed, 4 Dec 2019 13:36:03 -0500 Subject: [PATCH 05/11] Rename Mountain Glacier to Muir Glacier --- src/chains/mainnet.json | 2 +- src/chains/ropsten.json | 2 +- src/hardforks/index.ts | 2 +- src/hardforks/{mountainGlacier.json => muirGlacier.json} | 2 +- tests/hardforks.ts | 8 ++++---- 5 files changed, 8 insertions(+), 8 deletions(-) rename src/hardforks/{mountainGlacier.json => muirGlacier.json} (89%) diff --git a/src/chains/mainnet.json b/src/chains/mainnet.json index 9a24354..73ae18a 100644 --- a/src/chains/mainnet.json +++ b/src/chains/mainnet.json @@ -69,7 +69,7 @@ "finality": null }, { - "name": "mountainGlacier", + "name": "muirGlacier", "block": 9169000, "consensus": "pow", "finality": null diff --git a/src/chains/ropsten.json b/src/chains/ropsten.json index 674c821..dd29436 100644 --- a/src/chains/ropsten.json +++ b/src/chains/ropsten.json @@ -69,7 +69,7 @@ "finality": null }, { - "name": "mountainGlacier", + "name": "muirGlacier", "block": 6585846, "consensus": "pow", "finality": null diff --git a/src/hardforks/index.ts b/src/hardforks/index.ts index 22a9c57..a63630d 100644 --- a/src/hardforks/index.ts +++ b/src/hardforks/index.ts @@ -8,5 +8,5 @@ export const hardforks = [ ['constantinople', require('./constantinople.json')], ['petersburg', require('./petersburg.json')], ['istanbul', require('./istanbul.json')], - ['mountainGlacier', require('./mountainGlacier.json')], + ['muirGlacier', require('./muirGlacier.json')], ] diff --git a/src/hardforks/mountainGlacier.json b/src/hardforks/muirGlacier.json similarity index 89% rename from src/hardforks/mountainGlacier.json rename to src/hardforks/muirGlacier.json index 18bb154..a34524d 100644 --- a/src/hardforks/mountainGlacier.json +++ b/src/hardforks/muirGlacier.json @@ -1,5 +1,5 @@ { - "name": "mountainGlacier", + "name": "muirGlacier", "comment": "HF to delay the difficulty bomb", "eip": { "url": "https://github.com/ethereum/EIPs/pull/2384", diff --git a/tests/hardforks.ts b/tests/hardforks.ts index 06dd6ba..7959217 100644 --- a/tests/hardforks.ts +++ b/tests/hardforks.ts @@ -89,8 +89,8 @@ tape('[Common]: Hardfork logic', function(t: tape.Test) { t.test('activeHardfork()', function(st: tape.Test) { let c = new Common('ropsten') - let msg = 'should return mountainGlacier as latest active HF for Ropsten' - st.equal(c.activeHardfork(), 'mountainGlacier', msg) + let msg = 'should return muirGlacier as latest active HF for Ropsten' + st.equal(c.activeHardfork(), 'muirGlacier', msg) msg = 'should return spuriousDragon as latest active HF for Ropsten for block 10' st.equal(c.activeHardfork(10), 'spuriousDragon', msg) @@ -170,8 +170,8 @@ tape('[Common]: Hardfork logic', function(t: tape.Test) { t.test('hardforkGteHardfork() ropsten', function(st: tape.Test) { const c = new Common('ropsten') - const msg = 'ropsten, spuriousDragon >= mountainGlacier (provided) -> false' - st.equal(c.hardforkGteHardfork('spuriousDragon', 'mountainGlacier'), false, msg) + const msg = 'ropsten, spuriousDragon >= muirGlacier (provided) -> false' + st.equal(c.hardforkGteHardfork('spuriousDragon', 'muirGlacier'), false, msg) st.end() }) From 8a53f11fb50e5edd152fc1ecf6fa86520309fb1e Mon Sep 17 00:00:00 2001 From: Everton Fraga Date: Wed, 4 Dec 2019 13:36:33 -0500 Subject: [PATCH 06/11] Update fork URL with canonical EIP URL --- src/hardforks/muirGlacier.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hardforks/muirGlacier.json b/src/hardforks/muirGlacier.json index a34524d..e54962b 100644 --- a/src/hardforks/muirGlacier.json +++ b/src/hardforks/muirGlacier.json @@ -2,7 +2,7 @@ "name": "muirGlacier", "comment": "HF to delay the difficulty bomb", "eip": { - "url": "https://github.com/ethereum/EIPs/pull/2384", + "url": "https://eips.ethereum.org/EIPS/eip-2384", "status": "PR" }, "gasConfig": {}, From a93bb45eb1cc6e372351e61bb31fddc8849460a9 Mon Sep 17 00:00:00 2001 From: Everton Fraga Date: Wed, 4 Dec 2019 13:43:15 -0500 Subject: [PATCH 07/11] Set fork blocks for mainnet and ropsten --- src/chains/mainnet.json | 2 +- src/chains/ropsten.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/chains/mainnet.json b/src/chains/mainnet.json index 73ae18a..2a60a7d 100644 --- a/src/chains/mainnet.json +++ b/src/chains/mainnet.json @@ -70,7 +70,7 @@ }, { "name": "muirGlacier", - "block": 9169000, + "block": 9200000, "consensus": "pow", "finality": null } diff --git a/src/chains/ropsten.json b/src/chains/ropsten.json index dd29436..6a2ab16 100644 --- a/src/chains/ropsten.json +++ b/src/chains/ropsten.json @@ -70,7 +70,7 @@ }, { "name": "muirGlacier", - "block": 6585846, + "block": 7117117, "consensus": "pow", "finality": null } From 3d06a91ee6559e26d1241158d4c26ecaaba62acc Mon Sep 17 00:00:00 2001 From: Everton Fraga Date: Mon, 9 Dec 2019 11:35:25 -0500 Subject: [PATCH 08/11] Changing EIP status --- src/hardforks/muirGlacier.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hardforks/muirGlacier.json b/src/hardforks/muirGlacier.json index e54962b..b2420eb 100644 --- a/src/hardforks/muirGlacier.json +++ b/src/hardforks/muirGlacier.json @@ -3,7 +3,7 @@ "comment": "HF to delay the difficulty bomb", "eip": { "url": "https://eips.ethereum.org/EIPS/eip-2384", - "status": "PR" + "status": "Last Call" }, "gasConfig": {}, "gasPrices": {}, From cd91f827349a4c6e5147ced91b43d56858eb2a14 Mon Sep 17 00:00:00 2001 From: Everton Fraga Date: Mon, 9 Dec 2019 14:01:21 -0500 Subject: [PATCH 09/11] Adding tests for Rinkeby and Goerli --- tests/hardforks.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/hardforks.ts b/tests/hardforks.ts index 7959217..4babe3a 100644 --- a/tests/hardforks.ts +++ b/tests/hardforks.ts @@ -84,6 +84,14 @@ tape('[Common]: Hardfork logic', function(t: tape.Test) { msg = 'should return 10 active HFs for mainnet' st.equal(c.activeHardforks().length, 10, msg) + c = new Common('rinkeby') + msg = 'should return 8 active HFs for rinkeby' + st.equal(c.activeHardforks().length, 8, msg) + + c = new Common('goerli') + msg = 'should return 9 active HFs for goerli' + st.equal(c.activeHardforks().length, 9, msg) + st.end() }) From 3abbd633fcc0e493ff6f4395e7ae6ca5e567d858 Mon Sep 17 00:00:00 2001 From: Everton Fraga Date: Mon, 9 Dec 2019 14:01:32 -0500 Subject: [PATCH 10/11] Lint:fix --- tests/chains.ts | 4 ++-- tests/params.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/chains.ts b/tests/chains.ts index 8492f2d..27a311e 100644 --- a/tests/chains.ts +++ b/tests/chains.ts @@ -26,7 +26,7 @@ tape('[Common]: Initialization / Chain params', function(t: tape.Test) { t.test('Should initialize with supportedHardforks provided', function(st: tape.Test) { const c = new Common('mainnet', 'byzantium', ['byzantium', 'constantinople']) st.equal(c._isSupportedHardfork('byzantium'), true, 'should return true for supported HF') - let msg = 'should return false for unsupported HF' + const msg = 'should return false for unsupported HF' st.equal(c._isSupportedHardfork('spuriousDragon'), false, msg) st.end() @@ -56,7 +56,7 @@ tape('[Common]: Initialization / Chain params', function(t: tape.Test) { t.test('Should provide correct access to chain parameters', function(st: tape.Test) { const c = new Common('mainnet') - let hash = '0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3' + const hash = '0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3' st.equal(c.genesis().hash, hash, 'should return correct genesis hash') st.equal(c.hardforks()[3]['block'], 2463000, 'should return correct hardfork data') st.equal(c.bootstrapNodes()[0].port, 30303, 'should return a bootstrap node array') diff --git a/tests/params.ts b/tests/params.ts index 3f82269..d59f92c 100644 --- a/tests/params.ts +++ b/tests/params.ts @@ -55,7 +55,7 @@ tape('[Common]: Parameter access', function(t: tape.Test) { t.test('Parameter updates', function(st: tape.Test) { const c = new Common('mainnet') - let f = function() { + const f = function() { c.param('gasPrices', 'ecAdd', 'spuriousDragon') } let msg = 'Should throw for a value set on a later HF' From 28ae896e77eac5984f03b9a06a3aa129748b2d10 Mon Sep 17 00:00:00 2001 From: Everton Fraga Date: Mon, 9 Dec 2019 14:16:53 -0500 Subject: [PATCH 11/11] Testing activeHardFork for Rinkeby --- tests/hardforks.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/hardforks.ts b/tests/hardforks.ts index 4babe3a..0281f75 100644 --- a/tests/hardforks.ts +++ b/tests/hardforks.ts @@ -107,6 +107,10 @@ tape('[Common]: Hardfork logic', function(t: tape.Test) { msg = 'should return spuriousDragon as latest active HF for Ropsten with limited supported HFs' st.equal(c.activeHardfork(null, { onlySupported: true }), 'spuriousDragon', msg) + c = new Common('rinkeby') + msg = 'should return Istanbul as latest active HF for Rinkeby' + st.equal(c.activeHardfork(), 'istanbul', msg) + st.end() })