From ce39f03e3dfa984212169093afe79d9693c143d8 Mon Sep 17 00:00:00 2001 From: Julien Eluard Date: Wed, 27 Mar 2024 11:37:53 +0100 Subject: [PATCH 1/4] chore: reorder log statements --- packages/beacon-node/src/api/impl/validator/index.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/beacon-node/src/api/impl/validator/index.ts b/packages/beacon-node/src/api/impl/validator/index.ts index 2aef56169112..c8c1cbf53b61 100644 --- a/packages/beacon-node/src/api/impl/validator/index.ts +++ b/packages/beacon-node/src/api/impl/validator/index.ts @@ -591,10 +591,6 @@ export function getValidatorApi({ throw Error("Builder and engine both failed to produce the block within timeout"); } - if (builder.status === "rejected" && engine.status === "rejected") { - throw Error("Builder and engine both failed to produce the block"); - } - if (engine.status === "rejected" && isEngineEnabled) { logger.warn( "Engine failed to produce the block", @@ -617,6 +613,10 @@ export function getValidatorApi({ ); } + if (builder.status === "rejected" && engine.status === "rejected") { + throw Error("Builder and engine both failed to produce the block"); + } + // handle shouldOverrideBuilder separately if (engine.status === "fulfilled" && engine.value.shouldOverrideBuilder) { logger.info("Selected engine block: censorship suspected in builder blocks", { From cca6e84fdeb807ac2983f005158e093bb87ef6dc Mon Sep 17 00:00:00 2001 From: Julien Eluard Date: Wed, 27 Mar 2024 17:36:06 +0100 Subject: [PATCH 2/4] chore: address comments --- packages/beacon-node/src/api/impl/validator/index.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/beacon-node/src/api/impl/validator/index.ts b/packages/beacon-node/src/api/impl/validator/index.ts index c8c1cbf53b61..5558a56198ae 100644 --- a/packages/beacon-node/src/api/impl/validator/index.ts +++ b/packages/beacon-node/src/api/impl/validator/index.ts @@ -588,7 +588,9 @@ export function getValidatorApi({ }); if (builder.status === "pending" && engine.status === "pending") { - throw Error("Builder and engine both failed to produce the block within timeout"); + const failureSource = + isEngineEnabled && isBuilderEnabled ? "Builder and engine both" : isEngineEnabled ? "Engine" : "Builder"; + throw Error(`${failureSource} both failed to produce the block within timeout`); } if (engine.status === "rejected" && isEngineEnabled) { From 2b9739b452de0c39d811002c8351d72d1598ef36 Mon Sep 17 00:00:00 2001 From: Julien Eluard Date: Wed, 27 Mar 2024 17:38:09 +0100 Subject: [PATCH 3/4] chore: address comments --- packages/beacon-node/src/api/impl/validator/index.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/beacon-node/src/api/impl/validator/index.ts b/packages/beacon-node/src/api/impl/validator/index.ts index 5558a56198ae..0bbf73f35ada 100644 --- a/packages/beacon-node/src/api/impl/validator/index.ts +++ b/packages/beacon-node/src/api/impl/validator/index.ts @@ -616,7 +616,9 @@ export function getValidatorApi({ } if (builder.status === "rejected" && engine.status === "rejected") { - throw Error("Builder and engine both failed to produce the block"); + const failureSource = + isEngineEnabled && isBuilderEnabled ? "Builder and engine both" : isEngineEnabled ? "Engine" : "Builder"; + throw Error(`${failureSource} failed to produce the block`); } // handle shouldOverrideBuilder separately From 59bbc3f33779661e28a986467982d19e011628af Mon Sep 17 00:00:00 2001 From: Julien Eluard Date: Wed, 27 Mar 2024 20:12:53 +0100 Subject: [PATCH 4/4] chore: address comments --- packages/beacon-node/src/api/impl/validator/index.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/packages/beacon-node/src/api/impl/validator/index.ts b/packages/beacon-node/src/api/impl/validator/index.ts index 0bbf73f35ada..b54a48accb20 100644 --- a/packages/beacon-node/src/api/impl/validator/index.ts +++ b/packages/beacon-node/src/api/impl/validator/index.ts @@ -588,9 +588,7 @@ export function getValidatorApi({ }); if (builder.status === "pending" && engine.status === "pending") { - const failureSource = - isEngineEnabled && isBuilderEnabled ? "Builder and engine both" : isEngineEnabled ? "Engine" : "Builder"; - throw Error(`${failureSource} both failed to produce the block within timeout`); + throw Error("Builder and engine both failed to produce the block within timeout"); } if (engine.status === "rejected" && isEngineEnabled) { @@ -616,9 +614,9 @@ export function getValidatorApi({ } if (builder.status === "rejected" && engine.status === "rejected") { - const failureSource = - isEngineEnabled && isBuilderEnabled ? "Builder and engine both" : isEngineEnabled ? "Engine" : "Builder"; - throw Error(`${failureSource} failed to produce the block`); + throw Error( + `${isBuilderEnabled && isEngineEnabled ? "Builder and engine both" : isBuilderEnabled ? "Builder" : "Engine"} failed to produce the block` + ); } // handle shouldOverrideBuilder separately