Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export enum ExecutionPayloadBidErrorCode {
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_PREV_RANDAO = "EXECUTION_PAYLOAD_BID_ERROR_INVALID_PREV_RANDAO",
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",
Expand Down Expand Up @@ -43,6 +44,12 @@ export type ExecutionPayloadBidErrorType =
| {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_PREV_RANDAO;
builderIndex: BuilderIndex;
bidPrevRandao: string;
expectedPrevRandao: string;
}
| {code: ExecutionPayloadBidErrorCode.INVALID_SIGNATURE; builderIndex: BuilderIndex; slot: Slot}
| {
code: ExecutionPayloadBidErrorCode.NO_MATCHING_PROPOSER_PREFERENCES;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,18 @@ async function validateExecutionPayloadBid(
});
}

// [REJECT] `bid.prev_randao` is the correct RANDAO mix -- i.e. validate that
// `bid.prev_randao == get_randao_mix(parent_state, get_current_epoch(parent_state))`.
const randaoMix = state.getRandaoMix(computeEpochAtSlot(state.slot));
Comment thread
nflaig marked this conversation as resolved.
if (!byteArrayEquals(bid.prevRandao, randaoMix)) {
throw new ExecutionPayloadBidError(GossipAction.REJECT, {
code: ExecutionPayloadBidErrorCode.INVALID_PREV_RANDAO,
builderIndex: bid.builderIndex,
bidPrevRandao: toHex(bid.prevRandao),
expectedPrevRandao: toHex(randaoMix),
});
}

// [REJECT] `signed_execution_payload_bid.signature` is valid with respect to the `bid.builder_index`.
const signatureSet = createSingleSignatureSetFromComponents(
PublicKey.fromBytes(builder.pubkey),
Expand Down
Loading