Skip to content

Commit

Permalink
Electra: Forkchoice spectest fix (#14180)
Browse files Browse the repository at this point in the history
  • Loading branch information
prestonvanloon committed Jul 12, 2024
1 parent 5267b4b commit 3eacc37
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion testing/spectest/shared/common/forkchoice/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ func (bb *Builder) PoWBlock(pb *ethpb.PowBlock) {
}

// Attestation receives the attestation and updates forkchoice.
func (bb *Builder) Attestation(t testing.TB, a *ethpb.Attestation) {
func (bb *Builder) Attestation(t testing.TB, a ethpb.Att) {
require.NoError(t, bb.service.OnAttestation(context.TODO(), a, params.BeaconConfig().MaximumGossipClockDisparityDuration()))
}

Expand Down
9 changes: 7 additions & 2 deletions testing/spectest/shared/common/forkchoice/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func Run(t *testing.T, config string, fork int) {
}
}

func runTest(t *testing.T, config string, fork int, basePath string) {
func runTest(t *testing.T, config string, fork int, basePath string) { // nolint:gocognit
require.NoError(t, utils.SetConfig(t, config))
testFolders, _ := utils.TestFolders(t, config, version.String(fork), basePath)
if len(testFolders) == 0 {
Expand Down Expand Up @@ -144,7 +144,12 @@ func runTest(t *testing.T, config string, fork int, basePath string) {
require.NoError(t, err)
attSSZ, err := snappy.Decode(nil /* dst */, attFile)
require.NoError(t, err)
att := &ethpb.Attestation{}
var att ethpb.Att
if fork < version.Electra {
att = &ethpb.Attestation{}
} else {
att = &ethpb.AttestationElectra{}
}
require.NoError(t, att.UnmarshalSSZ(attSSZ), "Failed to unmarshal")
builder.Attestation(t, att)
}
Expand Down

0 comments on commit 3eacc37

Please sign in to comment.