@@ -1057,13 +1057,7 @@ impl<P: Preset> Store<P> {
1057
1057
} ;
1058
1058
1059
1059
// > Check the block is valid and compute the post-state
1060
- let block_action = state_transition_for_gossip ( parent) ?;
1061
-
1062
- if let Some ( action) = block_action {
1063
- return Ok ( Some ( action) ) ;
1064
- }
1065
-
1066
- Ok ( None )
1060
+ state_transition_for_gossip ( parent)
1067
1061
}
1068
1062
1069
1063
pub fn validate_block_with_custom_state_transition (
@@ -1275,30 +1269,19 @@ impl<P: Preset> Store<P> {
1275
1269
} ,
1276
1270
) ;
1277
1271
1278
- let committee = if let Some ( committee_bits) = aggregate. committee_bits ( ) {
1279
- let committee_indices = misc:: get_committee_indices :: < P > ( * committee_bits) ;
1272
+ let index = aggregate
1273
+ . committee_bits ( )
1274
+ . and_then ( |bits| misc:: get_committee_indices :: < P > ( * bits) . next ( ) )
1275
+ . unwrap_or ( index) ;
1280
1276
1281
- let mut committees = vec ! [ ] ;
1282
-
1283
- for committee_index in committee_indices {
1284
- let committee = accessors:: beacon_committee ( & target_state, slot, committee_index) ?;
1285
-
1286
- committees. extend ( committee) ;
1287
- }
1288
-
1289
- committees. into ( )
1290
- } else {
1291
- accessors:: beacon_committee ( & target_state, slot, index) ?
1292
- . into_iter ( )
1293
- . collect :: < Box < [ _ ] > > ( )
1294
- } ;
1277
+ let committee = accessors:: beacon_committee ( & target_state, slot, index) ?;
1295
1278
1296
1279
// > The aggregator's validator index is within the committee
1297
1280
ensure ! (
1298
- committee. contains( & aggregator_index) ,
1281
+ committee. into_iter ( ) . contains( & aggregator_index) ,
1299
1282
Error :: AggregatorNotInCommittee {
1300
1283
aggregate_and_proof,
1301
- committee,
1284
+ committee: committee . into_iter ( ) . collect ( ) ,
1302
1285
} ,
1303
1286
) ;
1304
1287
@@ -1333,12 +1316,12 @@ impl<P: Preset> Store<P> {
1333
1316
) ?;
1334
1317
1335
1318
// https://github.com/ethereum/consensus-specs/pull/2847
1336
- let is_superset = self . aggregate_and_proof_supersets . check ( & aggregate) ;
1319
+ let is_subset_aggregate = ! self . aggregate_and_proof_supersets . check ( & aggregate) ;
1337
1320
1338
1321
Ok ( AggregateAndProofAction :: Accept {
1339
1322
aggregate_and_proof,
1340
1323
attesting_indices,
1341
- is_superset ,
1324
+ is_subset_aggregate ,
1342
1325
} )
1343
1326
}
1344
1327
@@ -1757,33 +1740,16 @@ impl<P: Preset> Store<P> {
1757
1740
return Ok ( BlobSidecarAction :: Ignore ( true ) ) ;
1758
1741
}
1759
1742
1760
- let mut state = self
1743
+ let state = self
1761
1744
. state_cache
1762
- . before_or_at_slot ( self , block_header. parent_root , block_header. slot )
1745
+ . try_state_at_slot ( self , block_header. parent_root , block_header. slot ) ?
1763
1746
. unwrap_or_else ( || {
1764
1747
self . chain_link ( block_header. parent_root )
1765
1748
. or_else ( || self . chain_link_before_or_at ( block_header. slot ) )
1766
1749
. map ( |chain_link| chain_link. state ( self ) )
1767
1750
. unwrap_or_else ( || self . head ( ) . state ( self ) )
1768
1751
} ) ;
1769
1752
1770
- if state. slot ( ) < block_header. slot {
1771
- if Feature :: WarnOnStateCacheSlotProcessing . is_enabled ( ) && self . is_forward_synced ( ) {
1772
- // `Backtrace::force_capture` can be costly and a warning may be excessive,
1773
- // but this is controlled by a `Feature` that should be disabled by default.
1774
- warn ! (
1775
- "processing slots for beacon state not found in state cache before state transition \
1776
- (block root: {:?}, from slot {} to {})\n {}",
1777
- block_header. parent_root,
1778
- state. slot( ) ,
1779
- block_header. slot,
1780
- Backtrace :: force_capture( ) ,
1781
- ) ;
1782
- }
1783
-
1784
- combined:: process_slots ( & self . chain_config , state. make_mut ( ) , block_header. slot ) ?;
1785
- }
1786
-
1787
1753
// [REJECT] The proposer signature of blob_sidecar.signed_block_header, is valid with respect to the block_header.proposer_index pubkey.
1788
1754
SingleVerifier . verify_singular (
1789
1755
blob_sidecar
0 commit comments