Skip to content

Commit 6be1541

Browse files
authored
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.
1 parent b845222 commit 6be1541

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

beacon-chain/p2p/types/object_mapping.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,12 @@ func InitializeDataMaps() {
7777
},
7878
bytesutil.ToBytes4(params.BeaconConfig().ElectraForkVersion): func() (interfaces.ReadOnlySignedBeaconBlock, error) {
7979
return blocks.NewSignedBeaconBlock(
80-
&ethpb.SignedBeaconBlockElectra{Block: &ethpb.BeaconBlockElectra{Body: &ethpb.BeaconBlockBodyElectra{ExecutionPayload: &enginev1.ExecutionPayloadDeneb{}}}},
80+
&ethpb.SignedBeaconBlockElectra{Block: &ethpb.BeaconBlockElectra{Body: &ethpb.BeaconBlockBodyElectra{ExecutionPayload: &enginev1.ExecutionPayloadDeneb{}, ExecutionRequests: &enginev1.ExecutionRequests{}}}},
8181
)
8282
},
8383
bytesutil.ToBytes4(params.BeaconConfig().FuluForkVersion): func() (interfaces.ReadOnlySignedBeaconBlock, error) {
8484
return blocks.NewSignedBeaconBlock(
85-
&ethpb.SignedBeaconBlockFulu{Block: &ethpb.BeaconBlockElectra{Body: &ethpb.BeaconBlockBodyElectra{ExecutionPayload: &enginev1.ExecutionPayloadDeneb{}}}},
85+
&ethpb.SignedBeaconBlockFulu{Block: &ethpb.BeaconBlockElectra{Body: &ethpb.BeaconBlockBodyElectra{ExecutionPayload: &enginev1.ExecutionPayloadDeneb{}, ExecutionRequests: &enginev1.ExecutionRequests{}}}},
8686
)
8787
},
8888
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
### Changed
2+
3+
- Initialize the `ExecutionRequests` field in gossip block map.

0 commit comments

Comments
 (0)