@@ -12,6 +12,7 @@ import (
12
12
builderApi "github.com/attestantio/go-builder-client/api"
13
13
denebApi "github.com/attestantio/go-builder-client/api/deneb"
14
14
builderSpec "github.com/attestantio/go-builder-client/spec"
15
+ eth2ApiV1Bellatrix "github.com/attestantio/go-eth2-client/api/v1/bellatrix"
15
16
eth2ApiV1Capella "github.com/attestantio/go-eth2-client/api/v1/capella"
16
17
eth2ApiV1Deneb "github.com/attestantio/go-eth2-client/api/v1/deneb"
17
18
eth2ApiV1Electra "github.com/attestantio/go-eth2-client/api/v1/electra"
@@ -26,7 +27,8 @@ import (
26
27
)
27
28
28
29
type Payload interface {
29
- * eth2ApiV1Capella.SignedBlindedBeaconBlock |
30
+ * eth2ApiV1Bellatrix.SignedBlindedBeaconBlock |
31
+ * eth2ApiV1Capella.SignedBlindedBeaconBlock |
30
32
* eth2ApiV1Deneb.SignedBlindedBeaconBlock |
31
33
* eth2ApiV1Electra.SignedBlindedBeaconBlock
32
34
}
@@ -135,6 +137,13 @@ func processPayload[P Payload](m *BoostService, log *logrus.Entry, ua UserAgent,
135
137
func verifyPayload [P Payload ](payload P , log * logrus.Entry , response * builderApi.VersionedSubmitBlindedBlockResponse ) error {
136
138
// Step 1: verify version
137
139
switch any (payload ).(type ) {
140
+ case * eth2ApiV1Bellatrix.SignedBlindedBeaconBlock :
141
+ if response .Version != spec .DataVersionBellatrix {
142
+ log .WithFields (logrus.Fields {
143
+ "version" : response .Version ,
144
+ }).Error ("response version was not bellatrix" )
145
+ return errInvalidVersion
146
+ }
138
147
case * eth2ApiV1Capella.SignedBlindedBeaconBlock :
139
148
if response .Version != spec .DataVersionCapella {
140
149
log .WithFields (logrus.Fields {
@@ -166,6 +175,10 @@ func verifyPayload[P Payload](payload P, log *logrus.Entry, response *builderApi
166
175
167
176
// Step 3: verify post-conditions
168
177
switch block := any (payload ).(type ) {
178
+ case * eth2ApiV1Bellatrix.SignedBlindedBeaconBlock :
179
+ if err := verifyBlockhash (log , payload , response .Bellatrix .BlockHash ); err != nil {
180
+ return err
181
+ }
169
182
case * eth2ApiV1Capella.SignedBlindedBeaconBlock :
170
183
if err := verifyBlockhash (log , payload , response .Capella .BlockHash ); err != nil {
171
184
return err
@@ -225,6 +238,14 @@ func verifyKZGCommitments(log *logrus.Entry, blobs *denebApi.BlobsBundle, commit
225
238
226
239
func prepareLogger [P Payload ](log * logrus.Entry , payload P , userAgent UserAgent , slotUID string ) * logrus.Entry {
227
240
switch block := any (payload ).(type ) {
241
+ case * eth2ApiV1Bellatrix.SignedBlindedBeaconBlock :
242
+ return log .WithFields (logrus.Fields {
243
+ "ua" : userAgent ,
244
+ "slot" : block .Message .Slot ,
245
+ "blockHash" : block .Message .Body .ExecutionPayloadHeader .BlockHash .String (),
246
+ "parentHash" : block .Message .Body .ExecutionPayloadHeader .ParentHash .String (),
247
+ "slotUID" : slotUID ,
248
+ })
228
249
case * eth2ApiV1Capella.SignedBlindedBeaconBlock :
229
250
return log .WithFields (logrus.Fields {
230
251
"ua" : userAgent ,
@@ -255,6 +276,8 @@ func prepareLogger[P Payload](log *logrus.Entry, payload P, userAgent UserAgent,
255
276
256
277
func slot [P Payload ](payload P ) uint64 {
257
278
switch block := any (payload ).(type ) {
279
+ case * eth2ApiV1Bellatrix.SignedBlindedBeaconBlock :
280
+ return uint64 (block .Message .Slot )
258
281
case * eth2ApiV1Capella.SignedBlindedBeaconBlock :
259
282
return uint64 (block .Message .Slot )
260
283
case * eth2ApiV1Deneb.SignedBlindedBeaconBlock :
@@ -267,6 +290,8 @@ func slot[P Payload](payload P) uint64 {
267
290
268
291
func blockHash [P Payload ](payload P ) phase0.Hash32 {
269
292
switch block := any (payload ).(type ) {
293
+ case * eth2ApiV1Bellatrix.SignedBlindedBeaconBlock :
294
+ return block .Message .Body .ExecutionPayloadHeader .BlockHash
270
295
case * eth2ApiV1Capella.SignedBlindedBeaconBlock :
271
296
return block .Message .Body .ExecutionPayloadHeader .BlockHash
272
297
case * eth2ApiV1Deneb.SignedBlindedBeaconBlock :
0 commit comments