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

Grayglacier HF Support (master) #1983

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/block/test/difficulty.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ const hardforkTestData: TestData = {
arrowGlacier:
require('../../ethereum-tests/DifficultyTests/dfArrowGlacier/difficultyArrowGlacier.json')
.difficultyArrowGlacier.ArrowGlacier,
grayGlacier:
require('../../ethereum-tests/DifficultyTests/dfGrayGlacier/difficultyGrayGlacier.json')
.difficultyGrayGlacier.GrayGlacier,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So to your question with the tests: just copy the whole file over and move to the local Block test data folder and reference through the local path. You can maybe add a TODO here that this should be replaced with the ethereum-tests folder again at some point.

}

const chainTestData: TestData = {
Expand Down
5 changes: 5 additions & 0 deletions packages/common/src/chains/mainnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@
"block": 13773000,
"forkHash": "0x20c327fc"
},
{
"name": "grayGlacier",
"block": 15050000,
"forkHash": null
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please calculate an explicit forkHash here, you can do this with the respective method in the Common library. If you would get some confirmation that the forkHash is correct - e.g. by looking at other client implementation GrayGlacier HF PRs - that would also be good.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok. the grayGlacier markdown file had forkHash: TBA -- i'll check with other clients

},
{
"name": "mergeForkIdTransition",
"block": null,
Expand Down
17 changes: 17 additions & 0 deletions packages/common/src/eips/5133.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"name": "EIP-5133",
"number": 5133,
"comment": "Delaying Difficulty Bomb to mid-September 2022",
"url": "https://eips.ethereum.org/EIPS/eip-5133",
"status": "Draft",
"minimumHardfork": "grayGlacier",
"gasConfig": {},
"gasPrices": {},
"vm": {},
"pow": {
"difficultyBombDelay": {
"v": 11400000,
"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 @@ -21,4 +21,5 @@ export const EIPs: { [key: number]: any } = {
3860: require('./3860.json'),
4345: require('./4345.json'),
4399: require('./4399.json'),
5133: require('./5133.json'),
}
1 change: 1 addition & 0 deletions packages/common/src/enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export enum Hardfork {
Berlin = 'berlin',
London = 'london',
ArrowGlacier = 'arrowGlacier',
GrayGlacier = 'grayGlacier',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated, but since you are already working on the code: can you please move Shanghai to the last position here? This is some relic from times where people thought Shanghai would happen before the Merge. 😋

(general note: please do all change requests on both PRs, maybe do all in one commit and then cherry-pick over?)

Shanghai = 'shanghai',
MergeForkIdTransition = 'mergeForkIdTransition',
Merge = 'merge',
Expand Down
11 changes: 11 additions & 0 deletions packages/common/src/hardforks/grayGlacier.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "grayGlacier",
"comment": "Delaying the difficulty bomb to Mid September 2022",
"url": "https://github.com/ethereum/execution-specs/blob/master/network-upgrades/mainnet-upgrades/gray-glacier.md",
"status": "Draft",
"eips": [5133],
"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 @@ -13,6 +13,7 @@ export const hardforks = [
['london', require('./london.json')],
['shanghai', require('./shanghai.json')],
['arrowGlacier', require('./arrowGlacier.json')],
['grayGlacier', require('./grayGlacier.json')],
['mergeForkIdTransition', require('./mergeForkIdTransition.json')],
['merge', require('./merge.json')],
]
8 changes: 5 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.Berlin,
Hardfork.London,
Hardfork.ArrowGlacier,
Hardfork.GrayGlacier,
Hardfork.Shanghai,
Hardfork.Merge,
]
Expand All @@ -41,8 +42,8 @@ tape('[Common]: Hardfork logic', function (t: tape.Test) {
st.equal(c.getHardforkByBlockNumber(12244000), Hardfork.Berlin, msg)
st.equal(c.getHardforkByBlockNumber(12965000), Hardfork.London, msg)
st.equal(c.getHardforkByBlockNumber(13773000), Hardfork.ArrowGlacier, msg)
st.equal(c.getHardforkByBlockNumber(999999999999), Hardfork.ArrowGlacier, msg)

st.equal(c.getHardforkByBlockNumber(15050000), Hardfork.GrayGlacier, msg)
st.equal(c.getHardforkByBlockNumber(999999999999), Hardfork.GrayGlacier, msg)
msg = 'should set HF correctly'

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

c = new Common({ chain: Chain.Ropsten })
st.equal(c.setHardforkByBlockNumber(0), 'tangerineWhistle', msg)
Expand Down
2 changes: 2 additions & 0 deletions packages/vm/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export interface VMOpts {
* - [EIP-3855](https://eips.ethereum.org/EIPS/eip-3855) - PUSH0 instruction (`experimental`)
* - [EIP-3860](https://eips.ethereum.org/EIPS/eip-3860) - Limit and meter initcode (`experimental`)
* - [EIP-4399](https://eips.ethereum.org/EIPS/eip-4399) - Supplant DIFFICULTY opcode with PREVRANDAO (Merge) (`experimental`)
* - [EIP-5133](https://eips.ethereum.org/EIPS/eip-5133) - Delaying Difficulty Bomb to mid-September 2022
*
* *Annotations:*
*
Expand Down Expand Up @@ -222,6 +223,7 @@ export default class VM extends AsyncEventEmitter<VMEvents> {
Hardfork.Berlin,
Hardfork.London,
Hardfork.ArrowGlacier,
Hardfork.GrayGlacier,
Hardfork.MergeForkIdTransition,
Hardfork.Merge,
]
Expand Down