Skip to content

Commit

Permalink
feat: allow to skip gossip validation (ChainSafe#6308)
Browse files Browse the repository at this point in the history
* Allow to skip gossip validation

* Add code comment
  • Loading branch information
nazarhussain authored and ensi321 committed Jan 22, 2024
1 parent 7099fcc commit f1ced28
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/api/src/beacon/routes/beacon/block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
5 changes: 5 additions & 0 deletions packages/beacon-node/src/api/impl/beacon/blocks/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`;
Expand Down

0 comments on commit f1ced28

Please sign in to comment.