diff --git a/packages/api/src/beacon/routes/beacon/block.ts b/packages/api/src/beacon/routes/beacon/block.ts index 01b0a12c870e..a36f4505dc5f 100644 --- a/packages/api/src/beacon/routes/beacon/block.ts +++ b/packages/api/src/beacon/routes/beacon/block.ts @@ -177,7 +177,7 @@ export type Api = { publishBlockV2( blockOrContents: allForks.SignedBeaconBlock | SignedBlockContents, - opts: {broadcastValidation: BroadcastValidation} + opts: {broadcastValidation?: BroadcastValidation} ): Promise< ApiClientResponse< { @@ -204,7 +204,7 @@ export type Api = { publishBlindedBlockV2( blindedBlockOrContents: allForks.SignedBlindedBeaconBlock | SignedBlindedBlockContents, - opts: {broadcastValidation: BroadcastValidation} + opts: {broadcastValidation?: BroadcastValidation} ): Promise< ApiClientResponse< { @@ -256,9 +256,9 @@ export type ReqTypes = { getBlockHeaders: {query: {slot?: number; parent_root?: string}}; getBlockRoot: BlockIdOnlyReq; publishBlock: {body: unknown}; - publishBlockV2: {body: unknown; query: {broadcast_validation: string}}; + publishBlockV2: {body: unknown; query: {broadcast_validation?: string}}; publishBlindedBlock: {body: unknown}; - publishBlindedBlockV2: {body: unknown; query: {broadcast_validation: string}}; + publishBlindedBlockV2: {body: unknown; query: {broadcast_validation?: string}}; getBlobSidecars: BlockIdOnlyReq; }; 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 3e4e04ebc887..e07161c9f266 100644 --- a/packages/beacon-node/src/api/impl/beacon/blocks/index.ts +++ b/packages/beacon-node/src/api/impl/beacon/blocks/index.ts @@ -20,7 +20,6 @@ import {ApiModules} from "../../types.js"; import {resolveBlockId, toBeaconHeaderResponse} from "./utils.js"; type PublishBlockOpts = ImportBlockOpts & {broadcastValidation?: routes.beacon.BroadcastValidation}; -const defaultPublishOpts = {broadcastValidation: routes.beacon.BroadcastValidation.none}; /** * Validator clock may be advanced from beacon's clock. If the validator requests a resource in a @@ -42,7 +41,7 @@ export function getBeaconBlockApi({ }: Pick): ServerApi { const publishBlock: ServerApi["publishBlock"] = async ( signedBlockOrContents, - opts: PublishBlockOpts = defaultPublishOpts + opts: PublishBlockOpts = {} ) => { const seenTimestampSec = Date.now() / 1000; let blockForImport: BlockInput, signedBlock: allForks.SignedBeaconBlock, signedBlobs: deneb.SignedBlobSidecars; @@ -70,7 +69,7 @@ export function getBeaconBlockApi({ // check what validations have been requested before broadcasting and publishing the block // TODO: add validation time to metrics - const broadcastValidation = opts.broadcastValidation ?? defaultPublishOpts.broadcastValidation; + const broadcastValidation = opts.broadcastValidation ?? routes.beacon.BroadcastValidation.none; switch (broadcastValidation) { case routes.beacon.BroadcastValidation.none: break; @@ -137,7 +136,7 @@ export function getBeaconBlockApi({ const publishBlindedBlock: ServerApi["publishBlindedBlock"] = async ( signedBlindedBlockOrContents, - opts: PublishBlockOpts = defaultPublishOpts + opts: PublishBlockOpts = {} ) => { const executionBuilder = chain.executionBuilder; if (!executionBuilder) throw Error("exeutionBuilder required to publish SignedBlindedBeaconBlock"); @@ -311,7 +310,7 @@ export function getBeaconBlockApi({ await publishBlindedBlock(signedBlindedBlockOrContents, opts); }, - async publishBlockV2(signedBlockOrContents, opts: PublishBlockOpts = defaultPublishOpts) { + async publishBlockV2(signedBlockOrContents, opts) { await publishBlock(signedBlockOrContents, opts); }, diff --git a/packages/validator/src/services/block.ts b/packages/validator/src/services/block.ts index b149a507077b..454232af56f6 100644 --- a/packages/validator/src/services/block.ts +++ b/packages/validator/src/services/block.ts @@ -60,7 +60,7 @@ type ProduceBlockOpts = { */ export class BlockProposingService { private readonly dutiesService: BlockDutiesService; - private readonly broadcastValidation: routes.beacon.BroadcastValidation; + private readonly broadcastValidation?: routes.beacon.BroadcastValidation; constructor( private readonly config: ChainForkConfig, @@ -80,7 +80,7 @@ export class BlockProposingService { this.notifyBlockProductionFn ); - this.broadcastValidation = broadcastValidation ?? routes.beacon.BroadcastValidation.none; + this.broadcastValidation = broadcastValidation; } removeDutiesForKey(pubkey: PubkeyHex): void {