Skip to content

Commit

Permalink
Don't consider stubbed terminal block hash terminal (fixes #4094) (#4096
Browse files Browse the repository at this point in the history
)
  • Loading branch information
arnetheduck authored Sep 8, 2022
1 parent e6b8bc6 commit ee1465e
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions beacon_chain/eth1/eth1_monitor.nim
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ type
depositsChain: Eth1Chain
eth1Progress: AsyncEvent

exchangedConfiguration*: bool
terminalBlockHash*: Option[BlockHash]
terminalBlockNumber*: Option[Quantity]

Expand Down Expand Up @@ -588,8 +589,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,
Expand All @@ -602,6 +612,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
Expand Down

0 comments on commit ee1465e

Please sign in to comment.