From 6be1541e5772ce0a9edef1acccecf91dd9cec66b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Kapka?= Date: Tue, 25 Nov 2025 17:17:44 +0100 Subject: [PATCH] Initialize the `ExecutionRequests` field in gossip block map (#16047) **What type of PR is this?** Other **What does this PR do? Why is it needed?** When unmarshaling a block with fastssz, if the target block's `ExecutionRequests` field is nil, it will not get populated ``` if b.ExecutionRequests == nil { b.ExecutionRequests = new(v1.ExecutionRequests) } if err = b.ExecutionRequests.UnmarshalSSZ(buf); err != nil { return err } ``` This is true for other fields and that's why we initialize them in our gossip data maps. There is no bug at the moment because even if execution requests are nil, we initialize them in `consensus-types/blocks/proto.go` ``` er := pb.ExecutionRequests if er == nil { er = &enginev1.ExecutionRequests{} } ``` However, since we initialize other fields in the data map, it's safer to do it for execution requests too, to avoid a bug in case the code in `consensus-types/blocks/proto.go` changes in the future. **Acknowledgements** - [x] I have read [CONTRIBUTING.md](https://github.com/prysmaticlabs/prysm/blob/develop/CONTRIBUTING.md). - [x] I have included a uniquely named [changelog fragment file](https://github.com/prysmaticlabs/prysm/blob/develop/CONTRIBUTING.md#maintaining-changelogmd). - [x] I have added a description to this PR with sufficient context for reviewers to understand this PR. --- beacon-chain/p2p/types/object_mapping.go | 4 ++-- changelog/radek_init-gossip-execution-requests.md | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) create mode 100644 changelog/radek_init-gossip-execution-requests.md diff --git a/beacon-chain/p2p/types/object_mapping.go b/beacon-chain/p2p/types/object_mapping.go index cd519f7325..45d1b756e2 100644 --- a/beacon-chain/p2p/types/object_mapping.go +++ b/beacon-chain/p2p/types/object_mapping.go @@ -77,12 +77,12 @@ func InitializeDataMaps() { }, bytesutil.ToBytes4(params.BeaconConfig().ElectraForkVersion): func() (interfaces.ReadOnlySignedBeaconBlock, error) { return blocks.NewSignedBeaconBlock( - ðpb.SignedBeaconBlockElectra{Block: ðpb.BeaconBlockElectra{Body: ðpb.BeaconBlockBodyElectra{ExecutionPayload: &enginev1.ExecutionPayloadDeneb{}}}}, + ðpb.SignedBeaconBlockElectra{Block: ðpb.BeaconBlockElectra{Body: ðpb.BeaconBlockBodyElectra{ExecutionPayload: &enginev1.ExecutionPayloadDeneb{}, ExecutionRequests: &enginev1.ExecutionRequests{}}}}, ) }, bytesutil.ToBytes4(params.BeaconConfig().FuluForkVersion): func() (interfaces.ReadOnlySignedBeaconBlock, error) { return blocks.NewSignedBeaconBlock( - ðpb.SignedBeaconBlockFulu{Block: ðpb.BeaconBlockElectra{Body: ðpb.BeaconBlockBodyElectra{ExecutionPayload: &enginev1.ExecutionPayloadDeneb{}}}}, + ðpb.SignedBeaconBlockFulu{Block: ðpb.BeaconBlockElectra{Body: ðpb.BeaconBlockBodyElectra{ExecutionPayload: &enginev1.ExecutionPayloadDeneb{}, ExecutionRequests: &enginev1.ExecutionRequests{}}}}, ) }, } diff --git a/changelog/radek_init-gossip-execution-requests.md b/changelog/radek_init-gossip-execution-requests.md new file mode 100644 index 0000000000..0e2461e361 --- /dev/null +++ b/changelog/radek_init-gossip-execution-requests.md @@ -0,0 +1,3 @@ +### Changed + +- Initialize the `ExecutionRequests` field in gossip block map. \ No newline at end of file