Safe Haskell | None |
---|---|
Language | Haskell2010 |
Blockchain interface validation rules.
Synopsis
-
data
Environment
=
Environment
{
- protocolMagic :: !( Annotated ProtocolMagicId ByteString )
- k :: ! BlockCount
- currentSlot :: ! SlotNumber
- numGenKeys :: ! Word8
- delegationMap :: ! Map
-
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
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.