Skip to content

Commit e28b97c

Browse files
committed
simulators/ethereum/engine: Rename struct fields
1 parent fef22b7 commit e28b97c

File tree

2 files changed

+58
-68
lines changed

2 files changed

+58
-68
lines changed

simulators/ethereum/engine/suites/blobs/steps.go

Lines changed: 20 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -114,32 +114,22 @@ type NewPayloads struct {
114114
// Delay between FcU and GetPayload calls
115115
GetPayloadDelay uint64
116116
// Extra modifications on NewPayload to the versioned hashes
117-
VersionedHashesModification *VersionedHashesModification
117+
VersionedHashes *VersionedHashes
118118
}
119119

120-
// Tests to do:
121-
// - Test removing a versioned hash from the payload
122-
// - Test adding a versioned hash to the payload
123-
// - Test modifying a versioned hash in the payload
124-
// - Test modifying the version of a versioned hash in the payload
125-
// - Test with nil versioned hashes
126-
// - Test with empty versioned hashes (when payload contains blobs)
127-
// - Test with non-empty versioned hashes (when payload does not contain blobs)
128-
// - All tests with and without syncing the client
129-
130-
type VersionedHashesModification struct {
131-
VersionedHashesBlobs []helper.BlobID
132-
HashVersions []byte
120+
type VersionedHashes struct {
121+
Blobs []helper.BlobID
122+
HashVersions []byte
133123
}
134124

135-
func (v *VersionedHashesModification) VersionedHashes() ([]common.Hash, error) {
136-
if v.VersionedHashesBlobs == nil {
125+
func (v *VersionedHashes) VersionedHashes() ([]common.Hash, error) {
126+
if v.Blobs == nil {
137127
return nil, nil
138128
}
139129

140-
versionedHashes := make([]common.Hash, len(v.VersionedHashesBlobs))
130+
versionedHashes := make([]common.Hash, len(v.Blobs))
141131

142-
for i, blobID := range v.VersionedHashesBlobs {
132+
for i, blobID := range v.Blobs {
143133
var version byte
144134
if v.HashVersions != nil && len(v.HashVersions) > i {
145135
version = v.HashVersions[i]
@@ -155,10 +145,10 @@ func (v *VersionedHashesModification) VersionedHashes() ([]common.Hash, error) {
155145
return versionedHashes, nil
156146
}
157147

158-
func (v *VersionedHashesModification) Description() string {
159-
desc := "VersionedHashesModification: "
160-
if v.VersionedHashesBlobs != nil {
161-
desc += fmt.Sprintf("%v", v.VersionedHashesBlobs)
148+
func (v *VersionedHashes) Description() string {
149+
desc := "VersionedHashes: "
150+
if v.Blobs != nil {
151+
desc += fmt.Sprintf("%v", v.Blobs)
162152
}
163153
if v.HashVersions != nil {
164154
desc += fmt.Sprintf(" with versions %v", v.HashVersions)
@@ -307,9 +297,9 @@ func (step NewPayloads) Execute(t *BlobTestContext) error {
307297
}
308298
},
309299
OnNewPayloadBroadcast: func() {
310-
if step.VersionedHashesModification != nil {
300+
if step.VersionedHashes != nil {
311301
// Send a new payload with the modified versioned hashes
312-
versionedHashes, err := step.VersionedHashesModification.VersionedHashes()
302+
versionedHashes, err := step.VersionedHashes.VersionedHashes()
313303
if err != nil {
314304
t.Fatalf("FAIL: Error getting modified versioned hashes (payload %d/%d): %v", p+1, payloadCount, err)
315305
}
@@ -330,8 +320,8 @@ func (step NewPayloads) Execute(t *BlobTestContext) error {
330320
}
331321

332322
func (step NewPayloads) Description() string {
333-
if step.VersionedHashesModification != nil {
334-
return fmt.Sprintf("NewPayloads: %d payloads, %d blobs expected, %s", step.GetPayloadCount(), step.ExpectedIncludedBlobCount, step.VersionedHashesModification.Description())
323+
if step.VersionedHashes != nil {
324+
return fmt.Sprintf("NewPayloads: %d payloads, %d blobs expected, %s", step.GetPayloadCount(), step.ExpectedIncludedBlobCount, step.VersionedHashes.Description())
335325
}
336326
return fmt.Sprintf("NewPayloads: %d payloads, %d blobs expected", step.GetPayloadCount(), step.ExpectedIncludedBlobCount)
337327
}
@@ -423,7 +413,7 @@ func (step SendBlobTransactions) Description() string {
423413
type SendModifiedLatestPayload struct {
424414
ClientID uint64
425415
// Versioned hashes modification
426-
VersionedHashesModification *VersionedHashesModification
416+
VersionedHashes *VersionedHashes
427417
// Expected status of the new payload request
428418
ExpectedStatus test.PayloadStatus
429419
}
@@ -435,7 +425,7 @@ func (step SendModifiedLatestPayload) Execute(t *BlobTestContext) error {
435425
return fmt.Errorf("no payload available")
436426
}
437427
// Modify the versioned hashes
438-
versionedHashes, err := step.VersionedHashesModification.VersionedHashes()
428+
versionedHashes, err := step.VersionedHashes.VersionedHashes()
439429
if err != nil {
440430
return fmt.Errorf("error getting modified versioned hashes: %v", err)
441431
}
@@ -451,8 +441,8 @@ func (step SendModifiedLatestPayload) Execute(t *BlobTestContext) error {
451441

452442
func (step SendModifiedLatestPayload) Description() string {
453443
desc := fmt.Sprintf("SendModifiedLatestPayload: client %d, expected status %s, ", step.ClientID, step.ExpectedStatus)
454-
if step.VersionedHashesModification != nil {
455-
desc += step.VersionedHashesModification.Description()
444+
if step.VersionedHashes != nil {
445+
desc += step.VersionedHashes.Description()
456446
}
457447

458448
return desc

simulators/ethereum/engine/suites/blobs/tests.go

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -313,8 +313,8 @@ var Tests = []test.SpecInterface{
313313
NewPayloads{
314314
ExpectedIncludedBlobCount: 2,
315315
ExpectedBlobs: []helper.BlobID{0, 1},
316-
VersionedHashesModification: &VersionedHashesModification{
317-
VersionedHashesBlobs: []helper.BlobID{0},
316+
VersionedHashes: &VersionedHashes{
317+
Blobs: []helper.BlobID{0},
318318
},
319319
},
320320
},
@@ -338,8 +338,8 @@ var Tests = []test.SpecInterface{
338338
NewPayloads{
339339
ExpectedIncludedBlobCount: 2,
340340
ExpectedBlobs: []helper.BlobID{0, 1},
341-
VersionedHashesModification: &VersionedHashesModification{
342-
VersionedHashesBlobs: []helper.BlobID{0, 1, 2},
341+
VersionedHashes: &VersionedHashes{
342+
Blobs: []helper.BlobID{0, 1, 2},
343343
},
344344
},
345345
},
@@ -361,8 +361,8 @@ var Tests = []test.SpecInterface{
361361
NewPayloads{
362362
ExpectedIncludedBlobCount: 2,
363363
ExpectedBlobs: []helper.BlobID{0, 1},
364-
VersionedHashesModification: &VersionedHashesModification{
365-
VersionedHashesBlobs: []helper.BlobID{1, 0},
364+
VersionedHashes: &VersionedHashes{
365+
Blobs: []helper.BlobID{1, 0},
366366
},
367367
},
368368
},
@@ -384,8 +384,8 @@ var Tests = []test.SpecInterface{
384384
NewPayloads{
385385
ExpectedIncludedBlobCount: 2,
386386
ExpectedBlobs: []helper.BlobID{0, 1},
387-
VersionedHashesModification: &VersionedHashesModification{
388-
VersionedHashesBlobs: []helper.BlobID{0, 1, 1},
387+
VersionedHashes: &VersionedHashes{
388+
Blobs: []helper.BlobID{0, 1, 1},
389389
},
390390
},
391391
},
@@ -407,8 +407,8 @@ var Tests = []test.SpecInterface{
407407
NewPayloads{
408408
ExpectedIncludedBlobCount: 2,
409409
ExpectedBlobs: []helper.BlobID{0, 1},
410-
VersionedHashesModification: &VersionedHashesModification{
411-
VersionedHashesBlobs: []helper.BlobID{0, 2},
410+
VersionedHashes: &VersionedHashes{
411+
Blobs: []helper.BlobID{0, 2},
412412
},
413413
},
414414
},
@@ -429,9 +429,9 @@ var Tests = []test.SpecInterface{
429429
NewPayloads{
430430
ExpectedIncludedBlobCount: 2,
431431
ExpectedBlobs: []helper.BlobID{0, 1},
432-
VersionedHashesModification: &VersionedHashesModification{
433-
VersionedHashesBlobs: []helper.BlobID{0, 1},
434-
HashVersions: []byte{BLOB_COMMITMENT_VERSION_KZG, BLOB_COMMITMENT_VERSION_KZG + 1},
432+
VersionedHashes: &VersionedHashes{
433+
Blobs: []helper.BlobID{0, 1},
434+
HashVersions: []byte{BLOB_COMMITMENT_VERSION_KZG, BLOB_COMMITMENT_VERSION_KZG + 1},
435435
},
436436
},
437437
},
@@ -453,8 +453,8 @@ var Tests = []test.SpecInterface{
453453
NewPayloads{
454454
ExpectedIncludedBlobCount: 2,
455455
ExpectedBlobs: []helper.BlobID{0, 1},
456-
VersionedHashesModification: &VersionedHashesModification{
457-
VersionedHashesBlobs: nil,
456+
VersionedHashes: &VersionedHashes{
457+
Blobs: nil,
458458
},
459459
},
460460
},
@@ -476,8 +476,8 @@ var Tests = []test.SpecInterface{
476476
NewPayloads{
477477
ExpectedIncludedBlobCount: 2,
478478
ExpectedBlobs: []helper.BlobID{0, 1},
479-
VersionedHashesModification: &VersionedHashesModification{
480-
VersionedHashesBlobs: []helper.BlobID{},
479+
VersionedHashes: &VersionedHashes{
480+
Blobs: []helper.BlobID{},
481481
},
482482
},
483483
},
@@ -495,8 +495,8 @@ var Tests = []test.SpecInterface{
495495
NewPayloads{
496496
ExpectedIncludedBlobCount: 0,
497497
ExpectedBlobs: []helper.BlobID{},
498-
VersionedHashesModification: &VersionedHashesModification{
499-
VersionedHashesBlobs: []helper.BlobID{0, 1},
498+
VersionedHashes: &VersionedHashes{
499+
Blobs: []helper.BlobID{0, 1},
500500
},
501501
},
502502
},
@@ -530,8 +530,8 @@ var Tests = []test.SpecInterface{
530530
},
531531
SendModifiedLatestPayload{
532532
ClientID: 1,
533-
VersionedHashesModification: &VersionedHashesModification{
534-
VersionedHashesBlobs: []helper.BlobID{0},
533+
VersionedHashes: &VersionedHashes{
534+
Blobs: []helper.BlobID{0},
535535
},
536536
ExpectedStatus: test.Invalid,
537537
},
@@ -566,8 +566,8 @@ var Tests = []test.SpecInterface{
566566
},
567567
SendModifiedLatestPayload{
568568
ClientID: 1,
569-
VersionedHashesModification: &VersionedHashesModification{
570-
VersionedHashesBlobs: []helper.BlobID{0, 1, 2},
569+
VersionedHashes: &VersionedHashes{
570+
Blobs: []helper.BlobID{0, 1, 2},
571571
},
572572
ExpectedStatus: test.Invalid,
573573
},
@@ -599,8 +599,8 @@ var Tests = []test.SpecInterface{
599599
},
600600
SendModifiedLatestPayload{
601601
ClientID: 1,
602-
VersionedHashesModification: &VersionedHashesModification{
603-
VersionedHashesBlobs: []helper.BlobID{1, 0},
602+
VersionedHashes: &VersionedHashes{
603+
Blobs: []helper.BlobID{1, 0},
604604
},
605605
ExpectedStatus: test.Invalid,
606606
},
@@ -633,8 +633,8 @@ var Tests = []test.SpecInterface{
633633
},
634634
SendModifiedLatestPayload{
635635
ClientID: 1,
636-
VersionedHashesModification: &VersionedHashesModification{
637-
VersionedHashesBlobs: []helper.BlobID{0, 1, 1},
636+
VersionedHashes: &VersionedHashes{
637+
Blobs: []helper.BlobID{0, 1, 1},
638638
},
639639
ExpectedStatus: test.Invalid,
640640
},
@@ -667,8 +667,8 @@ var Tests = []test.SpecInterface{
667667
},
668668
SendModifiedLatestPayload{
669669
ClientID: 1,
670-
VersionedHashesModification: &VersionedHashesModification{
671-
VersionedHashesBlobs: []helper.BlobID{0, 2},
670+
VersionedHashes: &VersionedHashes{
671+
Blobs: []helper.BlobID{0, 2},
672672
},
673673
ExpectedStatus: test.Invalid,
674674
},
@@ -700,9 +700,9 @@ var Tests = []test.SpecInterface{
700700
},
701701
SendModifiedLatestPayload{
702702
ClientID: 1,
703-
VersionedHashesModification: &VersionedHashesModification{
704-
VersionedHashesBlobs: []helper.BlobID{0, 1},
705-
HashVersions: []byte{BLOB_COMMITMENT_VERSION_KZG, BLOB_COMMITMENT_VERSION_KZG + 1},
703+
VersionedHashes: &VersionedHashes{
704+
Blobs: []helper.BlobID{0, 1},
705+
HashVersions: []byte{BLOB_COMMITMENT_VERSION_KZG, BLOB_COMMITMENT_VERSION_KZG + 1},
706706
},
707707
ExpectedStatus: test.Invalid,
708708
},
@@ -735,8 +735,8 @@ var Tests = []test.SpecInterface{
735735
},
736736
SendModifiedLatestPayload{
737737
ClientID: 1,
738-
VersionedHashesModification: &VersionedHashesModification{
739-
VersionedHashesBlobs: nil,
738+
VersionedHashes: &VersionedHashes{
739+
Blobs: nil,
740740
},
741741
ExpectedStatus: test.Invalid,
742742
},
@@ -769,8 +769,8 @@ var Tests = []test.SpecInterface{
769769
},
770770
SendModifiedLatestPayload{
771771
ClientID: 1,
772-
VersionedHashesModification: &VersionedHashesModification{
773-
VersionedHashesBlobs: []helper.BlobID{},
772+
VersionedHashes: &VersionedHashes{
773+
Blobs: []helper.BlobID{},
774774
},
775775
ExpectedStatus: test.Invalid,
776776
},
@@ -799,8 +799,8 @@ var Tests = []test.SpecInterface{
799799
},
800800
SendModifiedLatestPayload{
801801
ClientID: 1,
802-
VersionedHashesModification: &VersionedHashesModification{
803-
VersionedHashesBlobs: []helper.BlobID{0, 1},
802+
VersionedHashes: &VersionedHashes{
803+
Blobs: []helper.BlobID{0, 1},
804804
},
805805
ExpectedStatus: test.Invalid,
806806
},

0 commit comments

Comments
 (0)