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

Client: Merge Switch Hack for --dev Option #1510

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all 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
8 changes: 5 additions & 3 deletions packages/client/bin/cli.ts
Expand Up @@ -300,9 +300,10 @@ async function run() {
byzantiumBlock: 0,
constantinopleBlock: 0,
petersburgBlock: 0,
istanbulBlock: 0,
berlinBlock: 0,
londonBlock: 0,
istanbulBlock: 2,
berlinBlock: 4,
londonBlock: 6,
mergeBlock: 8,
Copy link
Contributor

Choose a reason for hiding this comment

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

by the way geth defines this as terminalTotalDifficulty not mergeBlock, I have implemented it here

Copy link
Contributor

Choose a reason for hiding this comment

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

i also implemented stopping the miner, although I did it on chainCommon not execCommon - I believe execCommon should already work but I haven't implemented updating the chainCommon yet (will be doing that soon in my next work)

...consensusConfig,
},
nonce: '0x0',
Expand All @@ -322,6 +323,7 @@ async function run() {
extraData,
alloc: { [prefundAddress]: { balance: '0x10000000000000000000' } },
}
console.log(chainData)
const chainParams = await parseCustomParams(chainData, 'devnet')
const genesisState = await parseGenesisState(chainData)
const customChainParams: [IChain, GenesisState][] = [[chainParams, genesisState]]
Expand Down
32 changes: 27 additions & 5 deletions packages/client/lib/util/parse.ts
Expand Up @@ -203,6 +203,7 @@ async function parseGethParams(json: any) {
'muirGlacier',
'berlin',
'london',
'merge',
]
const forkMap: { [key: string]: string } = {
homestead: 'homesteadBlock',
Expand All @@ -216,13 +217,34 @@ async function parseGethParams(json: any) {
muirGlacier: 'muirGlacierBlock',
berlin: 'berlinBlock',
london: 'londonBlock',
merge: 'mergeBlock',
}

params.hardforks = hardforks
.map((name) => ({
name: name,
block: name === 'chainstart' ? 0 : config[forkMap[name]] ?? null,
}))
.filter((fork) => fork.block !== null)
.map((name) => {
let block
if (name === 'chainstart') {
block = 0
} else if (name === 'merge') {
block = null
} else {
block = config[forkMap[name]] ?? null
}
let td
if (name === 'merge') {
td = 16
} else {
td = null
}
const hf = {
name: name,
block,
td,
}
return hf
})
.filter((fork) => fork.name !== 'dao' && fork.name !== 'muirGlacier')
console.log(params)
return params
}
/**
Expand Down