Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data PParams = PParams {}
- newtype BkSgnCntT = BkSgnCntT Double
- newtype UpAdptThd = UpAdptThd Double
- newtype FactorB = FactorB Int
- newtype FactorA = FactorA Int
- data ProtVer = ProtVer {}
- newtype UpId = UpId Int
- bkSgnCntT ∷ Lens' PParams BkSgnCntT
- bkSlotsPerEpoch ∷ Lens' PParams SlotCount
- factorA ∷ Lens' PParams FactorA
- factorB ∷ Lens' PParams FactorB
- maxBkSz ∷ Lens' PParams Natural
- maxHdrSz ∷ Lens' PParams Natural
- maxPropSz ∷ Lens' PParams Natural
- maxTxSz ∷ Lens' PParams Natural
- scriptVersion ∷ Lens' PParams Natural
- upAdptThd ∷ Lens' PParams UpAdptThd
- upTtl ∷ Lens' PParams SlotCount
- data SwVer = SwVer {}
- newtype ApVer = ApVer Natural
- newtype ApName = ApName String
- pvAlt ∷ Lens' ProtVer Natural
- pvMaj ∷ Lens' ProtVer Natural
- pvMin ∷ Lens' ProtVer Natural
- data UProp = UProp {}
- data Metadata = Metadata
- type STag = String
- type UpSD = (ProtVer, PParams, SwVer, Set STag, Metadata)
- svName ∷ Lens' SwVer ApName
- svVer ∷ Lens' SwVer ApVer
- data Vote = Vote {}
- data UpregPredicateFailure
- data UPREG
- data UpvPredicateFailure
- data UPV
- data UppvvPredicateFailure
- data UPPVV
- data UpsvvPredicateFailure
- data UPSVV
- data UpdateConstraintViolation
- upId ∷ Lens' UProp UpId
- upIssuer ∷ Lens' UProp VKey
- upMdt ∷ Lens' UProp Metadata
- upPV ∷ Lens' UProp ProtVer
- upParams ∷ Lens' UProp PParams
- upSTags ∷ Lens' UProp (Set STag)
- upSig ∷ Lens' UProp (Sig UpSD)
- upSwVer ∷ Lens' UProp SwVer
- upSigData ∷ Lens' UProp UpSD
- getUpSigData ∷ UProp → UpSD
- mkUProp ∷ UpId → VKey → ProtVer → PParams → SwVer → Set STag → Metadata → UProp
- inMap ∷ (Ord key, Eq v) ⇒ key → v → Map key v → Bool
- invertMap ∷ (Ord k, Ord v) ⇒ Map k v → Map v (Set k)
- invertBijection ∷ Ord v ⇒ Map k v → Map v k
- (==>) ∷ Bool → Bool → Bool
- pvCanFollow ∷ ProtVer → ProtVer → Bool
- checkUpdateConstraints ∷ PParams → UProp → [UpdateConstraintViolation]
- (<=?) ∷ Ord a ⇒ a → a → Maybe (a, Threshold a)
- orError ∷ Maybe (a, b) → (a → b → e) → Maybe e
- canUpdate ∷ PParams → UProp → Rule UPPVV ctx ()
- svCanFollow ∷ Map ApName (ApVer, Slot, Metadata) → (ApName, ApVer) → Bool
- data UpiecPredicateFailure = PVBUMPFailure (PredicateFailure PVBUMP)
- data UPIEC
- data PvbumpPredicateFailure = NoPVBUMPFailure
- data PVBUMP
- data UpiendPredicateFailure = UPENDFailure (PredicateFailure UPEND)
- data UPIEND
- data UpivotesPredicateFailure = ApplyVotesFailure (PredicateFailure APPLYVOTES)
- data UPIVOTES
- data ApplyVotesPredicateFailure = UpivoteFailure (PredicateFailure UPIVOTE)
- data APPLYVOTES
- data UpivotePredicateFailure = UPVOTEFailure (PredicateFailure UPVOTE)
- data UPIVOTE
- data UpiregPredicateFailure = UPREGFailure (PredicateFailure UPREG)
- data UPIREG
- type UPIState = ((ProtVer, PParams), [(Slot, (ProtVer, PParams))], Map ApName (ApVer, Slot, Metadata), Map UpId (ProtVer, PParams), Map UpId (ApName, ApVer, Metadata), Map UpId Slot, Set (UpId, VKeyGenesis), Set (ProtVer, VKeyGenesis), Map UpId Slot)
- type UPIEnv = (Slot, Bimap VKeyGenesis VKey, BlockCount, Word8)
- data UpendPredicateFailure
- data UPEND
- data FadsPredicateFailure
- data FADS
- data UpvotePredicateFailure
- data UPVOTE
- data AddvotePredicateFailure
- data ADDVOTE
- vCaster ∷ Lens' Vote VKey
- vPropId ∷ Lens' Vote UpId
- vSig ∷ Lens' Vote (Sig UpId)
- mkVote ∷ VKey → UpId → Vote
- findKey ∷ (v → Bool) → Map k v → Maybe (k, v)
- delegationMap ∷ UPIEnv → Bimap VKeyGenesis VKey
- fstUPIState ∷ UPIState → (ProtVer, PParams)
- sndUPIState ∷ UPIState → [(Slot, (ProtVer, PParams))]
- trdUPIState ∷ UPIState → Map ApName (ApVer, Slot, Metadata)
- emptyUPIState ∷ UPIState
- initialPParams ∷ PParams
- protocolVersion ∷ UPIState → ProtVer
- protocolParameters ∷ UPIState → PParams
- applicationVersions ∷ UPIState → Map ApName (ApVer, Slot, Metadata)
- confirmedProposals ∷ UPIState → Map UpId Slot
- futureAdoptions ∷ UPIState → [(Slot, (ProtVer, PParams))]
- endorsements ∷ UPIState → Set (ProtVer, VKeyGenesis)
- registeredProtocolUpdateProposals ∷ UPIState → Map UpId (ProtVer, PParams)
- upiEnvGen ∷ Gen UPIEnv
- dmapGen ∷ Word8 → Gen (Bimap VKeyGenesis VKey)
- ppsUpdateFrom ∷ PParams → Gen PParams
- increasingProbabilityAt ∷ Gen a → (a, a) → Gen a
- randomUpId ∷ Gen UpId
- reSign ∷ UProp → UProp
- pickHighlyEndorsedProtocolVersion ∷ [(ProtVer, Set VKeyGenesis)] → Gen (Maybe ProtVer)
- updateProposalAndVotesGen ∷ UPIEnv → UPIState → Gen (Maybe UProp, [Vote])
- protocolVersionEndorsementGen ∷ UPIEnv → UPIState → Gen ProtVer
- type family PredicateFailure a
Documentation
Protocol parameters.
PParams | |
|
Instances
Instances
Instances
Instances
Instances
Protocol version
Instances
Instances
Data UpId Source # | |
Defined in Byron.Spec.Ledger.Update gfoldl ∷ (∀ d b. Data d ⇒ c (d → b) → d → c b) → (∀ g. g → c g) → UpId → c UpId Source # gunfold ∷ (∀ b r. Data b ⇒ c (b → r) → c r) → (∀ r. r → c r) → Constr → c UpId Source # toConstr ∷ UpId → Constr Source # dataTypeOf ∷ UpId → DataType Source # dataCast1 ∷ Typeable t ⇒ (∀ d. Data d ⇒ c (t d)) → Maybe (c UpId) Source # dataCast2 ∷ Typeable t ⇒ (∀ d e. (Data d, Data e) ⇒ c (t d e)) → Maybe (c UpId) Source # gmapT ∷ (∀ b. Data b ⇒ b → b) → UpId → UpId Source # gmapQl ∷ (r → r' → r) → r → (∀ d. Data d ⇒ d → r') → UpId → r Source # gmapQr ∷ ∀ r r'. (r' → r → r) → r → (∀ d. Data d ⇒ d → r') → UpId → r Source # gmapQ ∷ (∀ d. Data d ⇒ d → u) → UpId → [u] Source # gmapQi ∷ Int → (∀ d. Data d ⇒ d → u) → UpId → u Source # gmapM ∷ Monad m ⇒ (∀ d. Data d ⇒ d → m d) → UpId → m UpId Source # gmapMp ∷ MonadPlus m ⇒ (∀ d. Data d ⇒ d → m d) → UpId → m UpId Source # gmapMo ∷ MonadPlus m ⇒ (∀ d. Data d ⇒ d → m d) → UpId → m UpId Source # | |
Generic UpId Source # | |
Show UpId Source # | |
HasTypeReps UpId Source # | |
Eq UpId Source # | |
Ord UpId Source # | |
Hashable UpId Source # | |
NoThunks UpId Source # | |
type Rep UpId Source # | |
Defined in Byron.Spec.Ledger.Update |
Instances
Application version
Instances
Instances
Update proposal
Instances
For now we do not have any requirements on metadata.
Instances
System tag, this represents a target operating system for the update (e.g.
linux
, win64
, or mac32
).
type UpSD = (ProtVer, PParams, SwVer, Set STag, Metadata) Source #
Part of the update proposal which must be signed
Instances
data UpregPredicateFailure Source #
These PredicateFailure
s are all throwable.
Instances
Instances
data UpvPredicateFailure Source #
These PredicateFailure
s are all throwable.
UPPVVFailure (PredicateFailure UPPVV) | |
UPSVVFailure (PredicateFailure UPSVV) | |
AVChangedInPVUpdate ApName ApVer (Maybe (ApVer, Slot, Metadata)) | |
ParamsChangedInSVUpdate | |
PVChangedInSVUpdate |
Instances
Update proposal validity
Instances
data UppvvPredicateFailure Source #
These PredicateFailure
s are all "throwable". The disjunction of the
rules' preconditions is not True
- the PredicateFailure
s represent
False
cases.
Instances
Instances
data UpsvvPredicateFailure Source #
These PredicateFailure
s are all "throwable". The disjunction of the
rules' preconditions is not True
- the PredicateFailure
s represent
False
cases.
Instances
Update Proposal Software Version Validation
Instances
data UpdateConstraintViolation Source #
Violations on the constraints of the allowed values for new protocol parameters.
BlockSizeTooLarge Natural (Threshold Natural) | |
TransactionSizeTooLarge Natural (Threshold Natural) | |
ScriptVersionTooLarge Natural (Threshold Natural) | |
ScriptVersionTooSmall Natural (Threshold Natural) |
Instances
getUpSigData ∷ UProp → UpSD Source #
invertMap ∷ (Ord k, Ord v) ⇒ Map k v → Map v (Set k) Source #
Invert a map
Examples:
>>>
import qualified Data.Map.Strict as Map
>>>
import Byron.Spec.Ledger.Update (invertMap)
>>>
invertMap (Map.fromList [('a', 1 :: Int), ('b', 2), ('c', 3), ('d', 1)])
fromList [(1,fromList "ad"),(2,fromList "b"),(3,fromList "c")]
invertBijection ∷ Ord v ⇒ Map k v → Map v k Source #
Invert a map which we assert to be a bijection. If this map is not a bijection, the behaviour is not guaranteed.
Examples:
>>>
import qualified Data.Map.Strict as Map
>>>
invertBijection (Map.fromList [('a', 1 :: Int), ('b', 2), ('c', 3)])
fromList [(1,'a'),(2,'b'),(3,'c')]
Check whether a protocol version can follow the current protocol version.
checkUpdateConstraints ∷ PParams → UProp → [UpdateConstraintViolation] Source #
Check whether an update proposal marks a valid update
data UpiecPredicateFailure Source #
Instances
Instances
data PvbumpPredicateFailure Source #
Instances
Instances
data UpiendPredicateFailure Source #
Instances
Instances
data UpivotesPredicateFailure Source #
Instances
Instances
data ApplyVotesPredicateFailure Source #
Instances
data APPLYVOTES Source #
Instances
data UpivotePredicateFailure Source #
Instances
Instances
data UpiregPredicateFailure Source #
Instances
Instances
type UPIState = ((ProtVer, PParams), [(Slot, (ProtVer, PParams))], Map ApName (ApVer, Slot, Metadata), Map UpId (ProtVer, PParams), Map UpId (ApName, ApVer, Metadata), Map UpId Slot, Set (UpId, VKeyGenesis), Set (ProtVer, VKeyGenesis), Map UpId Slot) Source #
The update interface state is shared amongst various rules, so we define it as an alias here.
type UPIEnv = (Slot, Bimap VKeyGenesis VKey, BlockCount, Word8) Source #
The update interface environment is shared amongst various rules, so we define it as an alias here.
data UpendPredicateFailure Source #
S_TryNextRule
is a structural PredicateFailure
, used to fail from
one transition rule to the other. The other PredicateFailure
s are all
throwable.
ProtVerUnknown ProtVer | |
S_TryNextRule | |
CanAdopt ProtVer | |
CannotAdopt ProtVer | |
NotADelegate VKey | |
UnconfirmedProposal UpId |
Instances
Instances
data FadsPredicateFailure Source #
Instances
Instances
data UpvotePredicateFailure Source #
The 3 non-embedded PredicateFailure
s here are all structural. The
disjuntion of the preconditions is True
- one rule either fires or the
other does.
ADDVOTEFailure (PredicateFailure ADDVOTE) | |
S_HigherThanThdAndNotAlreadyConfirmed | |
S_CfmThdNotReached | |
S_AlreadyConfirmed |
Instances
Instances
data AddvotePredicateFailure Source #
These PredicateFailure
s are all throwable.
AVSigDoesNotVerify | |
NoUpdateProposal UpId | |
VoteByNonGenesisDelegate VKey | |
RepeatVoteByGenesisDelegate VKey |
Instances
Instances
findKey ∷ (v → Bool) → Map k v → Maybe (k, v) Source #
Find the key that corresponds to the value satisfying the given predicate. In case zero or more than one key is found this function returns Nothing.
endorsements ∷ UPIState → Set (ProtVer, VKeyGenesis) Source #
ppsUpdateFrom ∷ PParams → Gen PParams Source #
Generate a protocol parameter update from a given set of current
protocol-parameters, ensuring the consistency of the new protocol parameters
w.r.t. the current ones, according to the canUpdate
predicate in the
formal specification.
TODO: we can move this into a Generator's module, but first we need to
disentangle the dependencies. Moving this to Byron.Spec.Ledger.Update.Generators
will
cause a circular dependency. I think the rules need to be moved into their
own modules.
increasingProbabilityAt ∷ Gen a → (a, a) → Gen a Source #
Generate values the given distribution in 90% of the cases, and values at the bounds of the range in 10% of the cases.
This can be used to generate enough extreme values. The exponential and
linear distributions provided by hedgehog
will generate a small percentage
of these (0-1%).
randomUpId ∷ Gen UpId Source #
Generate a random update proposal id, by picking a large number so that the probability of having an update proposal with that id is nearly zero.
pickHighlyEndorsedProtocolVersion Source #
Given a list of protocol versions and keys endorsing those versions,
generate a protocol-version endorsement, or Nothing
if the list of
endorsements is empty. The version to be endorsed will be selected from those
versions that have the most endorsements.
updateProposalAndVotesGen ∷ UPIEnv → UPIState → Gen (Maybe UProp, [Vote]) Source #
Generate an optional update-proposal and a list of votes, given an update environment and state.
The update proposal and votes need to be generated at the same time, since this allow us to generate update votes for update proposals issued in the same block as the votes.
protocolVersionEndorsementGen ∷ UPIEnv → UPIState → Gen ProtVer Source #
Generate an endorsement given an update environment and state.
type family PredicateFailure a Source #
Descriptive type for the possible failures which might cause a transition to fail.
As a convention, PredicateFailure
s which are "structural" (meaning that
they are not "throwable" in practice, and are used to pass control from
one transition rule to another) are prefixed with S_
.
Structural PredicateFailure
s represent conditions between rules where
the disjunction of all rules' preconditions is equal to True
. That is,
either one rule will throw a structural PredicateFailure
and the other
will succeed, or vice-versa.