module Cardano.Chain.ProtocolConstants
( kSlotSecurityParam,
kUpdateStabilityParam,
kChainQualityThreshold,
kEpochSlots,
)
where
import Cardano.Chain.Common.BlockCount (BlockCount (..))
import Cardano.Chain.Slotting.EpochSlots (EpochSlots (..))
import Cardano.Chain.Slotting.SlotCount (SlotCount (..))
import Cardano.Prelude
kSlotSecurityParam :: BlockCount -> SlotCount
kSlotSecurityParam :: BlockCount -> SlotCount
kSlotSecurityParam = Word64 -> SlotCount
SlotCount (Word64 -> SlotCount)
-> (BlockCount -> Word64) -> BlockCount -> SlotCount
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. Word64 -> Word64 -> Word64
forall a. Num a => a -> a -> a
(*) Word64
2 (Word64 -> Word64)
-> (BlockCount -> Word64) -> BlockCount -> Word64
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. BlockCount -> Word64
unBlockCount
kUpdateStabilityParam :: BlockCount -> SlotCount
kUpdateStabilityParam :: BlockCount -> SlotCount
kUpdateStabilityParam = Word64 -> SlotCount
SlotCount (Word64 -> SlotCount)
-> (BlockCount -> Word64) -> BlockCount -> SlotCount
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. Word64 -> Word64 -> Word64
forall a. Num a => a -> a -> a
(*) Word64
4 (Word64 -> Word64)
-> (BlockCount -> Word64) -> BlockCount -> Word64
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. BlockCount -> Word64
unBlockCount
kChainQualityThreshold :: Fractional f => BlockCount -> f
kChainQualityThreshold :: BlockCount -> f
kChainQualityThreshold BlockCount
k =
Word64 -> f
forall a b. (Real a, Fractional b) => a -> b
realToFrac (BlockCount -> Word64
unBlockCount BlockCount
k)
f -> f -> f
forall a. Fractional a => a -> a -> a
/ Word64 -> f
forall a b. (Integral a, Num b) => a -> b
fromIntegral (SlotCount -> Word64
unSlotCount (SlotCount -> Word64) -> SlotCount -> Word64
forall a b. (a -> b) -> a -> b
$ BlockCount -> SlotCount
kSlotSecurityParam BlockCount
k)
kEpochSlots :: BlockCount -> EpochSlots
kEpochSlots :: BlockCount -> EpochSlots
kEpochSlots = Word64 -> EpochSlots
EpochSlots (Word64 -> EpochSlots)
-> (BlockCount -> Word64) -> BlockCount -> EpochSlots
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. Word64 -> Word64 -> Word64
forall a. Num a => a -> a -> a
(*) Word64
10 (Word64 -> Word64)
-> (BlockCount -> Word64) -> BlockCount -> Word64
forall k (cat :: k -> k -> *) (b :: k) (c :: k) (a :: k).
Category cat =>
cat b c -> cat a b -> cat a c
. BlockCount -> Word64
unBlockCount