From 7a0cf3fea50ffe425cf2066a09b3d6e9eb8f2300 Mon Sep 17 00:00:00 2001 From: Jacek Sieka Date: Thu, 8 Sep 2022 09:13:25 +0200 Subject: [PATCH] Don't consider stubbed terminal block hash terminal (fixes #4094) --- beacon_chain/eth1/eth1_monitor.nim | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/beacon_chain/eth1/eth1_monitor.nim b/beacon_chain/eth1/eth1_monitor.nim index 68f305d4d4..4cdeaa7e0c 100644 --- a/beacon_chain/eth1/eth1_monitor.nim +++ b/beacon_chain/eth1/eth1_monitor.nim @@ -134,6 +134,7 @@ type depositsChain: Eth1Chain eth1Progress: AsyncEvent + exchangedConfiguration*: bool terminalBlockHash*: Option[BlockHash] terminalBlockNumber*: Option[Quantity] @@ -586,8 +587,17 @@ proc exchangeTransitionConfiguration*(p: Eth1Monitor): Future[EtcStatus] {.async localValue = consensusCfg.terminalTotalDifficulty return EtcStatus.mismatch + if not p.exchangedConfiguration: + # Log successful engine configuration exchange once at startup + p.exchangedConfiguration = true + info "Exchanged engine configuration", + ttd = executionCfg.terminalTotalDifficulty, + terminalBlockHash = executionCfg.terminalBlockHash, + terminalBlockNumber = executionCfg.terminalBlockNumber.uint64 + if p.terminalBlockNumber.isSome and p.terminalBlockHash.isSome: var res = EtcStatus.match + if consensusCfg.terminalBlockNumber != executionCfg.terminalBlockNumber: warn "Engine API reporting different terminal block number", engineAPI_value = executionCfg.terminalBlockNumber.uint64, @@ -600,6 +610,13 @@ proc exchangeTransitionConfiguration*(p: Eth1Monitor): Future[EtcStatus] {.async res = EtcStatus.mismatch return res else: + if executionCfg.terminalBlockHash == default BlockHash: + # If TERMINAL_BLOCK_HASH is stubbed with + # 0x0000000000000000000000000000000000000000000000000000000000000000 then + # TERMINAL_BLOCK_HASH and TERMINAL_BLOCK_NUMBER parameters MUST NOT take + # an effect. + return EtcStatus.match + p.terminalBlockNumber = some executionCfg.terminalBlockNumber p.terminalBlockHash = some executionCfg.terminalBlockHash return EtcStatus.localConfigurationUpdated