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

common: Rename Merge hardfork to Paris #2652

Merged
merged 10 commits into from
Apr 20, 2023
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
10 changes: 5 additions & 5 deletions .github/workflows/vm-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
fork: ['London', 'Berlin', 'Merge', 'MuirGlacier', 'Istanbul', 'Shanghai']
fork: ['London', 'Berlin', 'Paris', 'MuirGlacier', 'Istanbul', 'Shanghai']
fail-fast: false
steps:
- uses: actions/checkout@v3
Expand All @@ -69,7 +69,7 @@ jobs:
fork:
[
'Shanghai',
'Merge',
'Paris',
'London',
'Berlin',
'MuirGlacier',
Expand Down Expand Up @@ -113,8 +113,8 @@ jobs:
'--fork=London --excludeDir=stTimeConsuming',
'--fork=Istanbul --dir=GeneralStateTests/stTimeConsuming --expected-test-amount=15561',
'--fork=Istanbul --excludeDir=stTimeConsuming --expected-test-amount=19817',
'--fork=Merge --dir=GeneralStateTests/stTimeConsuming',
'--fork=Merge --excludeDir=stTimeConsuming',
'--fork=Paris --dir=GeneralStateTests/stTimeConsuming',
'--fork=Paris --excludeDir=stTimeConsuming',
'--fork=ArrowGlacierToMergeAtDiffC0000',
'--fork=Shanghai --dir=GeneralStateTests/stTimeConsuming',
'--fork=Shanghai --excludeDir=stTimeConsuming',
Expand Down Expand Up @@ -154,7 +154,7 @@ jobs:
'--fork=MuirGlacier --verify-test-amount-alltests',
'--fork=Berlin --verify-test-amount-alltests',
'--fork=London --verify-test-amount-alltests',
'--fork=Merge --verify-test-amount-alltests',
'--fork=Paris --verify-test-amount-alltests',
'--fork=Shanghai --verify-test-amount-alltests',
'--fork=ByzantiumToConstantinopleFixAt5 --verify-test-amount-alltests',
'--fork=EIP158ToByzantiumAt5 --verify-test-amount-alltests',
Expand Down
2 changes: 1 addition & 1 deletion packages/block/test/block.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ tape('[Block]: block functions', function (t) {
)
st.equal(
block._common.hardfork(),
Hardfork.Merge,
Hardfork.Paris,
'should use hardforkByTTD option (td > threshold)'
)

Expand Down
2 changes: 1 addition & 1 deletion packages/block/test/mergeBlock.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { BlockHeader } from '../src/header'

const common = new Common({
chain: Chain.Mainnet,
hardfork: Hardfork.Merge,
hardfork: Hardfork.Paris,
})

function validateMergeHeader(st: tape.Test, header: BlockHeader) {
Expand Down
2 changes: 1 addition & 1 deletion packages/block/test/testdata/testnetMerge.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"block": 14
},
{
"name": "merge",
"name": "paris",
"block": null,
"ttd": "5000"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/blockchain/test/pos.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const buildChain = async (blockchain: Blockchain, common: Common, height: number
tape('Proof of Stake - inserting blocks into blockchain', async (t) => {
const testnetOnlyTD = JSON.parse(JSON.stringify(testnet))
testnetOnlyTD['hardforks'][11] = {
name: 'merge',
name: 'paris',
ttd: BigInt(1313600),
block: null,
}
Expand Down Expand Up @@ -76,7 +76,7 @@ tape('Proof of Stake - inserting blocks into blockchain', async (t) => {

t.equal(
(blockchain as any)._common.hardfork(),
'merge',
'paris',
'HF should have been correctly updated'
)
const td = await blockchain.getTotalDifficulty(latestHeader.hash())
Expand Down
2 changes: 1 addition & 1 deletion packages/blockchain/test/testdata/testnet.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"block": 10
},
{
"name": "merge",
"name": "paris",
"block": 11
}
],
Expand Down
2 changes: 1 addition & 1 deletion packages/client/bin/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -774,7 +774,7 @@ async function run() {
const servers =
args.rpc === true || args.rpcEngine === true ? startRPCServers(client, args as RPCArgs) : []
if (
client.config.chainCommon.gteHardfork(Hardfork.Merge) === true &&
client.config.chainCommon.gteHardfork(Hardfork.Paris) === true &&
(args.rpcEngine === false || args.rpcEngine === undefined)
) {
config.logger.warn(`Engine RPC endpoint not activated on a post-Merge HF setup.`)
Expand Down
10 changes: 5 additions & 5 deletions packages/client/lib/blockchain/chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -294,16 +294,16 @@ export class Chain {
)

// Check and log if this is a terminal block and next block could be merge
if (!this.config.chainCommon.gteHardfork(Hardfork.Merge)) {
if (!this.config.chainCommon.gteHardfork(Hardfork.Paris)) {
const nextBlockHf = this.config.chainCommon.getHardforkByBlockNumber(
headers.height + BigInt(1),
headers.td,
undefined
)
if (this.config.chainCommon.hardforkGteHardfork(nextBlockHf, Hardfork.Merge)) {
if (this.config.chainCommon.hardforkGteHardfork(nextBlockHf, Hardfork.Paris)) {
this.config.logger.info('*'.repeat(85))
this.config.logger.info(
`Merge hardfork reached 🐼 👉 👈 🐼 ! block=${headers.height} td=${headers.td}`
`Paris (Merge) hardfork reached 🐼 👉 👈 🐼 ! block=${headers.height} td=${headers.td}`
)
this.config.logger.info('-'.repeat(85))
this.config.logger.info(' ')
Expand Down Expand Up @@ -386,7 +386,7 @@ export class Chain {
}

for (const [i, b] of newBlocks.entries()) {
if (!fromEngine && this.config.chainCommon.gteHardfork(Hardfork.Merge)) {
if (!fromEngine && this.config.chainCommon.gteHardfork(Hardfork.Paris)) {
if (i > 0) {
// emitOnLast below won't be reached, so run an update here
await this.update(!skipUpdateEmit)
Expand Down Expand Up @@ -443,7 +443,7 @@ export class Chain {

let numAdded = 0
for (const [i, h] of headers.entries()) {
if (!mergeIncludes && this.config.chainCommon.gteHardfork(Hardfork.Merge)) {
if (!mergeIncludes && this.config.chainCommon.gteHardfork(Hardfork.Paris)) {
if (i > 0) {
// emitOnLast below won't be reached, so run an update here
await this.update(true)
Expand Down
2 changes: 1 addition & 1 deletion packages/client/lib/execution/vmexecution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,7 @@ export class VMExecution extends Execution {
? `baseFee=${endHeadBlock.header.baseFeePerGas} `
: ''
const tdAdd =
this.config.execCommon.gteHardfork(Hardfork.Merge) === true
this.config.execCommon.gteHardfork(Hardfork.Paris) === true
? ''
: `td=${this.chain.blocks.td} `
this.config.logger.info(
Expand Down
2 changes: 1 addition & 1 deletion packages/client/lib/miner/miner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export class Miner {
this.service.chain.headers.td,
undefined
)
if (this.config.chainCommon.hardforkGteHardfork(nextBlockHf, Hardfork.Merge)) {
if (this.config.chainCommon.hardforkGteHardfork(nextBlockHf, Hardfork.Paris)) {
this.config.logger.info('Miner: reached merge hardfork - stopping')
this.stop()
return
Expand Down
2 changes: 1 addition & 1 deletion packages/client/lib/net/peerpool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ export class PeerPool {
*/
async _statusCheck() {
let NO_PEER_PERIOD_COUNT = 3
if (this.config.chainCommon.gteHardfork(Hardfork.Merge)) {
if (this.config.chainCommon.gteHardfork(Hardfork.Paris)) {
NO_PEER_PERIOD_COUNT = 6
}
if (this.size === 0 && this.config.maxPeers > 0) {
Expand Down
2 changes: 1 addition & 1 deletion packages/client/lib/net/protocol/ethprotocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ export class EthProtocol extends Protocol {
super(options)

this.chain = options.chain
const chainTTD = this.config.chainCommon.hardforkTTD(Hardfork.Merge)
const chainTTD = this.config.chainCommon.hardforkTTD(Hardfork.Paris)
if (chainTTD !== null && chainTTD !== undefined) {
this.chainTTD = chainTTD
}
Expand Down
10 changes: 5 additions & 5 deletions packages/client/lib/rpc/modules/engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ const validBlock = async (hash: Uint8Array, chain: Chain): Promise<Block | null>
* Validates that the block satisfies post-merge conditions.
*/
const validateTerminalBlock = async (block: Block, chain: Chain): Promise<boolean> => {
const ttd = chain.config.chainCommon.hardforkTTD(Hardfork.Merge)
const ttd = chain.config.chainCommon.hardforkTTD(Hardfork.Paris)
if (ttd === null) return false
const blockTd = await chain.getTd(block.hash(), block.header.number)

Expand Down Expand Up @@ -289,7 +289,7 @@ const assembleBlock = async (
const common = config.chainCommon.copy()

// This is a post merge block, so set its common accordingly
const ttd = common.hardforkTTD(Hardfork.Merge)
const ttd = common.hardforkTTD(Hardfork.Paris)
common.setHardforkByBlockNumber(number, ttd !== null ? ttd : undefined, timestamp)

const txs = []
Expand Down Expand Up @@ -571,7 +571,7 @@ export class Engine {

try {
const parent = await this.chain.getBlock(hexStringToBytes(parentHash))
if (!parent._common.gteHardfork(Hardfork.Merge)) {
if (!parent._common.gteHardfork(Hardfork.Paris)) {
const validTerminalBlock = await validateTerminalBlock(parent, this.chain)
if (!validTerminalBlock) {
const response = {
Expand Down Expand Up @@ -807,7 +807,7 @@ export class Engine {
// Only validate this as terminal block if this block's difficulty is non-zero,
// else this is a PoS block but its hardfork could be indeterminable if the skeleton
// is not yet connected.
if (!headBlock._common.gteHardfork(Hardfork.Merge) && headBlock.header.difficulty > BigInt(0)) {
if (!headBlock._common.gteHardfork(Hardfork.Paris) && headBlock.header.difficulty > BigInt(0)) {
const validTerminalBlock = await validateTerminalBlock(headBlock, this.chain)
if (!validTerminalBlock) {
const response = {
Expand Down Expand Up @@ -1040,7 +1040,7 @@ export class Engine {
params: [TransitionConfigurationV1]
): Promise<TransitionConfigurationV1> {
const { terminalTotalDifficulty, terminalBlockHash, terminalBlockNumber } = params[0]
const ttd = this.chain.config.chainCommon.hardforkTTD(Hardfork.Merge)
const ttd = this.chain.config.chainCommon.hardforkTTD(Hardfork.Paris)
if (ttd === undefined || ttd === null) {
throw {
code: INTERNAL_ERROR,
Expand Down
4 changes: 2 additions & 2 deletions packages/client/lib/rpc/util/CLConnectionManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,11 +282,11 @@ export class CLConnectionManager {

if (
!this.oneTimeMergeCLConnectionCheck &&
this.config.chainCommon.hardfork() === Hardfork.Merge
this.config.chainCommon.hardfork() === Hardfork.Paris
) {
if (this.connectionStatus === ConnectionStatus.Disconnected) {
this.config.logger.info(
'Merge HF activated, CL client connection is needed for continued block processing'
'Paris (Merge) HF activated, CL client connection is needed for continued block processing'
)
this.config.logger.info(
'(note that CL client might need to be synced up to beacon chain Merge transition slot until communication starts)'
Expand Down
8 changes: 4 additions & 4 deletions packages/client/lib/service/fullethereumservice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export class FullEthereumService extends EthereumService {
interval: this.interval,
})
} else {
if (this.config.chainCommon.gteHardfork(Hardfork.Merge) === true) {
if (this.config.chainCommon.gteHardfork(Hardfork.Paris) === true) {
if (!this.config.disableBeaconSync) {
void this.switchToBeaconSync()
}
Expand Down Expand Up @@ -153,7 +153,7 @@ export class FullEthereumService extends EthereumService {
}
await super.start()
this.miner?.start()
if (!this.config.execCommon.gteHardfork(Hardfork.Merge)) {
if (!this.config.execCommon.gteHardfork(Hardfork.Paris)) {
void this.execution.run(true, true)
}
return true
Expand Down Expand Up @@ -264,7 +264,7 @@ export class FullEthereumService extends EthereumService {
break
}
case 'NewBlockHashes': {
if (this.config.chainCommon.gteHardfork(Hardfork.Merge) === true) {
if (this.config.chainCommon.gteHardfork(Hardfork.Paris) === true) {
this.config.logger.debug(
`Dropping peer ${peer.id} for sending NewBlockHashes after merge (EIP-3675)`
)
Expand All @@ -279,7 +279,7 @@ export class FullEthereumService extends EthereumService {
break
}
case 'NewBlock': {
if (this.config.chainCommon.gteHardfork(Hardfork.Merge) === true) {
if (this.config.chainCommon.gteHardfork(Hardfork.Paris) === true) {
this.config.logger.debug(
`Dropping peer ${peer.id} for sending NewBlock after merge (EIP-3675)`
)
Expand Down
10 changes: 5 additions & 5 deletions packages/client/lib/sync/fullsync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,10 @@ export class FullSynchronizer extends Synchronizer {
* Process blocks fetched from the fetcher.
*/
async processBlocks(blocks: Block[]) {
if (this.config.chainCommon.gteHardfork(Hardfork.Merge) === true) {
if (this.config.chainCommon.gteHardfork(Hardfork.Paris) === true) {
if (this.fetcher !== null) {
// If we are beyond the merge block we should stop the fetcher
this.config.logger.info('Merge hardfork reached, stopping block fetcher')
this.config.logger.info('Paris (Merge) hardfork reached, stopping block fetcher')
this.clearFetcher()
}
}
Expand Down Expand Up @@ -236,13 +236,13 @@ export class FullSynchronizer extends Synchronizer {
} else {
if (
this.config.chainCommon.hardfork() === Hardfork.MergeForkIdTransition &&
this.config.chainCommon.gteHardfork(Hardfork.Merge) === false
this.config.chainCommon.gteHardfork(Hardfork.Paris) === false
) {
const mergeTTD = this.config.chainCommon.hardforkTTD(Hardfork.Merge)!
const mergeTTD = this.config.chainCommon.hardforkTTD(Hardfork.Paris)!
const td = this.chain.blocks.td
const remaining = mergeTTD - td
if (remaining <= mergeTTD / BigInt(10)) {
attentionHF = `Merge HF in ${remaining} TD`
attentionHF = `Paris (Merge) HF in ${remaining} TD`
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/client/lib/sync/skeleton.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ export class Skeleton extends MetaDBManager {
super(opts)
this.status = { progress: { subchains: [] }, linked: false, canonicalHeadReset: true }
this.started = 0
const chainTTD = this.config.chainCommon.hardforkTTD(Hardfork.Merge)
const chainTTD = this.config.chainCommon.hardforkTTD(Hardfork.Paris)
if (chainTTD === undefined || chainTTD === null) {
throw Error('Cannot create skeleton as merge not set')
}
Expand Down
4 changes: 2 additions & 2 deletions packages/client/lib/sync/sync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export abstract class Synchronizer {
* Start synchronization
*/
async start(): Promise<void | boolean> {
if (this.running || this.config.chainCommon.gteHardfork(Hardfork.Merge) === true) {
if (this.running || this.config.chainCommon.gteHardfork(Hardfork.Paris) === true) {
return false
}
this.running = true
Expand All @@ -122,7 +122,7 @@ export abstract class Synchronizer {
const timeout = setTimeout(() => {
this.forceSync = true
}, this.interval * 30)
while (this.running && this.config.chainCommon.gteHardfork(Hardfork.Merge) === false) {
while (this.running && this.config.chainCommon.gteHardfork(Hardfork.Paris) === false) {
try {
await this.sync()
} catch (error: any) {
Expand Down
4 changes: 2 additions & 2 deletions packages/client/test/integration/merge.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ tape('[Integration:Merge]', async (t) => {
{ name: 'chainstart', block: 0 },
{ name: 'london', block: 0 },
{
name: 'merge',
name: 'paris',
block: null,
forkHash: null,
ttd: BigInt(5),
Expand All @@ -56,7 +56,7 @@ tape('[Integration:Merge]', async (t) => {
{ name: 'chainstart', block: 0 },
{ name: 'london', block: 0 },
{
name: 'merge',
name: 'paris',
block: null,
forkHash: null,
ttd: BigInt(1000),
Expand Down
2 changes: 1 addition & 1 deletion packages/client/test/integration/mocks/mockchain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class MockChain extends Chain {
{
header: {
number: number + 1,
difficulty: common.gteHardfork(Hardfork.Merge) ? 0 : 1,
difficulty: common.gteHardfork(Hardfork.Paris) ? 0 : 1,
parentHash: number ? blocks[number - 1].hash() : this.genesis.hash(),
},
},
Expand Down
2 changes: 1 addition & 1 deletion packages/client/test/miner/miner.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ tape('[Miner]', async (t) => {
await setBalance(vm, A.address, BigInt('200000000000001'))

// add tx
txA011.common.setHardfork(Hardfork.Merge)
txA011.common.setHardfork(Hardfork.Paris)
await txPool.add(txA011)
t.equal(txPool.txsInPool, 1, 'transaction should be in pool')

Expand Down
4 changes: 2 additions & 2 deletions packages/client/test/miner/pendingBlock.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ tape('[PendingBlock]', async (t) => {
await setBalance(vm, A.address, BigInt(5000000000000000))
await setBalance(vm, B.address, BigInt(5000000000000000))

txA011.common.setHardfork(Hardfork.Merge)
txA011.common.setHardfork(Hardfork.Paris)
await txPool.add(txA011)
t.equal(txPool.txsInPool, 1, '1 txA011 should be added')
// skip hardfork validation for ease
Expand All @@ -160,7 +160,7 @@ tape('[PendingBlock]', async (t) => {
'txA011 should be in block'
)

txB011.common.setHardfork(Hardfork.Merge)
txB011.common.setHardfork(Hardfork.Paris)
await txPool.add(txB011)
t.equal(txPool.txsInPool, 2, '1 txB011 should be added')
const built = await pendingBlock.build(payloadId)
Expand Down
2 changes: 1 addition & 1 deletion packages/client/test/net/protocol/ethprotocol.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ tape('[EthProtocol]', (t) => {
transports: [],
common: new Common({
chain: Config.CHAIN_DEFAULT,
hardfork: Hardfork.Merge,
hardfork: Hardfork.Paris,
eips: [4895, 4844],
}),
accountCache: 10000,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const validPayloadAttributes = {
suggestedFeeRecipient: '0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b',
}

const common = new Common({ chain: Chain.Mainnet, hardfork: Hardfork.Merge })
const common = new Common({ chain: Chain.Mainnet, hardfork: Hardfork.Paris })

function createBlock(parentBlock: Block) {
const prevRandao = crypto.randomBytes(32)
Expand Down
Loading