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"
|
||||
ResponseNoSyncError = "Received nosync error response"
|
||||
ResponseDecodeError = "Received response could not be decoded"
|
||||
ResponseECNotInSyncError* = "Execution client not in sync"
|
||||
|
||||
type
|
||||
ApiResponse*[T] = Result[T, string]
|
||||
|
@ -1138,7 +1139,9 @@ proc getHeadBlockRoot*(
|
|||
let data = res.get()
|
||||
if data.execution_optimistic.get(false):
|
||||
node.updateStatus(RestBeaconNodeStatus.OptSynced)
|
||||
ApiResponse[GetBlockRootResponse].ok(data)
|
||||
ApiResponse[GetBlockRootResponse].err(ResponseECNotInSyncError)
|
||||
else:
|
||||
ApiResponse[GetBlockRootResponse].ok(data)
|
||||
of 400:
|
||||
debug ResponseInvalidError, response_code = response.status,
|
||||
endpoint = node, reason = response.getErrorMessage()
|
||||
|
@ -1189,13 +1192,16 @@ proc getHeadBlockRoot*(
|
|||
let data = res.get()
|
||||
if data.execution_optimistic.get(false):
|
||||
node.updateStatus(RestBeaconNodeStatus.OptSynced)
|
||||
return data
|
||||
|
||||
debug ResponseDecodeError, response_code = response.status,
|
||||
endpoint = node, reason = res.error
|
||||
node.updateStatus(RestBeaconNodeStatus.Unexpected)
|
||||
failures.add(ApiNodeFailure.init(node, ApiFailure.Invalid))
|
||||
false
|
||||
failures.add(ApiNodeFailure.init(node, ApiFailure.Invalid))
|
||||
false
|
||||
else:
|
||||
return data
|
||||
else:
|
||||
debug ResponseDecodeError, response_code = response.status,
|
||||
endpoint = node, reason = res.error
|
||||
node.updateStatus(RestBeaconNodeStatus.Unexpected)
|
||||
failures.add(ApiNodeFailure.init(node, ApiFailure.Invalid))
|
||||
false
|
||||
of 400:
|
||||
debug ResponseInvalidError, response_code = response.status,
|
||||
endpoint = node, reason = response.getErrorMessage()
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
# beacon_chain
|
||||
# Copyright (c) 2022 Status Research & Development GmbH
|
||||
# Copyright (c) 2022-2023 Status Research & Development GmbH
|
||||
# Licensed and distributed under either of
|
||||
# * 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).
|
||||
|
@ -360,8 +360,7 @@ proc publishSyncMessagesAndContributions(service: SyncCommitteeServiceRef,
|
|||
res.data.root
|
||||
else:
|
||||
if res.execution_optimistic.get():
|
||||
notice "Execution client not in sync; skipping validator duties " &
|
||||
"for now", slot = slot
|
||||
notice "Execution client not in sync", slot = slot
|
||||
return
|
||||
res.data.root
|
||||
except ValidatorApiError as exc:
|
||||
|
|
Loading…
Reference in New Issue