-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Chen Kai <[email protected]>
- Loading branch information
Showing
3 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
const std = @import("std"); | ||
const primitives = @import("../../primitives/types.zig"); | ||
const consensus = @import("../../consensus/types.zig"); | ||
const configs = @import("../../configs/config.zig"); | ||
const constants = @import("../../primitives/constants.zig"); | ||
const preset = @import("../../presets/preset.zig"); | ||
const phase0 = @import("../../consensus/phase0/types.zig"); | ||
const altair = @import("../../consensus/altair/types.zig"); | ||
const electra = @import("../../consensus/electra/types.zig"); | ||
const epoch_helper = @import("../../consensus/helpers/epoch.zig"); | ||
|
||
pub fn getFinalizationDelay(state: *const consensus.BeaconState) u64 { | ||
return epoch_helper.getPreviousEpoch(state) - state.finalizedCheckpointEpoch(); | ||
} | ||
|
||
pub fn isInInactivityLeak(state: *const consensus.BeaconState) bool { | ||
return getFinalizationDelay(state) > preset.ActivePreset.get().MIN_EPOCHS_TO_INACTIVITY_PENALTY; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters