Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Blockchain interface validation rules.
Synopsis
- data Environment = Environment {}
- data State = State {
- currentEpoch ∷ !EpochNumber
- adoptedProtocolVersion ∷ !ProtocolVersion
- adoptedProtocolParameters ∷ !ProtocolParameters
- candidateProtocolUpdates ∷ ![CandidateProtocolUpdate]
- appVersions ∷ !ApplicationVersions
- registeredProtocolUpdateProposals ∷ !ProtocolUpdateProposals
- registeredSoftwareUpdateProposals ∷ !SoftwareUpdateProposals
- confirmedProposals ∷ !(Map UpId SlotNumber)
- proposalVotes ∷ !(Map UpId (Set KeyHash))
- registeredEndorsements ∷ !(Set Endorsement)
- proposalRegistrationSlot ∷ !(Map UpId SlotNumber)
- initialState ∷ Config → State
- data Signal = Signal {
- proposal ∷ !(Maybe (AProposal ByteString))
- votes ∷ ![AVote ByteString]
- endorsement ∷ !Endorsement
- data Error
- registerUpdate ∷ MonadError Error m ⇒ Environment → State → Signal → m State
- registerProposal ∷ MonadError Error m ⇒ Environment → State → AProposal ByteString → m State
- registerVote ∷ MonadError Error m ⇒ Environment → State → AVote ByteString → m State
- registerEndorsement ∷ MonadError Error m ⇒ Environment → State → Endorsement → m State
- registerEpoch ∷ Environment → State → EpochNumber → State
Environment
data Environment Source #
Environment | |
|
State
Update interface state.
State | |
|
Instances
Generic State Source # | |
Show State Source # | |
FromCBOR State Source # | |
ToCBOR State Source # | |
DecCBOR State Source # | |
EncCBOR State Source # | |
NFData State Source # | |
Defined in Cardano.Chain.Update.Validation.Interface | |
Eq State Source # | |
NoThunks State Source # | |
type Rep State Source # | |
Defined in Cardano.Chain.Update.Validation.Interface type Rep State = D1 ('MetaData "State" "Cardano.Chain.Update.Validation.Interface" "cardano-ledger-byron-1.0.2.0-inplace" 'False) (C1 ('MetaCons "State" 'PrefixI 'True) (((S1 ('MetaSel ('Just "currentEpoch") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 EpochNumber) :*: S1 ('MetaSel ('Just "adoptedProtocolVersion") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ProtocolVersion)) :*: (S1 ('MetaSel ('Just "adoptedProtocolParameters") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ProtocolParameters) :*: (S1 ('MetaSel ('Just "candidateProtocolUpdates") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 [CandidateProtocolUpdate]) :*: S1 ('MetaSel ('Just "appVersions") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ApplicationVersions)))) :*: ((S1 ('MetaSel ('Just "registeredProtocolUpdateProposals") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ProtocolUpdateProposals) :*: (S1 ('MetaSel ('Just "registeredSoftwareUpdateProposals") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 SoftwareUpdateProposals) :*: S1 ('MetaSel ('Just "confirmedProposals") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Map UpId SlotNumber)))) :*: (S1 ('MetaSel ('Just "proposalVotes") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Map UpId (Set KeyHash))) :*: (S1 ('MetaSel ('Just "registeredEndorsements") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Set Endorsement)) :*: S1 ('MetaSel ('Just "proposalRegistrationSlot") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (Map UpId SlotNumber))))))) |
initialState ∷ Config → State Source #
Initial update interface state
Signal
Signal combining signals from various rules
Signal | |
|
Error
Interface functions
registerUpdate ∷ MonadError Error m ⇒ Environment → State → Signal → m State Source #
Group together the other registration rules in a single rule
This corresponds to the BUPI
rule in the Byron chain specification.
registerProposal ∷ MonadError Error m ⇒ Environment → State → AProposal ByteString → m State Source #
Register an update proposal.
This corresponds to the UPIREG
rule in the Byron ledger specification.
registerVote ∷ MonadError Error m ⇒ Environment → State → AVote ByteString → m State Source #
Register a vote for the given proposal.
This corresponds to the UPIVOTE
rule in the Byron ledger
registerEndorsement ∷ MonadError Error m ⇒ Environment → State → Endorsement → m State Source #
Register an endorsement.
An endorsement represents the fact that a genesis key is ready to start using the protocol version being endorsed. In the decentralized era only genesis key holders can endorse protocol versions.
This corresponds to the UPIEND
rule in the Byron ledger
specification.
∷ Environment | |
→ State | |
→ EpochNumber | Epoch seen on the block. |
→ State |
Register an epoch. Whenever an epoch number is seen on a block this epoch number should be passed to this function so that on epoch change the protocol parameters can be updated, provided that there is an update candidate that was accepted and endorsed by a majority of the genesis keys.
This corresponds to the UPIEC
rules in the Byron ledger specification.