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

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

Merged
merged 1 commit into from
Sep 8, 2022
Merged
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
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 @@ -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
Comment on lines +593 to +596
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is quite useful, also to verify that the EL connection is indeed working fine.


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 @@ -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
Expand Down