|
4 | 4 | # * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0). |
5 | 5 | # at your option. This file may not be copied, modified, or distributed except according to those terms. |
6 | 6 |
|
7 | | -{.push raises: [].} |
| 7 | +{.push raises: [], gcsafe.} |
8 | 8 |
|
9 | 9 | # Helpers and functions pertaining to managing the validator set |
10 | 10 |
|
@@ -445,13 +445,12 @@ func compute_proposer_indices*( |
445 | 445 | epoch: Epoch, seed: Eth2Digest, |
446 | 446 | indices: seq[ValidatorIndex] |
447 | 447 | ): seq[Opt[ValidatorIndex]] = |
448 | | - let startSlot = epoch.start_slot() |
449 | 448 | var proposerIndices: seq[Opt[ValidatorIndex]] |
450 | 449 |
|
451 | | - for i in 0..<SLOTS_PER_EPOCH: |
| 450 | + for epochSlot in epoch.slots(): |
452 | 451 | var buffer: array[32 + 8, byte] |
453 | 452 | buffer[0..31] = seed.data |
454 | | - buffer[32..39] = uint_to_bytes((startSlot + i).asUInt64) |
| 453 | + buffer[32..39] = uint_to_bytes(epochSlot.asUInt64) |
455 | 454 |
|
456 | 455 | let slotSeed = eth2digest(buffer) # Concatenate manually using buffer |
457 | 456 | let proposerIndex = compute_proposer_index(state, indices, slotSeed) |
@@ -524,14 +523,12 @@ func get_beacon_proposer_indices*( |
524 | 523 | shuffled_index, seq_len, epoch_shuffle_seed)) |
525 | 524 |
|
526 | 525 | res |
527 | | - |
528 | 526 | else: |
529 | 527 | # Not using shuffled indices here is not a bug, |
530 | 528 | # as the method of computing proposer in the below |
531 | 529 | # function does not require shuffled indices post Fulu |
532 | 530 | get_beacon_proposer_indices(state, epoch) |
533 | 531 |
|
534 | | - |
535 | 532 | func initialize_proposer_lookahead*(state: electra.BeaconState, |
536 | 533 | cache: var StateCache): |
537 | 534 | HashArray[Limit ((MIN_SEED_LOOKAHEAD + 1) * SLOTS_PER_EPOCH), uint64] = |
|
0 commit comments