cardano-ledger-0.1.0.0: The blockchain layer of Cardano
Safe HaskellNone
LanguageHaskell2010

Cardano.Chain.Update.Validation.Interface

Description

Blockchain interface validation rules.

Synopsis

Environment

data Environment Source #

Constructors

Environment 

Fields

  • protocolMagic :: !(Annotated ProtocolMagicId ByteString)
     
  • k :: !BlockCount

    TODO: this is the chain security parameter, a.k.a. stableAfter, it is not part of our protocol parameters, so it seems that we need to pass it in the environment. However we need to double-check this with others.

  • currentSlot :: !SlotNumber
     
  • numGenKeys :: !Word8

    Number of genesis keys. This is used to calculate the proportion of genesis keys that need to endorse a new protocol version for it to be considered for adoption. See Cardano.Chain.Update.Validation.Endorsement.Environment.

  • delegationMap :: !Map
     

State

data State Source #

Update interface state.

Constructors

State 

Fields

Instances

Instances details
Eq State Source # 
Instance details

Defined in Cardano.Chain.Update.Validation.Interface

Methods

(==) :: State -> State -> Bool #

(/=) :: State -> State -> Bool #

Show State Source # 
Instance details

Defined in Cardano.Chain.Update.Validation.Interface

Methods

showsPrec :: Int -> State -> ShowS #

show :: State -> String #

showList :: [State] -> ShowS #

Generic State Source # 
Instance details

Defined in Cardano.Chain.Update.Validation.Interface

Associated Types

type Rep State :: Type -> Type #

Methods

from :: State -> Rep State x #

to :: Rep State x -> State #

NFData State Source # 
Instance details

Defined in Cardano.Chain.Update.Validation.Interface

Methods

rnf :: State -> () #

ToCBOR State Source # 
Instance details

Defined in Cardano.Chain.Update.Validation.Interface

Methods

toCBOR :: State -> Encoding Source #

encodedSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy State -> Size Source #

encodedListSizeExpr :: (forall t. ToCBOR t => Proxy t -> Size) -> Proxy [State] -> Size Source #

FromCBOR State Source # 
Instance details

Defined in Cardano.Chain.Update.Validation.Interface

NoThunks State Source # 
Instance details

Defined in Cardano.Chain.Update.Validation.Interface

type Rep State Source # 
Instance details

Defined in Cardano.Chain.Update.Validation.Interface

type Rep State = D1 ('MetaData "State" "Cardano.Chain.Update.Validation.Interface" "cardano-ledger-0.1.0.0-LsmGdPmHvbsHmMt4VaqSe3" '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

data Signal Source #

Signal combining signals from various rules

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.

registerEpoch Source #

Arguments

:: 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.