From f1ced2812607dd8cd4de771e101cde6838b9b86d Mon Sep 17 00:00:00 2001 From: Nazar Hussain Date: Tue, 16 Jan 2024 18:54:37 +0100 Subject: [PATCH] feat: allow to skip gossip validation (#6308) * Allow to skip gossip validation * Add code comment --- packages/api/src/beacon/routes/beacon/block.ts | 8 ++++++++ packages/beacon-node/src/api/impl/beacon/blocks/index.ts | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/packages/api/src/beacon/routes/beacon/block.ts b/packages/api/src/beacon/routes/beacon/block.ts index b56006fe4191..95a32097028d 100644 --- a/packages/api/src/beacon/routes/beacon/block.ts +++ b/packages/api/src/beacon/routes/beacon/block.ts @@ -39,6 +39,14 @@ export type BlockHeaderResponse = { }; export enum BroadcastValidation { + /* + NOTE: The value `none` is not part of the spec. + + In case a node is configured only with the unknownBlockSync, it needs to know the unknown parent blocks on the network + to initiate the syncing process. Such cases can be covered only if we publish blocks and make sure no gossip validation + is performed on those. But this behavior is not the default. + */ + none = "none", gossip = "gossip", consensus = "consensus", consensusAndEquivocation = "consensus_and_equivocation", diff --git a/packages/beacon-node/src/api/impl/beacon/blocks/index.ts b/packages/beacon-node/src/api/impl/beacon/blocks/index.ts index 89565426426e..f2e29f00fe57 100644 --- a/packages/beacon-node/src/api/impl/beacon/blocks/index.ts +++ b/packages/beacon-node/src/api/impl/beacon/blocks/index.ts @@ -149,6 +149,11 @@ export function getBeaconBlockApi({ break; } + case routes.beacon.BroadcastValidation.none: { + chain.logger.debug("Skipping broadcast validation", valLogMeta); + break; + } + default: { // error or log warning we do not support this validation const message = `Broadcast validation of ${broadcastValidation} type not implemented yet`;