You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
log.WithError(blockchain.ErrNotDescendantOfFinalized).Debug("Could not verify finalized consistency")
147
146
return
@@ -169,70 +168,74 @@ func (s *Service) processUnaggregated(ctx context.Context, att ethpb.Att) {
169
168
return
170
169
}
171
170
172
-
varsingleAtt*ethpb.SingleAttestation
171
+
// Decide if the attestation is an Electra SingleAttestation or a Phase0 unaggregated attestation
172
+
var (
173
+
attForValidation ethpb.Att
174
+
broadcastAtt ethpb.Att
175
+
eventType feed.EventType
176
+
eventDatainterface{}
177
+
)
178
+
173
179
ifatt.Version() >=version.Electra {
174
-
varokbool
175
-
singleAtt, ok=att.(*ethpb.SingleAttestation)
180
+
singleAtt, ok:=att.(*ethpb.SingleAttestation)
176
181
if!ok {
177
182
log.Debugf("Attestation has wrong type (expected %T, got %T)", ðpb.SingleAttestation{}, att)
178
183
return
179
184
}
180
-
att=singleAtt.ToAttestationElectra(committee)
185
+
// Convert Electra SingleAttestation to unaggregated ElectraAttestation. This is needed because many parts of the codebase assume that attestations have a certain structure and SingleAttestation validates these assumptions.
Copy file name to clipboardexpand all lines: beacon-chain/sync/validate_beacon_attestation.go
+45-35
Original file line number
Diff line number
Diff line change
@@ -34,7 +34,11 @@ import (
34
34
// - The attestation is unaggregated -- that is, it has exactly one participating validator (len(get_attesting_indices(state, attestation.data, attestation.aggregation_bits)) == 1).
35
35
// - attestation.data.slot is within the last ATTESTATION_PROPAGATION_SLOT_RANGE slots (attestation.data.slot + ATTESTATION_PROPAGATION_SLOT_RANGE >= current_slot >= attestation.data.slot).
@@ -139,16 +139,37 @@ func (s *Service) validateCommitteeIndexBeaconAttestation(ctx context.Context, p
139
139
returnvalidationRes, err
140
140
}
141
141
142
-
varsingleAtt*eth.SingleAttestation
142
+
// Consolidated handling of Electra SingleAttestation vs Phase0 unaggregated attestation
143
+
var (
144
+
attForValidation eth.Att// what we'll pass to further validation
145
+
eventType feed.EventType
146
+
eventDatainterface{}
147
+
)
148
+
143
149
ifatt.Version() >=version.Electra {
144
-
singleAtt, ok=att.(*eth.SingleAttestation)
150
+
singleAtt, ok:=att.(*eth.SingleAttestation)
145
151
if!ok {
146
-
returnpubsub.ValidationIgnore, fmt.Errorf("attestation has wrong type (expected %T, got %T)", ð.SingleAttestation{}, att)
152
+
returnpubsub.ValidationIgnore, fmt.Errorf(
153
+
"attestation has wrong type (expected %T, got %T)",
154
+
ð.SingleAttestation{}, att,
155
+
)
156
+
}
157
+
// Convert Electra SingleAttestation to unaggregated ElectraAttestation. This is needed because many parts of the codebase assume that attestations have a certain structure and SingleAttestation validates these assumptions.
0 commit comments