diff --git a/packages/beacon-node/src/chain/errors/executionPayloadBid.ts b/packages/beacon-node/src/chain/errors/executionPayloadBid.ts index 3402c482a856..b3d090eb95d0 100644 --- a/packages/beacon-node/src/chain/errors/executionPayloadBid.ts +++ b/packages/beacon-node/src/chain/errors/executionPayloadBid.ts @@ -11,6 +11,7 @@ export enum ExecutionPayloadBidErrorCode { UNKNOWN_BLOCK_ROOT = "EXECUTION_PAYLOAD_BID_ERROR_UNKNOWN_BLOCK_ROOT", UNKNOWN_PARENT_BLOCK_HASH = "EXECUTION_PAYLOAD_BID_ERROR_UNKNOWN_PARENT_BLOCK_HASH", INVALID_SLOT = "EXECUTION_PAYLOAD_BID_ERROR_INVALID_SLOT", + NOT_LATER_THAN_PARENT = "EXECUTION_PAYLOAD_BID_ERROR_NOT_LATER_THAN_PARENT", INVALID_SIGNATURE = "EXECUTION_PAYLOAD_BID_ERROR_INVALID_SIGNATURE", NO_MATCHING_PROPOSER_PREFERENCES = "EXECUTION_PAYLOAD_BID_ERROR_NO_MATCHING_PROPOSER_PREFERENCES", PROPOSER_PREFERENCES_FEE_RECIPIENT_MISMATCH = "EXECUTION_PAYLOAD_BID_ERROR_PROPOSER_PREFERENCES_FEE_RECIPIENT_MISMATCH", @@ -41,6 +42,7 @@ export type ExecutionPayloadBidErrorType = | {code: ExecutionPayloadBidErrorCode.UNKNOWN_BLOCK_ROOT; parentBlockRoot: RootHex} | {code: ExecutionPayloadBidErrorCode.UNKNOWN_PARENT_BLOCK_HASH; parentBlockHash: RootHex} | {code: ExecutionPayloadBidErrorCode.INVALID_SLOT; builderIndex: BuilderIndex; slot: Slot} + | {code: ExecutionPayloadBidErrorCode.NOT_LATER_THAN_PARENT; parentSlot: Slot; slot: Slot} | {code: ExecutionPayloadBidErrorCode.INVALID_SIGNATURE; builderIndex: BuilderIndex; slot: Slot} | { code: ExecutionPayloadBidErrorCode.NO_MATCHING_PROPOSER_PREFERENCES; diff --git a/packages/beacon-node/src/chain/validation/executionPayloadBid.ts b/packages/beacon-node/src/chain/validation/executionPayloadBid.ts index bec55b0f3c9d..f0b40dd18eaa 100644 --- a/packages/beacon-node/src/chain/validation/executionPayloadBid.ts +++ b/packages/beacon-node/src/chain/validation/executionPayloadBid.ts @@ -61,6 +61,17 @@ async function validateExecutionPayloadBid( }); } + // [REJECT] The bid is for a higher slot than its parent block -- i.e. + // validate that `bid.slot` is greater than the slot of the block with root + // `bid.parent_block_root`. + if (bid.slot <= parentBlock.slot) { + throw new ExecutionPayloadBidError(GossipAction.REJECT, { + code: ExecutionPayloadBidErrorCode.NOT_LATER_THAN_PARENT, + parentSlot: parentBlock.slot, + slot: bid.slot, + }); + } + // [IGNORE] A `SignedProposerPreferences` matching `bid.slot` and the bid's branch has been // seen — i.e. `proposal_slot == bid.slot` AND `dependent_root == // get_proposer_dependent_root(parent_state, compute_epoch_at_slot(bid.slot))`.