diff --git a/beacon_chain/validator_client/api.nim b/beacon_chain/validator_client/api.nim index cb86c964f..87777da05 100644 --- a/beacon_chain/validator_client/api.nim +++ b/beacon_chain/validator_client/api.nim @@ -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() diff --git a/beacon_chain/validator_client/sync_committee_service.nim b/beacon_chain/validator_client/sync_committee_service.nim index a4c70884f..436fec66a 100644 --- a/beacon_chain/validator_client/sync_committee_service.nim +++ b/beacon_chain/validator_client/sync_committee_service.nim @@ -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: