The core protocol of WoopChain
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
woop/shard/values.go

38 lines
1.1 KiB

package shard
import (
"math/big"
shardingconfig "github.com/woop-chain/woop/internal/configs/sharding"
"github.com/woop-chain/woop/internal/utils"
)
const (
// BeaconChainShardID is the ShardID of the BeaconChain
BeaconChainShardID = 0
)
// TODO ek – Schedule should really be part of a general-purpose network
//
// configuration. We are OK for the time being,
// until the day we should let one node process join multiple networks.
var (
// Schedule is the sharding configuration schedule.
// Depends on the type of the network. Defaults to the mainnet schedule.
Schedule shardingconfig.Schedule = shardingconfig.MainnetSchedule
)
// ExternalSlotsAvailableForEpoch ..
func ExternalSlotsAvailableForEpoch(epoch *big.Int) int {
instance := Schedule.InstanceForEpoch(epoch)
stakedSlots :=
(instance.NumNodesPerShard() -
instance.NumWoopOperatedNodesPerShard()) *
int(instance.NumShards())
if stakedSlots == 0 {
utils.Logger().Debug().
Uint64("epoch", epoch.Uint64()).
Msg("have 0 external slots for in this epoch - perhaps bad config")
}
return stakedSlots
}