@@ -63,7 +63,6 @@ use types::{
63
63
Attestation , AttestationData , AttestationRef , BeaconCommittee ,
64
64
BeaconStateError :: NoCommitteeFound , ChainSpec , CommitteeIndex , Epoch , EthSpec , Hash256 ,
65
65
IndexedAttestation , SelectionProof , SignedAggregateAndProof , SingleAttestation , Slot , SubnetId ,
66
- attestation:: Error as AttestationError ,
67
66
} ;
68
67
69
68
pub use batch:: { batch_verify_aggregated_attestations, batch_verify_unaggregated_attestations} ;
@@ -108,18 +107,14 @@ pub enum Error {
108
107
/// ## Peer scoring
109
108
///
110
109
/// The peer has sent an invalid message.
111
- InvalidSelectionProof {
112
- aggregator_index : u64 ,
113
- } ,
110
+ InvalidSelectionProof { aggregator_index : u64 } ,
114
111
/// The `selection_proof` on the aggregate attestation selects it as a validator, however the
115
112
/// aggregator index is not in the committee for that attestation.
116
113
///
117
114
/// ## Peer scoring
118
115
///
119
116
/// The peer has sent an invalid message.
120
- AggregatorNotInCommittee {
121
- aggregator_index : u64 ,
122
- } ,
117
+ AggregatorNotInCommittee { aggregator_index : u64 } ,
123
118
/// The `attester_index` for a `SingleAttestation` is not a member of the committee defined
124
119
/// by its `beacon_block_root`, `committee_index` and `slot`.
125
120
///
@@ -171,19 +166,15 @@ pub enum Error {
171
166
///
172
167
/// The attestation points to a block we have not yet imported. It's unclear if the attestation
173
168
/// is valid or not.
174
- UnknownHeadBlock {
175
- beacon_block_root : Hash256 ,
176
- } ,
169
+ UnknownHeadBlock { beacon_block_root : Hash256 } ,
177
170
/// The `attestation.data.beacon_block_root` block is from before the finalized checkpoint.
178
171
///
179
172
/// ## Peer scoring
180
173
///
181
174
/// The attestation is not descended from the finalized checkpoint, which is a REJECT according
182
175
/// to the spec. We downscore lightly because this could also happen if we are processing
183
176
/// attestations extremely slowly.
184
- HeadBlockFinalized {
185
- beacon_block_root : Hash256 ,
186
- } ,
177
+ HeadBlockFinalized { beacon_block_root : Hash256 } ,
187
178
/// The `attestation.data.slot` is not from the same epoch as `data.target.epoch`.
188
179
///
189
180
/// ## Peer scoring
@@ -210,10 +201,7 @@ pub enum Error {
210
201
/// ## Peer scoring
211
202
///
212
203
/// The peer has sent an invalid message.
213
- NoCommitteeForSlotAndIndex {
214
- slot : Slot ,
215
- index : CommitteeIndex ,
216
- } ,
204
+ NoCommitteeForSlotAndIndex { slot : Slot , index : CommitteeIndex } ,
217
205
/// The attestation doesn't have only one aggregation bit set.
218
206
///
219
207
/// ## Peer scoring
@@ -228,20 +216,14 @@ pub enum Error {
228
216
/// It's unclear if this attestation is valid, however we have already observed a
229
217
/// single-participant attestation from this validator for this epoch and should not observe
230
218
/// another.
231
- PriorAttestationKnown {
232
- validator_index : u64 ,
233
- epoch : Epoch ,
234
- } ,
219
+ PriorAttestationKnown { validator_index : u64 , epoch : Epoch } ,
235
220
/// The attestation is attesting to a state that is later than itself. (Viz., attesting to the
236
221
/// future).
237
222
///
238
223
/// ## Peer scoring
239
224
///
240
225
/// The peer has sent an invalid message.
241
- AttestsToFutureBlock {
242
- block : Slot ,
243
- attestation : Slot ,
244
- } ,
226
+ AttestsToFutureBlock { block : Slot , attestation : Slot } ,
245
227
/// The attestation was received on an invalid attestation subnet.
246
228
///
247
229
/// ## Peer scoring
@@ -268,10 +250,7 @@ pub enum Error {
268
250
/// ## Peer scoring
269
251
///
270
252
/// The peer has sent an invalid message.
271
- InvalidTargetEpoch {
272
- slot : Slot ,
273
- epoch : Epoch ,
274
- } ,
253
+ InvalidTargetEpoch { slot : Slot , epoch : Epoch } ,
275
254
/// The attestation references an invalid target block.
276
255
///
277
256
/// ## Peer scoring
@@ -288,7 +267,6 @@ pub enum Error {
288
267
/// We were unable to process this attestation due to an internal error. It's unclear if the
289
268
/// attestation is valid.
290
269
BeaconChainError ( Box < BeaconChainError > ) ,
291
- AttestationError ( Box < AttestationError > ) ,
292
270
}
293
271
294
272
impl From < BeaconChainError > for Error {
@@ -464,10 +442,8 @@ fn process_slash_info<T: BeaconChainTypes>(
464
442
. spec
465
443
. fork_name_at_slot :: < T :: EthSpec > ( attestation. data . slot ) ;
466
444
467
- match attestation. to_indexed ( fork_name) {
468
- Ok ( indexed_attestation) => ( indexed_attestation, true , err) ,
469
- Err ( e) => return Error :: AttestationError ( Box :: new ( e) ) ,
470
- }
445
+ let indexed_attestation = attestation. to_indexed ( fork_name) ;
446
+ ( indexed_attestation, true , err)
471
447
}
472
448
SignatureNotCheckedIndexed ( indexed, err) => ( indexed, true , err) ,
473
449
SignatureInvalid ( e) => return e,
@@ -956,15 +932,7 @@ impl<'a, T: BeaconChainTypes> IndexedUnaggregatedAttestation<'a, T> {
956
932
. spec
957
933
. fork_name_at_slot :: < T :: EthSpec > ( attestation. data . slot ) ;
958
934
959
- let indexed_attestation = match attestation. to_indexed ( fork_name) {
960
- Ok ( indexed) => indexed,
961
- Err ( e) => {
962
- return Err ( SignatureNotCheckedSingle (
963
- attestation,
964
- Error :: AttestationError ( Box :: new ( e) ) ,
965
- ) ) ;
966
- }
967
- } ;
935
+ let indexed_attestation = attestation. to_indexed ( fork_name) ;
968
936
969
937
let validator_index = match Self :: verify_middle_checks ( attestation, chain) {
970
938
Ok ( t) => t,
0 commit comments