Skip to content

Commit

Permalink
feat:fmt
Browse files Browse the repository at this point in the history
Signed-off-by: Chen Kai <[email protected]>
  • Loading branch information
GrapeBaBa committed Nov 4, 2024
1 parent 12ec2ac commit 1cd3152
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/consensus/helpers/validator.zig
Original file line number Diff line number Diff line change
Expand Up @@ -539,22 +539,22 @@ pub fn getUnslashedParticipatingIndices(
return result_slice;
}

pub fn getEligibleValidatorIndices(state: *consensus.BeaconState,allocator:std.mem.Allocator) ![]primitives.ValidatorIndex {
pub fn getEligibleValidatorIndices(state: *consensus.BeaconState, allocator: std.mem.Allocator) ![]primitives.ValidatorIndex {
const previous_epoch = epoch_helper.getPreviousEpoch(state);
var eligible = std.ArrayList(primitives.ValidatorIndex).init(allocator);
defer eligible.deinit();

for (state.validators(), 0..) |v, index| {
if (isActiveValidator(&v, previous_epoch) or
(v.slashed and previous_epoch + 1 < v.withdrawable_epoch)) {
(v.slashed and previous_epoch + 1 < v.withdrawable_epoch))
{
try eligible.append(@as(primitives.ValidatorIndex, index));
}
}

return eligible.toOwnedSlice();
}


test "test getBalanceChurnLimit" {
preset.ActivePreset.set(preset.Presets.minimal);
defer preset.ActivePreset.reset();
Expand Down

0 comments on commit 1cd3152

Please sign in to comment.