Don't consider stubbed terminal block hash terminal (fixes #4094) (#4096)

This commit is contained in:
Jacek Sieka 2022-09-08 10:57:26 +02:00 committed by GitHub
parent e6b8bc6527
commit ee1465e320
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 17 additions and 0 deletions

View File

@ -134,6 +134,7 @@ type
depositsChain: Eth1Chain
eth1Progress: AsyncEvent
exchangedConfiguration*: bool
terminalBlockHash*: Option[BlockHash]
terminalBlockNumber*: Option[Quantity]
@ -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,
@ -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