Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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 @@ -19,7 +19,6 @@ import {
IBeaconStateView,
type IBeaconStateViewBellatrix,
computeTimeAtSlot,
isParentBlockFull,
isStatePostBellatrix,
isStatePostCapella,
isStatePostGloas,
Expand Down Expand Up @@ -609,6 +608,7 @@ export async function prepareExecutionPayload(
chain: {
executionEngine: IExecutionEngine;
config: ChainForkConfig;
forkChoice: IForkChoice;
},
logger: Logger,
fork: ForkPostBellatrix,
Expand Down Expand Up @@ -746,6 +746,7 @@ function preparePayloadAttributes(
fork: ForkPostBellatrix,
chain: {
config: ChainForkConfig;
forkChoice: IForkChoice;
},
{
prepareState,
Expand All @@ -772,7 +773,10 @@ function preparePayloadAttributes(
throw new Error("Expected Capella state for withdrawals");
}

if (isStatePostGloas(prepareState) && !isParentBlockFull(prepareState)) {
if (
isStatePostGloas(prepareState) &&
!chain.forkChoice.shouldExtendPayload(toRootHex(parentBlockRoot))
) {
// When the parent block is empty, state.payloadExpectedWithdrawals holds a batch
// already deducted from CL balances but never credited on the EL (the envelope
// was not delivered). The next payload must carry those same withdrawals to
Expand Down
8 changes: 8 additions & 0 deletions packages/fork-choice/src/forkChoice/forkChoice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,14 @@ export class ForkChoice implements IForkChoice {
return this.proposerBoostRoot ?? HEX_ZERO_HASH;
}

/**
* Decides whether to extend an available payload from the previous slot,
* corresponding to the beacon block `blockRoot`.
*/
shouldExtendPayload(blockRoot: RootHex): boolean {
return this.protoArray.shouldExtendPayload(blockRoot, this.proposerBoostRoot);
}

/**
* To predict the proposer head of the next slot. That is, to predict if proposer-boost-reorg could happen.
* Reason why we can't be certain is because information of the head block is not fully available yet
Expand Down
1 change: 1 addition & 0 deletions packages/fork-choice/src/forkChoice/interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ export interface IForkChoice {
getBlockDefaultStatus(blockRoot: Root): ProtoBlock | null;
getBlockHexDefaultStatus(blockRoot: RootHex): ProtoBlock | null;
getBlockHexAndBlockHash(blockRoot: RootHex, blockHash: RootHex): ProtoBlock | null;
shouldExtendPayload(blockRoot: RootHex): boolean;
getFinalizedBlock(): ProtoBlock;
getJustifiedBlock(): ProtoBlock;
getFinalizedCheckpointSlot(): Slot;
Expand Down
Loading