diff --git a/beacon-chain/operations/slashings/service_attester_test.go b/beacon-chain/operations/slashings/service_attester_test.go index 06ac806dfe91..3abd20cf10df 100644 --- a/beacon-chain/operations/slashings/service_attester_test.go +++ b/beacon-chain/operations/slashings/service_attester_test.go @@ -314,9 +314,7 @@ func TestPool_InsertAttesterSlashing_SigFailsVerify_ClearPool(t *testing.T) { // We mess up the signature of the second slashing. badSig := make([]byte, 96) copy(badSig, "muahaha") - pending, ok := pendingSlashings[1].attesterSlashing.(*ethpb.AttesterSlashing) - require.Equal(t, true, ok, "unexpected type of attester slashing") - pending.Attestation_1.Signature = badSig + pendingSlashings[1].attesterSlashing.(*ethpb.AttesterSlashing).Attestation_1.Signature = badSig slashings[1].Attestation_1.Signature = badSig p := &Pool{ pendingAttesterSlashing: make([]*PendingAttesterSlashing, 0), diff --git a/beacon-chain/rpc/prysm/v1alpha1/validator/proposer_test.go b/beacon-chain/rpc/prysm/v1alpha1/validator/proposer_test.go index 40fb8751a773..796cdf1d1af3 100644 --- a/beacon-chain/rpc/prysm/v1alpha1/validator/proposer_test.go +++ b/beacon-chain/rpc/prysm/v1alpha1/validator/proposer_test.go @@ -2447,9 +2447,7 @@ func TestProposer_FilterAttestation(t *testing.T) { require.NoError(t, err) sigs := make([]bls.Signature, len(attestingIndices)) var zeroSig [96]byte - att, ok := atts[i].(*ethpb.Attestation) - require.Equal(t, true, ok, "unexpected type of attestation") - att.Signature = zeroSig[:] + atts[i].(*ethpb.Attestation).Signature = zeroSig[:] for i, indice := range attestingIndices { hashTreeRoot, err := signing.ComputeSigningRoot(atts[i].GetData(), domain) @@ -2457,7 +2455,7 @@ func TestProposer_FilterAttestation(t *testing.T) { sig := privKeys[indice].Sign(hashTreeRoot[:]) sigs[i] = sig } - att.Signature = bls.AggregateSignatures(sigs).Marshal() + atts[i].(*ethpb.Attestation).Signature = bls.AggregateSignatures(sigs).Marshal() } return atts }, diff --git a/beacon-chain/slasher/detect_attestations_test.go b/beacon-chain/slasher/detect_attestations_test.go index a8e8aae333ed..0026f36877fc 100644 --- a/beacon-chain/slasher/detect_attestations_test.go +++ b/beacon-chain/slasher/detect_attestations_test.go @@ -667,13 +667,9 @@ func Test_processAttestations(t *testing.T) { ) // Create the attester slashing. - att_1, ok := wrapper_1.IndexedAttestation.(*ethpb.IndexedAttestation) - require.Equal(t, true, ok, "unexpected type of first attestation") - att_2, ok := wrapper_2.IndexedAttestation.(*ethpb.IndexedAttestation) - require.Equal(t, true, ok, "unexpected type of second attestation") expectedSlashing := ðpb.AttesterSlashing{ - Attestation_1: att_1, - Attestation_2: att_2, + Attestation_1: wrapper_1.IndexedAttestation.(*ethpb.IndexedAttestation), + Attestation_2: wrapper_2.IndexedAttestation.(*ethpb.IndexedAttestation), } root, err := expectedSlashing.HashTreeRoot() @@ -1168,9 +1164,7 @@ func Test_applyAttestationForValidator_MinSpanChunk(t *testing.T) { ) require.NoError(t, err) require.IsNil(t, slashing) - indexedAtt, ok := att.IndexedAttestation.(*ethpb.IndexedAttestation) - require.Equal(t, true, ok, "unexpected type of indexed attestation") - indexedAtt.AttestingIndices = []uint64{uint64(validatorIdx)} + att.IndexedAttestation.(*ethpb.IndexedAttestation).AttestingIndices = []uint64{uint64(validatorIdx)} err = slasherDB.SaveAttestationRecordsForValidators( ctx, []*slashertypes.IndexedAttestationWrapper{att}, @@ -1227,9 +1221,7 @@ func Test_applyAttestationForValidator_MaxSpanChunk(t *testing.T) { ) require.NoError(t, err) require.Equal(t, true, slashing == nil) - indexedAtt, ok := att.IndexedAttestation.(*ethpb.IndexedAttestation) - require.Equal(t, true, ok, "unexpected type of indexed attestation") - indexedAtt.AttestingIndices = []uint64{uint64(validatorIdx)} + att.IndexedAttestation.(*ethpb.IndexedAttestation).AttestingIndices = []uint64{uint64(validatorIdx)} err = slasherDB.SaveAttestationRecordsForValidators( ctx, []*slashertypes.IndexedAttestationWrapper{att},