Skip to content

Commit ee1465e

Browse files
authored
Don't consider stubbed terminal block hash terminal (fixes #4094) (#4096)
1 parent e6b8bc6 commit ee1465e

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

beacon_chain/eth1/eth1_monitor.nim

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ type
134134
depositsChain: Eth1Chain
135135
eth1Progress: AsyncEvent
136136

137+
exchangedConfiguration*: bool
137138
terminalBlockHash*: Option[BlockHash]
138139
terminalBlockNumber*: Option[Quantity]
139140

@@ -588,8 +589,17 @@ proc exchangeTransitionConfiguration*(p: Eth1Monitor): Future[EtcStatus] {.async
588589
localValue = consensusCfg.terminalTotalDifficulty
589590
return EtcStatus.mismatch
590591

592+
if not p.exchangedConfiguration:
593+
# Log successful engine configuration exchange once at startup
594+
p.exchangedConfiguration = true
595+
info "Exchanged engine configuration",
596+
ttd = executionCfg.terminalTotalDifficulty,
597+
terminalBlockHash = executionCfg.terminalBlockHash,
598+
terminalBlockNumber = executionCfg.terminalBlockNumber.uint64
599+
591600
if p.terminalBlockNumber.isSome and p.terminalBlockHash.isSome:
592601
var res = EtcStatus.match
602+
593603
if consensusCfg.terminalBlockNumber != executionCfg.terminalBlockNumber:
594604
warn "Engine API reporting different terminal block number",
595605
engineAPI_value = executionCfg.terminalBlockNumber.uint64,
@@ -602,6 +612,13 @@ proc exchangeTransitionConfiguration*(p: Eth1Monitor): Future[EtcStatus] {.async
602612
res = EtcStatus.mismatch
603613
return res
604614
else:
615+
if executionCfg.terminalBlockHash == default BlockHash:
616+
# If TERMINAL_BLOCK_HASH is stubbed with
617+
# 0x0000000000000000000000000000000000000000000000000000000000000000 then
618+
# TERMINAL_BLOCK_HASH and TERMINAL_BLOCK_NUMBER parameters MUST NOT take
619+
# an effect.
620+
return EtcStatus.match
621+
605622
p.terminalBlockNumber = some executionCfg.terminalBlockNumber
606623
p.terminalBlockHash = some executionCfg.terminalBlockHash
607624
return EtcStatus.localConfigurationUpdated

0 commit comments

Comments
 (0)