Skip to content

Commit

Permalink
common: Schedule Shanghai on mainnet! (#2591)
Browse files Browse the repository at this point in the history
* common: Schedule Shanghai on mainnet!

* clear hf timestamp for test
  • Loading branch information
g11tech authored Mar 17, 2023
1 parent 178d07e commit cbf9a04
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
7 changes: 7 additions & 0 deletions packages/block/test/difficulty.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ tape('[Header]: difficulty tests', (t) => {
for (const testName in testData) {
const test = testData[testName]
const common = new Common({ chain: Chain.Mainnet, hardfork })
// Unschedule any timestamp since tests are not configured for timestamps
common
.hardforks()
.filter((hf) => hf.timestamp !== undefined)
.map((hf) => {
hf.timestamp = undefined
})
const blockOpts = { common }
const uncleHash = test.parentUncles === '0x00' ? undefined : test.parentUncles
const parentBlock = Block.fromBlockData(
Expand Down
3 changes: 2 additions & 1 deletion packages/common/src/chains/mainnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,8 @@
{
"name": "shanghai",
"block": null,
"forkHash": null
"timestamp": "1681338455",
"forkHash": "0xdce96c2d"
}
],
"bootstrapNodes": [
Expand Down
7 changes: 7 additions & 0 deletions packages/common/test/hardforks.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,13 @@ tape('[Common]: Hardfork logic', function (t: tape.Test) {
st.equal(c.forkHash(Hardfork.SpuriousDragon, genesisHash), '0x3edd5b10', msg)

c = new Common({ chain: Chain.Mainnet, hardfork: Hardfork.Shanghai })
// unschedule shanghai on it to test
c.hardforks()
.filter((hf) => hf.name === Hardfork.Shanghai)
.map((hf) => {
hf.block = null
hf.timestamp = undefined
})
let f = () => {
c.forkHash(Hardfork.Shanghai)
}
Expand Down

0 comments on commit cbf9a04

Please sign in to comment.