Skip to content

Commit

Permalink
fix: prevent updating execution engine state during shutdown (#5770)
Browse files Browse the repository at this point in the history
  • Loading branch information
nflaig authored Jul 18, 2023
1 parent ec81531 commit 5116493
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions packages/beacon-node/src/execution/engine/http.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import {Root, RootHex, allForks, Wei} from "@lodestar/types";
import {SLOTS_PER_EPOCH, ForkName, ForkSeq} from "@lodestar/params";
import {Logger} from "@lodestar/logger";
import {isErrorAborted} from "@lodestar/utils";
import {ErrorJsonRpcResponse, HttpRpcError} from "../../eth1/provider/jsonRpcHttpClient.js";
import {IJsonRpcHttpClient, ReqOpts} from "../../eth1/provider/jsonRpcHttpClient.js";
import {Metrics} from "../../metrics/index.js";
import {JobItemQueue} from "../../util/queue/index.js";
import {JobItemQueue, isQueueErrorAborted} from "../../util/queue/index.js";
import {EPOCHS_PER_BATCH} from "../../sync/constants.js";
import {numToQuantity} from "../../eth1/provider/utils.js";
import {IJson, RpcPayload} from "../../eth1/interface.js";
Expand Down Expand Up @@ -130,7 +131,9 @@ export class ExecutionEngineHttp implements IExecutionEngine {
this.updateEngineState(ExecutionEngineState.ONLINE);
return res;
} catch (err) {
this.updateEngineState(getExecutionEngineState({payloadError: err}));
if (!isErrorAborted(err)) {
this.updateEngineState(getExecutionEngineState({payloadError: err}));
}
throw err;
}
}
Expand Down Expand Up @@ -208,7 +211,9 @@ export class ExecutionEngineHttp implements IExecutionEngine {
// If there are errors by EL like connection refused, internal error, they need to be
// treated separate from being INVALID. For now, just pass the error upstream.
.catch((e: Error): EngineApiRpcReturnTypes[typeof method] => {
this.updateEngineState(getExecutionEngineState({payloadError: e}));
if (!isErrorAborted(e) && !isQueueErrorAborted(e)) {
this.updateEngineState(getExecutionEngineState({payloadError: e}));
}
if (e instanceof HttpRpcError || e instanceof ErrorJsonRpcResponse) {
return {status: ExecutePayloadStatus.ELERROR, latestValidHash: null, validationError: e.message};
} else {
Expand Down Expand Up @@ -306,7 +311,9 @@ export class ExecutionEngineHttp implements IExecutionEngine {
// If there are errors by EL like connection refused, internal error, they need to be
// treated separate from being INVALID. For now, just pass the error upstream.
.catch((e: Error): EngineApiRpcReturnTypes[typeof method] => {
this.updateEngineState(getExecutionEngineState({payloadError: e}));
if (!isErrorAborted(e) && !isQueueErrorAborted(e)) {
this.updateEngineState(getExecutionEngineState({payloadError: e}));
}
throw e;
});

Expand Down

0 comments on commit 5116493

Please sign in to comment.