func safeLayerRange(
	targetLayer types.LayerID,
	safetyParam,
	layersPerEpoch,
	epochOffset uint32,
) (safeLayerStart, safeLayerEnd types.LayerID) {
	if targetLayer.Uint32() <= safetyParam {
		return types.GetEffectiveGenesis(), types.GetEffectiveGenesis()
	}
	safeLayer := targetLayer.Sub(safetyParam)
	safeEpoch := safeLayer.GetEpoch()
	safeLayerStart = safeEpoch.FirstLayer()
	safeLayerEnd = safeLayerStart.Add(epochOffset)
	if safeLayer.Before(safeLayerEnd) {
		if safeLayerStart.Uint32() <= layersPerEpoch {
			return types.GetEffectiveGenesis(), types.GetEffectiveGenesis()
		}
		safeLayerStart = safeLayerStart.Sub(layersPerEpoch)
		safeLayerEnd = safeLayerEnd.Sub(layersPerEpoch)
	}
	if !safeLayerStart.After(types.GetEffectiveGenesis()) {
		return types.GetEffectiveGenesis(), types.GetEffectiveGenesis()
	}
	return
}
Returns a range of safe layers that should be used to construct the Hare active set for a given target layer
Safe layer is a layer prior to the input layer on which w.h.p. we have agreement (i.e., on its contextually valid
blocks), defined to be confidence param number of layers prior to the input layer.
package eligibility
import (
	"context"
	"errors"
	"fmt"
	"sync"
	lru "github.com/hashicorp/golang-lru"
	"github.com/spacemeshos/fixed"
	"github.com/spacemeshos/go-spacemesh/common/types"
	eCfg "github.com/spacemeshos/go-spacemesh/hare/eligibility/config"
	"github.com/spacemeshos/go-spacemesh/log"
)
const (
	vrfMsgCacheSize  = 20          
	activesCacheSize = 5           
	maxSupportedN    = 1073741824  
)
type valueProvider interface {
	Value(context.Context, types.EpochID) (uint32, error)
}
type signer interface {
	Sign(msg []byte) []byte
}
type addGet interface {
	Add(key, value interface{}) (evicted bool)
	Get(key interface{}) (value interface{}, ok bool)
}
type atxProvider interface {
	GetMinerWeightsInEpochFromView(targetEpoch types.EpochID, blocks map[types.BlockID]struct{}) (map[string]uint64, error)
	GetEpochAtxs(types.EpochID) ([]types.ATXID, error)
	GetAtxHeader(types.ATXID) (*types.ActivationTxHeader, error)
}
type meshProvider interface {
	LayerContextuallyValidBlocks(context.Context, types.LayerID) (map[types.BlockID]struct{}, error)
}
type verifierFunc = func(pub, msg, sig []byte) bool
type Oracle struct {
	lock           sync.Mutex
	beacon         valueProvider
	atxdb          atxProvider
	meshdb         meshProvider
	vrfSigner      signer
	vrfVerifier    verifierFunc
	layersPerEpoch uint32
	vrfMsgCache    addGet
	activesCache   addGet
	cfg            eCfg.Config
	log.Log
}