Safe Haskell | None |
---|---|
Language | Haskell2010 |
Byron.Spec.Ledger.Delegation
Synopsis
- data SDELEG
- data SDELEGS
- data DSState = DSState [(Slot, (VKeyGenesis, VKey))] (Set (Epoch, VKeyGenesis))
- _dSStateScheduledDelegations :: DSState -> [(Slot, (VKeyGenesis, VKey))]
- _dSStateKeyEpochDelegations :: DSState -> Set (Epoch, VKeyGenesis)
- data DCert = DCert VKeyGenesis VKey Epoch (Sig (VKey, Epoch))
- delegator :: DCert -> VKeyGenesis
- delegate :: DCert -> VKey
- depoch :: DCert -> Epoch
- dwho :: DCert -> (VKeyGenesis, VKey)
- mkDCert :: VKeyGenesis -> Sig (VKey, Epoch) -> VKey -> Epoch -> DCert
- signature :: DCert -> Sig (VKey, Epoch)
- data ADELEG
- data ADELEGS
- data DSEnv = DSEnv {}
- allowedDelegators :: HasAllowedDelegators s a => Lens' s a
- data DState = DState {}
- data DELEG
- type DIEnv = DSEnv
- data DIState = DIState (Bimap VKeyGenesis VKey) (Map VKeyGenesis Slot) [(Slot, (VKeyGenesis, VKey))] (Set (Epoch, VKeyGenesis))
- _dIStateDelegationMap :: DIState -> Bimap VKeyGenesis VKey
- _dIStateLastDelegation :: DIState -> Map VKeyGenesis Slot
- _dIStateScheduledDelegations :: DIState -> [(Slot, (VKeyGenesis, VKey))]
- _dIStateKeyEpochDelegations :: DIState -> Set (Epoch, VKeyGenesis)
- liveAfter :: BlockCount -> SlotCount
- data EpochDiff = EpochDiff {
- currentEpoch :: Epoch
- certEpoch :: Epoch
- slot :: HasSlot s a => Lens' s a
- epoch :: HasEpoch s a => Lens' s a
- delegationMap :: HasDelegationMap s a => Lens' s a
- class HasScheduledDelegations s a | s -> a
- scheduledDelegations :: HasScheduledDelegations s a => Lens' s a
- dmsL :: HasDelegationMap a (Bimap VKeyGenesis VKey) => Lens' a (Bimap VKeyGenesis VKey)
- dcertGen :: DSEnv -> Set (Epoch, VKeyGenesis) -> Gen (Maybe DCert)
- dcertsGen :: DSEnv -> DIState -> Gen [DCert]
- initialEnvFromGenesisKeys :: Word8 -> Word64 -> Gen DSEnv
- randomDCertGen :: Environment DELEG -> Gen DCert
- goblinGensDELEG :: [SignalGenerator DELEG]
- delegatorOf :: Bimap VKeyGenesis VKey -> VKey -> Maybe VKeyGenesis
- delegatorDelegate :: DCert -> (VKeyGenesis, VKey)
- emptyDelegationPayloadRatio :: [[DCert]] -> Double
- thisEpochDelegationsRatio :: [(Epoch, Epoch)] -> Double
- nextEpochDelegationsRatio :: [(Epoch, Epoch)] -> Double
- selfDelegationsRatio :: [DCert] -> Double
- multipleDelegationsRatio :: [DCert] -> Double
- maxDelegationsTo :: [DCert] -> Int
- changedDelegationsRatio :: [DCert] -> Double
- maxChangedDelegations :: [DCert] -> Int
- repeatedDelegationsRatio :: [DCert] -> Double
- maxRepeatedDelegations :: [DCert] -> Int
- maxCertsPerBlock :: [[DCert]] -> Int
- data AdelegPredicateFailure
- data AdelegsPredicateFailure = ADelegFailure (PredicateFailure ADELEG)
- data SdelegPredicateFailure
- data SdelegsPredicateFailure = SDelegFailure (PredicateFailure SDELEG)
- data MsdelegPredicateFailure = SDELEGFailure (PredicateFailure SDELEG)
- data DelegPredicateFailure
- tamperedDcerts :: DIEnv -> DIState -> Gen [DCert]
Delegation scheduling
Delegation scheduling rules
Instances
Delegation scheduling sequencing
Instances
Delegation scheduling state
Constructors
DSState [(Slot, (VKeyGenesis, VKey))] (Set (Epoch, VKeyGenesis)) |
Instances
Eq DSState Source # | |
Show DSState Source # | |
Generic DSState Source # | |
NoThunks DSState Source # | |
HasScheduledDelegations DSState [(Slot, (VKeyGenesis, VKey))] Source # | |
Defined in Byron.Spec.Ledger.Delegation Methods scheduledDelegations :: Lens' DSState [(Slot, (VKeyGenesis, VKey))] Source # | |
type Rep DSState Source # | |
Defined in Byron.Spec.Ledger.Delegation type Rep DSState = D1 ('MetaData "DSState" "Byron.Spec.Ledger.Delegation" "byron-spec-ledger-0.1.0.0-AWpYh6fpW7YLETcmEzrAvm" 'False) (C1 ('MetaCons "DSState" 'PrefixI 'True) (S1 ('MetaSel ('Just "_dSStateScheduledDelegations") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 [(Slot, (VKeyGenesis, VKey))]) :*: S1 ('MetaSel ('Just "_dSStateKeyEpochDelegations") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Set (Epoch, VKeyGenesis))))) |
_dSStateScheduledDelegations :: DSState -> [(Slot, (VKeyGenesis, VKey))] Source #
_dSStateKeyEpochDelegations :: DSState -> Set (Epoch, VKeyGenesis) Source #
A delegation certificate.
Instances
Eq DCert Source # | |
Data DCert Source # | |
Defined in Byron.Spec.Ledger.Delegation Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> DCert -> c DCert # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c DCert # dataTypeOf :: DCert -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c DCert) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c DCert) # gmapT :: (forall b. Data b => b -> b) -> DCert -> DCert # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> DCert -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> DCert -> r # gmapQ :: (forall d. Data d => d -> u) -> DCert -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> DCert -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> DCert -> m DCert # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> DCert -> m DCert # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> DCert -> m DCert # | |
Ord DCert Source # | |
Show DCert Source # | |
Generic DCert Source # | |
Hashable DCert Source # | |
AddShrinks DCert Source # | |
Defined in Byron.Spec.Ledger.Delegation | |
NoThunks DCert Source # | |
HasTypeReps DCert Source # | |
GeneOps genome => Goblin genome DCert Source # | |
HasHash [DCert] Source # | |
type Rep DCert Source # | |
Defined in Byron.Spec.Ledger.Delegation type Rep DCert = D1 ('MetaData "DCert" "Byron.Spec.Ledger.Delegation" "byron-spec-ledger-0.1.0.0-AWpYh6fpW7YLETcmEzrAvm" 'False) (C1 ('MetaCons "DCert" 'PrefixI 'True) ((S1 ('MetaSel ('Just "delegator") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 VKeyGenesis) :*: S1 ('MetaSel ('Just "delegate") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 VKey)) :*: (S1 ('MetaSel ('Just "depoch") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Epoch) :*: S1 ('MetaSel ('Just "signature") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Sig (VKey, Epoch)))))) |
delegator :: DCert -> VKeyGenesis Source #
Key that delegates
Delegation activation
Delegation rules
Instances
Delegation rules sequencing
Instances
Delegation scheduling environment
Constructors
DSEnv | |
Fields
|
Instances
Eq DSEnv Source # | |
Show DSEnv Source # | |
Generic DSEnv Source # | |
SeedGoblin DSEnv Source # | |
NoThunks DSEnv Source # | |
type Rep DSEnv Source # | |
Defined in Byron.Spec.Ledger.Delegation type Rep DSEnv = D1 ('MetaData "DSEnv" "Byron.Spec.Ledger.Delegation" "byron-spec-ledger-0.1.0.0-AWpYh6fpW7YLETcmEzrAvm" 'False) (C1 ('MetaCons "DSEnv" 'PrefixI 'True) ((S1 ('MetaSel ('Just "_dSEnvAllowedDelegators") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Set VKeyGenesis)) :*: S1 ('MetaSel ('Just "_dSEnvEpoch") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Epoch)) :*: (S1 ('MetaSel ('Just "_dSEnvSlot") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Slot) :*: S1 ('MetaSel ('Just "_dSEnvK") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 BlockCount)))) |
allowedDelegators :: HasAllowedDelegators s a => Lens' s a Source #
Delegation state
Constructors
DState | |
Fields
|
Instances
Eq DState Source # | |
Show DState Source # | |
Generic DState Source # | |
NoThunks DState Source # | |
type Rep DState Source # | |
Defined in Byron.Spec.Ledger.Delegation type Rep DState = D1 ('MetaData "DState" "Byron.Spec.Ledger.Delegation" "byron-spec-ledger-0.1.0.0-AWpYh6fpW7YLETcmEzrAvm" 'False) (C1 ('MetaCons "DState" 'PrefixI 'True) (S1 ('MetaSel ('Just "_dStateDelegationMap") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Bimap VKeyGenesis VKey)) :*: S1 ('MetaSel ('Just "_dStateLastDelegation") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Map VKeyGenesis Slot)))) |
Delegation interface
Delegation interface
Instances
Constructors
DIState (Bimap VKeyGenesis VKey) (Map VKeyGenesis Slot) [(Slot, (VKeyGenesis, VKey))] (Set (Epoch, VKeyGenesis)) |
Instances
_dIStateScheduledDelegations :: DIState -> [(Slot, (VKeyGenesis, VKey))] Source #
_dIStateKeyEpochDelegations :: DIState -> Set (Epoch, VKeyGenesis) Source #
liveAfter :: BlockCount -> SlotCount Source #
Compute after which slot the delegation certificate will become live, using the chain stability parameter.
Constructors
EpochDiff | |
Fields
|
Instances
Eq EpochDiff Source # | |
Data EpochDiff Source # | |
Defined in Byron.Spec.Ledger.Delegation Methods gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> EpochDiff -> c EpochDiff # gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c EpochDiff # toConstr :: EpochDiff -> Constr # dataTypeOf :: EpochDiff -> DataType # dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c EpochDiff) # dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c EpochDiff) # gmapT :: (forall b. Data b => b -> b) -> EpochDiff -> EpochDiff # gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> EpochDiff -> r # gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> EpochDiff -> r # gmapQ :: (forall d. Data d => d -> u) -> EpochDiff -> [u] # gmapQi :: Int -> (forall d. Data d => d -> u) -> EpochDiff -> u # gmapM :: Monad m => (forall d. Data d => d -> m d) -> EpochDiff -> m EpochDiff # gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> EpochDiff -> m EpochDiff # gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> EpochDiff -> m EpochDiff # | |
Show EpochDiff Source # | |
Generic EpochDiff Source # | |
NoThunks EpochDiff Source # | |
type Rep EpochDiff Source # | |
Defined in Byron.Spec.Ledger.Delegation type Rep EpochDiff = D1 ('MetaData "EpochDiff" "Byron.Spec.Ledger.Delegation" "byron-spec-ledger-0.1.0.0-AWpYh6fpW7YLETcmEzrAvm" 'False) (C1 ('MetaCons "EpochDiff" 'PrefixI 'True) (S1 ('MetaSel ('Just "currentEpoch") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Epoch) :*: S1 ('MetaSel ('Just "certEpoch") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Epoch))) |
State lens fields
delegationMap :: HasDelegationMap s a => Lens' s a Source #
State lens type classes
class HasScheduledDelegations s a | s -> a Source #
Minimal complete definition
Instances
HasScheduledDelegations DSState [(Slot, (VKeyGenesis, VKey))] Source # | |
Defined in Byron.Spec.Ledger.Delegation Methods scheduledDelegations :: Lens' DSState [(Slot, (VKeyGenesis, VKey))] Source # | |
HasScheduledDelegations DIState [(Slot, (VKeyGenesis, VKey))] Source # | |
Defined in Byron.Spec.Ledger.Delegation Methods scheduledDelegations :: Lens' DIState [(Slot, (VKeyGenesis, VKey))] Source # |
scheduledDelegations :: HasScheduledDelegations s a => Lens' s a Source #
dmsL :: HasDelegationMap a (Bimap VKeyGenesis VKey) => Lens' a (Bimap VKeyGenesis VKey) Source #
Generators
initialEnvFromGenesisKeys Source #
Generate an initial DELEG
environment from the given number of genesis
keys.
randomDCertGen :: Environment DELEG -> Gen DCert Source #
Generate a random delegation certificate, which has a high probability of failing since we do not consider the current delegation state. So for instance, we could generate a delegation certificate for a genesis key that already delegated in this epoch.
Functions on delegation state
delegatorOf :: Bimap VKeyGenesis VKey -> VKey -> Maybe VKeyGenesis Source #
Support Functions for delegation properties
delegatorDelegate :: DCert -> (VKeyGenesis, VKey) Source #
emptyDelegationPayloadRatio :: [[DCert]] -> Double Source #
Ratio of certificate groups that are empty
thisEpochDelegationsRatio :: [(Epoch, Epoch)] -> Double Source #
Ratio of certificates that delegate to _this_ epoch, where each certificate is represented by (current epoch,cert epoch)
nextEpochDelegationsRatio :: [(Epoch, Epoch)] -> Double Source #
Ratio of certificates that delegate to the _next_ epoch, where each certificate is represented by (current epoch,cert epoch)
selfDelegationsRatio :: [DCert] -> Double Source #
Ratio of certificates that "delegate to self", that is, where the delegator and delegate are the same
multipleDelegationsRatio :: [DCert] -> Double Source #
Ratio of delegates that have multiple delegators that are delegating to them
maxDelegationsTo :: [DCert] -> Int Source #
The maximum number of delegators to any particular delegate
changedDelegationsRatio :: [DCert] -> Double Source #
Ratio of delegators that have changed their delegations
maxChangedDelegations :: [DCert] -> Int Source #
The maximum number of change-of-delegate for any particular delegator
repeatedDelegationsRatio :: [DCert] -> Double Source #
Ratio of repeated delegations to all delegations
maxRepeatedDelegations :: [DCert] -> Int Source #
The maximum number of repeated delegations in the given certificates
maxCertsPerBlock :: [[DCert]] -> Int Source #
Predicate failures
data AdelegPredicateFailure Source #
None of these PredicateFailure
s are actually "throwable". The
disjuction of the rules' preconditions is True
, which means that one of
them will pass. The PredicateFailure
just act as switches to direct
control flow to the successful one.
Constructors
S_BeforeExistingDelegation | |
S_NoLastDelegation | |
S_AfterExistingDelegation | |
S_AlreadyADelegateOf VKey VKeyGenesis |
Instances
data AdelegsPredicateFailure Source #
Constructors
ADelegFailure (PredicateFailure ADELEG) |
Instances
data SdelegPredicateFailure Source #
These PredicateFailure
s are all "throwable". The disjunction of the
rules' preconditions is not True
- the PredicateFailure
s represent
False
cases.
Constructors
IsNotGenesisKey | |
EpochInThePast EpochDiff | |
EpochPastNextEpoch EpochDiff | |
HasAlreadyDelegated | |
IsAlreadyScheduled | |
DoesNotVerify |
Instances
data SdelegsPredicateFailure Source #
Constructors
SDelegFailure (PredicateFailure SDELEG) |
Instances
data MsdelegPredicateFailure Source #
Constructors
SDELEGFailure (PredicateFailure SDELEG) |
Instances
data DelegPredicateFailure Source #
Constructors
SDelegSFailure (PredicateFailure SDELEGS) | |
ADelegSFailure (PredicateFailure ADELEGS) |