Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
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 {}
- 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
- 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
Delegation scheduling
Delegation scheduling rules
Instances
Delegation scheduling sequencing
Instances
Delegation scheduling state
DSState [(Slot, (VKeyGenesis, VKey))] (Set (Epoch, VKeyGenesis)) |
Instances
Generic DSState Source # | |
Show DSState Source # | |
Eq DSState Source # | |
NoThunks DSState Source # | |
HasScheduledDelegations DSState [(Slot, (VKeyGenesis, VKey))] Source # | |
Defined in Byron.Spec.Ledger.Delegation 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-1.0.1.0-inplace" '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 #
A delegation certificate.
Instances
Data DCert Source # | |
Defined in Byron.Spec.Ledger.Delegation gfoldl ∷ (∀ d b. Data d ⇒ c (d → b) → d → c b) → (∀ g. g → c g) → DCert → c DCert # gunfold ∷ (∀ b r. Data b ⇒ c (b → r) → c r) → (∀ r. r → c r) → Constr → c DCert # dataTypeOf ∷ DCert → DataType # dataCast1 ∷ Typeable t ⇒ (∀ d. Data d ⇒ c (t d)) → Maybe (c DCert) # dataCast2 ∷ Typeable t ⇒ (∀ d e. (Data d, Data e) ⇒ c (t d e)) → Maybe (c DCert) # gmapT ∷ (∀ b. Data b ⇒ b → b) → DCert → DCert # gmapQl ∷ (r → r' → r) → r → (∀ d. Data d ⇒ d → r') → DCert → r # gmapQr ∷ ∀ r r'. (r' → r → r) → r → (∀ d. Data d ⇒ d → r') → DCert → r # gmapQ ∷ (∀ d. Data d ⇒ d → u) → DCert → [u] # gmapQi ∷ Int → (∀ d. Data d ⇒ d → u) → DCert → u # gmapM ∷ Monad m ⇒ (∀ d. Data d ⇒ d → m d) → DCert → m DCert # gmapMp ∷ MonadPlus m ⇒ (∀ d. Data d ⇒ d → m d) → DCert → m DCert # gmapMo ∷ MonadPlus m ⇒ (∀ d. Data d ⇒ d → m d) → DCert → m DCert # | |
Generic DCert Source # | |
Show DCert Source # | |
HasTypeReps DCert Source # | |
Eq DCert Source # | |
Ord DCert Source # | |
Hashable DCert Source # | |
NoThunks 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-1.0.1.0-inplace" '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
DSEnv | |
|
Instances
Generic DSEnv Source # | |
Show DSEnv Source # | |
Eq 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-1.0.1.0-inplace" '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
DState | |
|
Instances
Generic DState Source # | |
Show DState Source # | |
Eq 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-1.0.1.0-inplace" '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
DIState (Bimap VKeyGenesis VKey) (Map VKeyGenesis Slot) [(Slot, (VKeyGenesis, VKey))] (Set (Epoch, VKeyGenesis)) |
Instances
Generic DIState Source # | |
Show DIState Source # | |
Eq DIState Source # | |
NoThunks DIState Source # | |
HasScheduledDelegations DIState [(Slot, (VKeyGenesis, VKey))] Source # | |
Defined in Byron.Spec.Ledger.Delegation scheduledDelegations ∷ Lens' DIState [(Slot, (VKeyGenesis, VKey))] Source # | |
type Rep DIState Source # | |
Defined in Byron.Spec.Ledger.Delegation type Rep DIState = D1 ('MetaData "DIState" "Byron.Spec.Ledger.Delegation" "byron-spec-ledger-1.0.1.0-inplace" 'False) (C1 ('MetaCons "DIState" 'PrefixI 'True) ((S1 ('MetaSel ('Just "_dIStateDelegationMap") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Bimap VKeyGenesis VKey)) :*: S1 ('MetaSel ('Just "_dIStateLastDelegation") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Map VKeyGenesis Slot))) :*: (S1 ('MetaSel ('Just "_dIStateScheduledDelegations") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 [(Slot, (VKeyGenesis, VKey))]) :*: S1 ('MetaSel ('Just "_dIStateKeyEpochDelegations") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 (Set (Epoch, VKeyGenesis)))))) |
_dIStateScheduledDelegations ∷ DIState → [(Slot, (VKeyGenesis, VKey))] Source #
liveAfter ∷ BlockCount → SlotCount Source #
Compute after which slot the delegation certificate will become live, using the chain stability parameter.
Instances
Data EpochDiff Source # | |
Defined in Byron.Spec.Ledger.Delegation gfoldl ∷ (∀ d b. Data d ⇒ c (d → b) → d → c b) → (∀ g. g → c g) → EpochDiff → c EpochDiff # gunfold ∷ (∀ b r. Data b ⇒ c (b → r) → c r) → (∀ r. r → c r) → Constr → c EpochDiff # toConstr ∷ EpochDiff → Constr # dataTypeOf ∷ EpochDiff → DataType # dataCast1 ∷ Typeable t ⇒ (∀ d. Data d ⇒ c (t d)) → Maybe (c EpochDiff) # dataCast2 ∷ Typeable t ⇒ (∀ d e. (Data d, Data e) ⇒ c (t d e)) → Maybe (c EpochDiff) # gmapT ∷ (∀ b. Data b ⇒ b → b) → EpochDiff → EpochDiff # gmapQl ∷ (r → r' → r) → r → (∀ d. Data d ⇒ d → r') → EpochDiff → r # gmapQr ∷ ∀ r r'. (r' → r → r) → r → (∀ d. Data d ⇒ d → r') → EpochDiff → r # gmapQ ∷ (∀ d. Data d ⇒ d → u) → EpochDiff → [u] # gmapQi ∷ Int → (∀ d. Data d ⇒ d → u) → EpochDiff → u # gmapM ∷ Monad m ⇒ (∀ d. Data d ⇒ d → m d) → EpochDiff → m EpochDiff # gmapMp ∷ MonadPlus m ⇒ (∀ d. Data d ⇒ d → m d) → EpochDiff → m EpochDiff # gmapMo ∷ MonadPlus m ⇒ (∀ d. Data d ⇒ d → m d) → EpochDiff → m EpochDiff # | |
Generic EpochDiff Source # | |
Show EpochDiff Source # | |
Eq 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-1.0.1.0-inplace" '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 #
Instances
HasScheduledDelegations DIState [(Slot, (VKeyGenesis, VKey))] Source # | |
Defined in Byron.Spec.Ledger.Delegation scheduledDelegations ∷ Lens' DIState [(Slot, (VKeyGenesis, VKey))] Source # | |
HasScheduledDelegations DSState [(Slot, (VKeyGenesis, VKey))] Source # | |
Defined in Byron.Spec.Ledger.Delegation scheduledDelegations ∷ Lens' DSState [(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
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.
S_BeforeExistingDelegation | |
S_NoLastDelegation | |
S_AfterExistingDelegation | |
S_AlreadyADelegateOf VKey VKeyGenesis |
Instances
data AdelegsPredicateFailure Source #
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.
IsNotGenesisKey | |
EpochInThePast EpochDiff | |
EpochPastNextEpoch EpochDiff | |
HasAlreadyDelegated | |
IsAlreadyScheduled | |
DoesNotVerify |
Instances
data SdelegsPredicateFailure Source #
Instances
data MsdelegPredicateFailure Source #
Instances
data DelegPredicateFailure Source #