mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-02-18 09:27:05 +00:00
Reviewed the Engine API calls for missing error handling (#4004)
This commit is contained in:
parent
b1ac9c9fe4
commit
09de83af80
@ -94,7 +94,6 @@ type
|
|||||||
cfg: RuntimeConfig
|
cfg: RuntimeConfig
|
||||||
finalizedBlockHash: Eth2Digest
|
finalizedBlockHash: Eth2Digest
|
||||||
finalizedDepositsMerkleizer: DepositsMerkleizer
|
finalizedDepositsMerkleizer: DepositsMerkleizer
|
||||||
|
|
||||||
## The latest block that reached a 50% majority vote from
|
## The latest block that reached a 50% majority vote from
|
||||||
## the Eth2 validators according to the follow distance and
|
## the Eth2 validators according to the follow distance and
|
||||||
## the ETH1_VOTING_PERIOD
|
## the ETH1_VOTING_PERIOD
|
||||||
|
@ -317,17 +317,26 @@ proc forkchoice_updated(state: bellatrix.BeaconState,
|
|||||||
fee_recipient: ethtypes.Address,
|
fee_recipient: ethtypes.Address,
|
||||||
execution_engine: Eth1Monitor):
|
execution_engine: Eth1Monitor):
|
||||||
Future[Option[bellatrix.PayloadID]] {.async.} =
|
Future[Option[bellatrix.PayloadID]] {.async.} =
|
||||||
|
logScope:
|
||||||
|
head_block_hash
|
||||||
|
finalized_block_hash
|
||||||
|
|
||||||
let
|
let
|
||||||
timestamp = compute_timestamp_at_slot(state, state.slot)
|
timestamp = compute_timestamp_at_slot(state, state.slot)
|
||||||
random = get_randao_mix(state, get_current_epoch(state))
|
random = get_randao_mix(state, get_current_epoch(state))
|
||||||
forkchoiceResponse =
|
forkchoiceResponse =
|
||||||
awaitWithTimeout(
|
try:
|
||||||
execution_engine.forkchoiceUpdated(
|
awaitWithTimeout(
|
||||||
head_block_hash, finalized_block_hash, timestamp, random.data,
|
execution_engine.forkchoiceUpdated(
|
||||||
fee_recipient),
|
head_block_hash, finalized_block_hash, timestamp, random.data,
|
||||||
FORKCHOICEUPDATED_TIMEOUT):
|
fee_recipient),
|
||||||
info "forkchoice_updated: forkchoiceUpdated timed out"
|
FORKCHOICEUPDATED_TIMEOUT):
|
||||||
default(ForkchoiceUpdatedResponse)
|
error "Engine API fork-choice update timed out"
|
||||||
|
default(ForkchoiceUpdatedResponse)
|
||||||
|
except CatchableError as err:
|
||||||
|
error "Engine API fork-choice update failed", err = err.msg
|
||||||
|
default(ForkchoiceUpdatedResponse)
|
||||||
|
|
||||||
payloadId = forkchoiceResponse.payloadId
|
payloadId = forkchoiceResponse.payloadId
|
||||||
|
|
||||||
return if payloadId.isSome:
|
return if payloadId.isSome:
|
||||||
@ -401,11 +410,17 @@ proc getExecutionPayload(
|
|||||||
proposalState.bellatrixData.data, latestHead, latestFinalized,
|
proposalState.bellatrixData.data, latestHead, latestFinalized,
|
||||||
feeRecipient,
|
feeRecipient,
|
||||||
node.consensusManager.eth1Monitor))
|
node.consensusManager.eth1Monitor))
|
||||||
payload = awaitWithTimeout(
|
payload = try:
|
||||||
get_execution_payload(payload_id, node.consensusManager.eth1Monitor),
|
awaitWithTimeout(
|
||||||
GETPAYLOAD_TIMEOUT):
|
get_execution_payload(payload_id, node.consensusManager.eth1Monitor),
|
||||||
info "getExecutionPayload: getPayload timed out; using empty execution payload"
|
GETPAYLOAD_TIMEOUT):
|
||||||
|
warn "Getting execution payload from Engine API timed out", payload_id
|
||||||
|
empty_execution_payload
|
||||||
|
except CatchableError as err:
|
||||||
|
warn "Getting execution payload from Engine API failed",
|
||||||
|
payload_id, err = err.msg
|
||||||
empty_execution_payload
|
empty_execution_payload
|
||||||
|
|
||||||
executionPayloadStatus =
|
executionPayloadStatus =
|
||||||
awaitWithTimeout(
|
awaitWithTimeout(
|
||||||
node.consensusManager.eth1Monitor.newExecutionPayload(payload),
|
node.consensusManager.eth1Monitor.newExecutionPayload(payload),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user