mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-01-09 13:56:23 +00:00
Don't search for the TTD block after the merge (#4152)
This commit is contained in:
parent
bed8318b7f
commit
154723947b
@ -141,6 +141,8 @@ type
|
|||||||
stopFut: Future[void]
|
stopFut: Future[void]
|
||||||
getBeaconTime: GetBeaconTimeFn
|
getBeaconTime: GetBeaconTimeFn
|
||||||
|
|
||||||
|
ttdReachedField: bool
|
||||||
|
|
||||||
when hasGenesisDetection:
|
when hasGenesisDetection:
|
||||||
genesisValidators: seq[ImmutableValidatorData]
|
genesisValidators: seq[ImmutableValidatorData]
|
||||||
genesisValidatorKeyToIndex: Table[ValidatorPubKey, ValidatorIndex]
|
genesisValidatorKeyToIndex: Table[ValidatorPubKey, ValidatorIndex]
|
||||||
@ -196,6 +198,9 @@ declareGauge eth1_finalized_deposits,
|
|||||||
declareGauge eth1_chain_len,
|
declareGauge eth1_chain_len,
|
||||||
"The length of the in-memory chain of Eth1 blocks"
|
"The length of the in-memory chain of Eth1 blocks"
|
||||||
|
|
||||||
|
func ttdReached*(m: Eth1Monitor): bool =
|
||||||
|
m.ttdReachedField
|
||||||
|
|
||||||
template cfg(m: Eth1Monitor): auto =
|
template cfg(m: Eth1Monitor): auto =
|
||||||
m.depositsChain.cfg
|
m.depositsChain.cfg
|
||||||
|
|
||||||
@ -1039,7 +1044,8 @@ proc init*(T: type Eth1Monitor,
|
|||||||
depositContractSnapshot: Option[DepositContractSnapshot],
|
depositContractSnapshot: Option[DepositContractSnapshot],
|
||||||
eth1Network: Option[Eth1Network],
|
eth1Network: Option[Eth1Network],
|
||||||
forcePolling: bool,
|
forcePolling: bool,
|
||||||
jwtSecret: Option[seq[byte]]): T =
|
jwtSecret: Option[seq[byte]],
|
||||||
|
ttdReached: bool): T =
|
||||||
doAssert web3Urls.len > 0
|
doAssert web3Urls.len > 0
|
||||||
var web3Urls = web3Urls
|
var web3Urls = web3Urls
|
||||||
for url in mitems(web3Urls):
|
for url in mitems(web3Urls):
|
||||||
@ -1057,7 +1063,8 @@ proc init*(T: type Eth1Monitor,
|
|||||||
eth1Progress: newAsyncEvent(),
|
eth1Progress: newAsyncEvent(),
|
||||||
forcePolling: forcePolling,
|
forcePolling: forcePolling,
|
||||||
jwtSecret: jwtSecret,
|
jwtSecret: jwtSecret,
|
||||||
blocksPerLogsRequest: targetBlocksPerLogsRequest)
|
blocksPerLogsRequest: targetBlocksPerLogsRequest,
|
||||||
|
ttdReachedField: ttdReached)
|
||||||
|
|
||||||
proc safeCancel(fut: var Future[void]) =
|
proc safeCancel(fut: var Future[void]) =
|
||||||
if not fut.isNil and not fut.finished:
|
if not fut.isNil and not fut.finished:
|
||||||
@ -1450,7 +1457,8 @@ proc startEth1Syncing(m: Eth1Monitor, delayBeforeStart: Duration) {.async.} =
|
|||||||
let shouldCheckForMergeTransition = block:
|
let shouldCheckForMergeTransition = block:
|
||||||
const FAR_FUTURE_TOTAL_DIFFICULTY =
|
const FAR_FUTURE_TOTAL_DIFFICULTY =
|
||||||
u256"115792089237316195423570985008687907853269984665640564039457584007913129638912"
|
u256"115792089237316195423570985008687907853269984665640564039457584007913129638912"
|
||||||
m.cfg.TERMINAL_TOTAL_DIFFICULTY != FAR_FUTURE_TOTAL_DIFFICULTY
|
(not m.ttdReachedField) and
|
||||||
|
(m.cfg.TERMINAL_TOTAL_DIFFICULTY != FAR_FUTURE_TOTAL_DIFFICULTY)
|
||||||
|
|
||||||
var didPollOnce = false
|
var didPollOnce = false
|
||||||
while true:
|
while true:
|
||||||
@ -1519,6 +1527,7 @@ proc startEth1Syncing(m: Eth1Monitor, delayBeforeStart: Duration) {.async.} =
|
|||||||
break
|
break
|
||||||
terminalBlockCandidate = parentBlock
|
terminalBlockCandidate = parentBlock
|
||||||
m.terminalBlockHash = some terminalBlockCandidate.hash
|
m.terminalBlockHash = some terminalBlockCandidate.hash
|
||||||
|
m.ttdReachedField = true
|
||||||
|
|
||||||
debug "startEth1Syncing: found merge terminal block",
|
debug "startEth1Syncing: found merge terminal block",
|
||||||
currentEpoch = m.currentEpoch,
|
currentEpoch = m.currentEpoch,
|
||||||
|
@ -503,7 +503,7 @@ proc runQueueProcessingLoop*(self: ref BlockProcessor) {.async.} =
|
|||||||
executionPayloadStatus =
|
executionPayloadStatus =
|
||||||
if hasExecutionPayload:
|
if hasExecutionPayload:
|
||||||
# Eth1 syncing is asynchronous from this
|
# Eth1 syncing is asynchronous from this
|
||||||
# TODO self.consensusManager.eth1Monitor.terminalBlockHash.isSome
|
# TODO self.consensusManager.eth1Monitor.ttdReached
|
||||||
# should gate this when it works more reliably
|
# should gate this when it works more reliably
|
||||||
# TODO detect have-TTD-but-not-is_execution_block case, and where
|
# TODO detect have-TTD-but-not-is_execution_block case, and where
|
||||||
# execution payload was non-zero when TTD detection more reliable
|
# execution payload was non-zero when TTD detection more reliable
|
||||||
|
@ -541,7 +541,8 @@ proc init*(T: type BeaconNode,
|
|||||||
getDepositContractSnapshot(),
|
getDepositContractSnapshot(),
|
||||||
eth1Network,
|
eth1Network,
|
||||||
config.web3ForcePolling,
|
config.web3ForcePolling,
|
||||||
optJwtSecret)
|
optJwtSecret,
|
||||||
|
ttdReached = false)
|
||||||
|
|
||||||
eth1Monitor.loadPersistedDeposits()
|
eth1Monitor.loadPersistedDeposits()
|
||||||
|
|
||||||
@ -642,7 +643,8 @@ proc init*(T: type BeaconNode,
|
|||||||
getDepositContractSnapshot(),
|
getDepositContractSnapshot(),
|
||||||
eth1Network,
|
eth1Network,
|
||||||
config.web3ForcePolling,
|
config.web3ForcePolling,
|
||||||
optJwtSecret)
|
optJwtSecret,
|
||||||
|
ttdReached = not dag.loadExecutionBlockRoot(dag.finalizedHead.blck).isZero)
|
||||||
|
|
||||||
if config.rpcEnabled:
|
if config.rpcEnabled:
|
||||||
warn "Nimbus's JSON-RPC server has been removed. This includes the --rpc, --rpc-port, and --rpc-address configuration options. https://nimbus.guide/rest-api.html shows how to enable and configure the REST Beacon API server which replaces it."
|
warn "Nimbus's JSON-RPC server has been removed. This includes the --rpc, --rpc-port, and --rpc-address configuration options. https://nimbus.guide/rest-api.html shows how to enable and configure the REST Beacon API server which replaces it."
|
||||||
|
@ -64,7 +64,10 @@ programMain:
|
|||||||
cfg, db = nil, getBeaconTime, config.web3Urls,
|
cfg, db = nil, getBeaconTime, config.web3Urls,
|
||||||
none(DepositContractSnapshot), metadata.eth1Network,
|
none(DepositContractSnapshot), metadata.eth1Network,
|
||||||
forcePolling = false,
|
forcePolling = false,
|
||||||
rng[].loadJwtSecret(config, allowCreate = false))
|
rng[].loadJwtSecret(config, allowCreate = false),
|
||||||
|
# TTD is not relevant for the light client, so it's safe
|
||||||
|
# to assume that the TTD has been reached.
|
||||||
|
ttdReached = true)
|
||||||
waitFor res.ensureDataProvider()
|
waitFor res.ensureDataProvider()
|
||||||
res
|
res
|
||||||
else:
|
else:
|
||||||
|
@ -373,18 +373,15 @@ proc getExecutionPayload[T](
|
|||||||
const GETPAYLOAD_TIMEOUT = 1.seconds
|
const GETPAYLOAD_TIMEOUT = 1.seconds
|
||||||
|
|
||||||
let
|
let
|
||||||
terminalBlockHash =
|
|
||||||
if node.eth1Monitor.terminalBlockHash.isSome:
|
|
||||||
node.eth1Monitor.terminalBlockHash.get.asEth2Digest
|
|
||||||
else:
|
|
||||||
default(Eth2Digest)
|
|
||||||
beaconHead = node.attestationPool[].getBeaconHead(node.dag.head)
|
beaconHead = node.attestationPool[].getBeaconHead(node.dag.head)
|
||||||
executionBlockRoot = node.dag.loadExecutionBlockRoot(beaconHead.blck)
|
executionBlockRoot = node.dag.loadExecutionBlockRoot(beaconHead.blck)
|
||||||
latestHead =
|
latestHead =
|
||||||
if not executionBlockRoot.isZero:
|
if not executionBlockRoot.isZero:
|
||||||
executionBlockRoot
|
executionBlockRoot
|
||||||
|
elif node.eth1Monitor.terminalBlockHash.isSome:
|
||||||
|
node.eth1Monitor.terminalBlockHash.get.asEth2Digest
|
||||||
else:
|
else:
|
||||||
terminalBlockHash
|
default(Eth2Digest)
|
||||||
latestSafe = beaconHead.safeExecutionPayloadHash
|
latestSafe = beaconHead.safeExecutionPayloadHash
|
||||||
latestFinalized = beaconHead.finalizedExecutionPayloadHash
|
latestFinalized = beaconHead.finalizedExecutionPayloadHash
|
||||||
feeRecipient = node.getFeeRecipient(pubkey, validator_index, epoch)
|
feeRecipient = node.getFeeRecipient(pubkey, validator_index, epoch)
|
||||||
@ -489,8 +486,7 @@ proc makeBeaconBlockForHeadAndSlot*(
|
|||||||
elif slot.epoch < node.dag.cfg.BELLATRIX_FORK_EPOCH or
|
elif slot.epoch < node.dag.cfg.BELLATRIX_FORK_EPOCH or
|
||||||
not (
|
not (
|
||||||
is_merge_transition_complete(proposalState[]) or
|
is_merge_transition_complete(proposalState[]) or
|
||||||
((not node.eth1Monitor.isNil) and
|
((not node.eth1Monitor.isNil) and node.eth1Monitor.ttdReached)):
|
||||||
node.eth1Monitor.terminalBlockHash.isSome)):
|
|
||||||
# https://github.com/nim-lang/Nim/issues/19802
|
# https://github.com/nim-lang/Nim/issues/19802
|
||||||
(static(default(bellatrix.ExecutionPayload)))
|
(static(default(bellatrix.ExecutionPayload)))
|
||||||
else:
|
else:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user