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 arrowGlacier HF #1527

Merged
merged 5 commits into from
Nov 8, 2021
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
2 changes: 2 additions & 0 deletions packages/block/test/difficulty.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ tape('[Header]: difficulty tests', (t) => {
require('./testdata/difficultyEIP2384_random.json').tests,
require('./testdata/difficultyEIP2384_random_to20M.json').tests
),
arrowGlacier: require('./testdata/difficultyArrowGlacier.json').difficultyArrowGlacier
.ArrowGlacier,
}

/* eslint-disable-next-line no-restricted-syntax */
Expand Down
7,056 changes: 7,056 additions & 0 deletions packages/block/test/testdata/difficultyArrowGlacier.json

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions packages/common/src/chains/mainnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@
"block": 12965000,
"forkHash": "0xb715077d"
},
{
"name": "arrowGlacier",
"block": 13773000,
"forkHash": "0x20c327fc"
},
{
"name": "merge",
"block": null,
Expand Down
17 changes: 17 additions & 0 deletions packages/common/src/eips/4345.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "EIP-4345",
"number": 4345,
"comment": "Difficulty Bomb Delay to June 2022",
"url": "https://eips.ethereum.org/EIPS/eip-4345",
"status": "Review",
"minimumHardfork": "london",
"gasConfig": {},
"gasPrices": {},
"vm": {},
"pow": {
"difficultyBombDelay": {
"v": 10700000,
"d": "the amount of blocks to delay the difficulty bomb with"
}
}
}
1 change: 1 addition & 0 deletions packages/common/src/eips/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ export const EIPs: eipsType = {
3541: require('./3541.json'),
3554: require('./3554.json'),
3675: require('./3675.json'),
4345: require('./4345.json'),
}
11 changes: 11 additions & 0 deletions packages/common/src/hardforks/arrowGlacier.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "arrowGlacier",
"comment": "HF to delay the difficulty bomb",
"url": "https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/arrow-glacier.md",
"status": "Final",
"eips": [4345],
"gasConfig": {},
"gasPrices": {},
"vm": {},
"pow": {}
}
1 change: 1 addition & 0 deletions packages/common/src/hardforks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ export const hardforks = [
['berlin', require('./berlin.json')],
['london', require('./london.json')],
['shanghai', require('./shanghai.json')],
['arrowGlacier', require('./arrowGlacier.json')],
['merge', require('./merge.json')],
]
1 change: 1 addition & 0 deletions packages/common/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ export enum Hardfork {
MuirGlacier = 'muirGlacier',
Berlin = 'berlin',
London = 'london',
ArrowGlacier = 'arrowGlacier',
Shanghai = 'shanghai',
Merge = 'merge',
}
Expand Down
9 changes: 6 additions & 3 deletions packages/common/tests/hardforks.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ tape('[Common]: Hardfork logic', function (t: tape.Test) {
Hardfork.Istanbul,
Hardfork.Berlin,
Hardfork.London,
Hardfork.ArrowGlacier,
Hardfork.Shanghai,
Hardfork.Merge,
]
Expand All @@ -40,7 +41,8 @@ tape('[Common]: Hardfork logic', function (t: tape.Test) {
st.equal(c.getHardforkByBlockNumber(9200000), Hardfork.MuirGlacier, msg)
st.equal(c.getHardforkByBlockNumber(12244000), Hardfork.Berlin, msg)
st.equal(c.getHardforkByBlockNumber(12965000), Hardfork.London, msg)
st.equal(c.getHardforkByBlockNumber(999999999999), Hardfork.London, msg)
st.equal(c.getHardforkByBlockNumber(13773000), Hardfork.ArrowGlacier, msg)
st.equal(c.getHardforkByBlockNumber(999999999999), Hardfork.ArrowGlacier, msg)

msg = 'should set HF correctly'

Expand All @@ -50,7 +52,8 @@ tape('[Common]: Hardfork logic', function (t: tape.Test) {
st.equal(c.setHardforkByBlockNumber(1400000), Hardfork.Homestead, msg)
st.equal(c.setHardforkByBlockNumber(12244000), Hardfork.Berlin, msg)
st.equal(c.setHardforkByBlockNumber(12965000), Hardfork.London, msg)
st.equal(c.setHardforkByBlockNumber(999999999999), Hardfork.London, msg)
st.equal(c.setHardforkByBlockNumber(13773000), Hardfork.ArrowGlacier, msg)
st.equal(c.setHardforkByBlockNumber(999999999999), Hardfork.ArrowGlacier, msg)

c = new Common({ chain: Chain.Ropsten })
st.equal(c.setHardforkByBlockNumber(0), 'tangerineWhistle', msg)
Expand Down Expand Up @@ -177,7 +180,7 @@ tape('[Common]: Hardfork logic', function (t: tape.Test) {

c = new Common({ chain: Chain.Mainnet })
msg = 'should return correct number of active HFs for mainnet'
st.equal(c.activeHardforks().length, 12, msg)
st.equal(c.activeHardforks().length, 13, msg)

c = new Common({ chain: Chain.Rinkeby })
msg = 'should return correct number of active HFs for rinkeby'
Expand Down
1 change: 1 addition & 0 deletions packages/vm/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ export default class VM extends AsyncEventEmitter {
'istanbul',
'muirGlacier',
'berlin',
'arrowGlacier',
]

this._common = new Common({
Expand Down