prysm-pulse/testing/endtoend/policies/policies.go
Nishant Das 76ed634f73
Capella E2E (#11951)
* save changes

* fix build

* fix build

* fix signatures

* fix

* fix

* finally fix it

* mainnet

* deps

* make it 10

* back to phase0

* fix build

* gofmt

* etherbase

* rm logs

* build

* james review

* fix yaml

* Update testing/endtoend/evaluators/fork.go

Co-authored-by: Radosław Kapka <rkapka@wp.pl>

* radek's review

---------

Co-authored-by: Radosław Kapka <rkapka@wp.pl>
2023-02-10 14:19:15 +08:00

37 lines
1.1 KiB
Go

package policies
import "github.com/prysmaticlabs/prysm/v3/consensus-types/primitives"
// AfterNthEpoch runs for every epoch after the provided epoch.
func AfterNthEpoch(afterEpoch primitives.Epoch) func(epoch primitives.Epoch) bool {
return func(currentEpoch primitives.Epoch) bool {
return currentEpoch > afterEpoch
}
}
// OnwardsNthEpoch runs for every epoch from the provided epoch.
func OnwardsNthEpoch(onwardsEpoch primitives.Epoch) func(epoch primitives.Epoch) bool {
return func(currentEpoch primitives.Epoch) bool {
return currentEpoch >= onwardsEpoch
}
}
// AllEpochs runs for all epochs.
func AllEpochs(_ primitives.Epoch) bool {
return true
}
// OnEpoch runs only for the provided epoch.
func OnEpoch(epoch primitives.Epoch) func(primitives.Epoch) bool {
return func(currentEpoch primitives.Epoch) bool {
return currentEpoch == epoch
}
}
// BetweenEpochs runs for every epoch that is between the provided epochs.
func BetweenEpochs(fromEpoch, toEpoch primitives.Epoch) func(primitives.Epoch) bool {
return func(currentEpoch primitives.Epoch) bool {
return fromEpoch < currentEpoch && currentEpoch < toEpoch
}
}