File tree Expand file tree Collapse file tree 1 file changed +3
-12
lines changed
consensus/state_processing/src/upgrade Expand file tree Collapse file tree 1 file changed +3
-12
lines changed Original file line number Diff line number Diff line change 1
1
use bls:: Signature ;
2
+ use itertools:: Itertools ;
2
3
use safe_arith:: SafeArith ;
3
4
use std:: mem;
4
5
use types:: {
@@ -39,23 +40,13 @@ pub fn upgrade_to_electra<E: EthSpec>(
39
40
40
41
// Add validators that are not yet active to pending balance deposits
41
42
let validators = post. validators ( ) . clone ( ) ;
42
- let mut pre_activation = validators
43
+ let pre_activation = validators
43
44
. iter ( )
44
45
. enumerate ( )
45
46
. filter ( |( _, validator) | validator. activation_epoch == spec. far_future_epoch )
47
+ . sorted_by_key ( |( index, validator) | ( validator. activation_eligibility_epoch , * index) )
46
48
. collect :: < Vec < _ > > ( ) ;
47
49
48
- // Sort the indices by activation_eligibility_epoch and then by index
49
- pre_activation. sort_by ( |( index_a, val_a) , ( index_b, val_b) | {
50
- if val_a. activation_eligibility_epoch == val_b. activation_eligibility_epoch {
51
- index_a. cmp ( index_b)
52
- } else {
53
- val_a
54
- . activation_eligibility_epoch
55
- . cmp ( & val_b. activation_eligibility_epoch )
56
- }
57
- } ) ;
58
-
59
50
// Process validators to queue entire balance and reset them
60
51
for ( index, _) in pre_activation {
61
52
let balance = post
You can’t perform that action at this time.
0 commit comments