mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-02-18 17:37:33 +00:00
VC: Fix issue when optimistically synced node could block sync committee service functions. (#4878)
* Fix issue when optimistically synced node could block sync committee service functions. * Update copyright year.
This commit is contained in:
parent
ecaf6c8e92
commit
0c75f9c2df
@ -20,6 +20,7 @@ const
|
|||||||
ResponseNotFoundError = "Received resource missing error response"
|
ResponseNotFoundError = "Received resource missing error response"
|
||||||
ResponseNoSyncError = "Received nosync error response"
|
ResponseNoSyncError = "Received nosync error response"
|
||||||
ResponseDecodeError = "Received response could not be decoded"
|
ResponseDecodeError = "Received response could not be decoded"
|
||||||
|
ResponseECNotInSyncError* = "Execution client not in sync"
|
||||||
|
|
||||||
type
|
type
|
||||||
ApiResponse*[T] = Result[T, string]
|
ApiResponse*[T] = Result[T, string]
|
||||||
@ -1138,6 +1139,8 @@ proc getHeadBlockRoot*(
|
|||||||
let data = res.get()
|
let data = res.get()
|
||||||
if data.execution_optimistic.get(false):
|
if data.execution_optimistic.get(false):
|
||||||
node.updateStatus(RestBeaconNodeStatus.OptSynced)
|
node.updateStatus(RestBeaconNodeStatus.OptSynced)
|
||||||
|
ApiResponse[GetBlockRootResponse].err(ResponseECNotInSyncError)
|
||||||
|
else:
|
||||||
ApiResponse[GetBlockRootResponse].ok(data)
|
ApiResponse[GetBlockRootResponse].ok(data)
|
||||||
of 400:
|
of 400:
|
||||||
debug ResponseInvalidError, response_code = response.status,
|
debug ResponseInvalidError, response_code = response.status,
|
||||||
@ -1189,8 +1192,11 @@ proc getHeadBlockRoot*(
|
|||||||
let data = res.get()
|
let data = res.get()
|
||||||
if data.execution_optimistic.get(false):
|
if data.execution_optimistic.get(false):
|
||||||
node.updateStatus(RestBeaconNodeStatus.OptSynced)
|
node.updateStatus(RestBeaconNodeStatus.OptSynced)
|
||||||
|
failures.add(ApiNodeFailure.init(node, ApiFailure.Invalid))
|
||||||
|
false
|
||||||
|
else:
|
||||||
return data
|
return data
|
||||||
|
else:
|
||||||
debug ResponseDecodeError, response_code = response.status,
|
debug ResponseDecodeError, response_code = response.status,
|
||||||
endpoint = node, reason = res.error
|
endpoint = node, reason = res.error
|
||||||
node.updateStatus(RestBeaconNodeStatus.Unexpected)
|
node.updateStatus(RestBeaconNodeStatus.Unexpected)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
# beacon_chain
|
# beacon_chain
|
||||||
# Copyright (c) 2022 Status Research & Development GmbH
|
# Copyright (c) 2022-2023 Status Research & Development GmbH
|
||||||
# Licensed and distributed under either of
|
# Licensed and distributed under either of
|
||||||
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
|
||||||
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
|
||||||
@ -360,8 +360,7 @@ proc publishSyncMessagesAndContributions(service: SyncCommitteeServiceRef,
|
|||||||
res.data.root
|
res.data.root
|
||||||
else:
|
else:
|
||||||
if res.execution_optimistic.get():
|
if res.execution_optimistic.get():
|
||||||
notice "Execution client not in sync; skipping validator duties " &
|
notice "Execution client not in sync", slot = slot
|
||||||
"for now", slot = slot
|
|
||||||
return
|
return
|
||||||
res.data.root
|
res.data.root
|
||||||
except ValidatorApiError as exc:
|
except ValidatorApiError as exc:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user