prysm-pulse/endtoend/policies/policies.go
Radosław Kapka dccf0992e5
Verify eth1data vote in E2E (#7551)
* add majority vote to e2e

* extract policies to a separate package

Co-authored-by: Raul Jordan <raul@prysmaticlabs.com>
Co-authored-by: prylabs-bulldozer[bot] <58059840+prylabs-bulldozer[bot]@users.noreply.github.com>
2020-10-19 19:35:34 +00:00

28 lines
721 B
Go

package policies
// AfterNthEpoch runs for every epoch after the provided epoch.
func AfterNthEpoch(afterEpoch uint64) func(uint64) bool {
return func(currentEpoch uint64) bool {
return currentEpoch > afterEpoch
}
}
// AllEpochs runs for all epochs.
func AllEpochs(_ uint64) bool {
return true
}
// OnEpoch runs only for the provided epoch.
func OnEpoch(epoch uint64) func(uint64) bool {
return func(currentEpoch uint64) bool {
return currentEpoch == epoch
}
}
// BetweenEpochs runs for every epoch that is between the provided epochs.
func BetweenEpochs(fromEpoch, toEpoch uint64) func(uint64) bool {
return func(currentEpoch uint64) bool {
return fromEpoch < currentEpoch && currentEpoch < toEpoch
}
}