beacon/blsync: add support for engine_newPayloadV4 with requests list

This commit is contained in:
Felix Lange 2025-02-24 15:17:21 +01:00
parent 757b32842e
commit 8f94c09680
3 changed files with 13 additions and 6 deletions

View File

@ -156,8 +156,9 @@ func (s *beaconBlockSync) updateEventFeed() {
return
}
s.chainHeadFeed.Send(types.ChainHeadEvent{
BeaconHead: optimistic.Attested.Header,
Block: execBlock,
Finalized: finalizedHash,
BeaconHead: optimistic.Attested.Header,
Block: execBlock,
ExecRequests: headBlock.ExecutionRequestsList(),
Finalized: finalizedHash,
})
}

View File

@ -100,6 +100,11 @@ func (ec *engineClient) callNewPayload(fork string, event types.ChainHeadEvent)
params = []any{execData}
)
switch fork {
case "electra":
method = "engine_newPayloadV4"
parentBeaconRoot := event.BeaconHead.ParentRoot
blobHashes := collectBlobHashes(event.Block)
params = append(params, blobHashes, parentBeaconRoot, event.ExecRequests)
case "deneb":
method = "engine_newPayloadV3"
parentBeaconRoot := event.BeaconHead.ParentRoot

View File

@ -230,7 +230,8 @@ func (u *FinalityUpdate) Validate() error {
// latest accepted head of the beacon chain, along with the hash of the latest
// finalized execution block.
type ChainHeadEvent struct {
BeaconHead Header
Block *ctypes.Block
Finalized common.Hash
BeaconHead Header
Block *ctypes.Block
ExecRequests [][]byte // execution layer requests (added in Electra)
Finalized common.Hash // latest finalized block hash
}