cardano-protocol-tpraos-0.1.0.0
Safe Haskell None
Language Haskell2010

Cardano.Protocol.TPraos.API

Description

Integration between the Shelley ledger and its corresponding (Transitional Praos) protocol.

In particular, this code supports extracting the components of the ledger state needed for protocol execution, both now and in a 2k-slot window.

Synopsis

Documentation

class ( ChainData ( ChainDepState ( Crypto era)), SerialisableData ( ChainDepState ( Crypto era)), Eq ( ChainTransitionError ( Crypto era)), Show ( ChainTransitionError ( Crypto era)), Show ( LedgerView ( Crypto era)), Show ( FutureLedgerViewError era), STS ( EraRule "TICKF" era), BaseM ( EraRule "TICKF" era) ~ ShelleyBase , Environment ( EraRule "TICKF" era) ~ (), State ( EraRule "TICKF" era) ~ NewEpochState era, Signal ( EraRule "TICKF" era) ~ SlotNo , PredicateFailure ( EraRule "TICKF" era) ~ TickfPredicateFailure era, HasField "_d" ( PParams era) UnitInterval , HasField "_maxBBSize" ( PParams era) Natural , HasField "_maxBHSize" ( PParams era) Natural , HasField "_protocolVersion" ( PParams era) ProtVer ) => GetLedgerView era where Source #

Minimal complete definition

Nothing

Instances

Instances details
Crypto c => GetLedgerView ( AlonzoEra c) Source #
Instance details

Defined in Cardano.Protocol.TPraos.API

Crypto c => GetLedgerView ( BabbageEra c) Source #
Instance details

Defined in Cardano.Protocol.TPraos.API

Crypto crypto => GetLedgerView ( ShelleyEra crypto) Source #
Instance details

Defined in Cardano.Protocol.TPraos.API

Crypto c => GetLedgerView ( AllegraEra c) Source #
Instance details

Defined in Cardano.Protocol.TPraos.API

Crypto c => GetLedgerView ( MaryEra c) Source #
Instance details

Defined in Cardano.Protocol.TPraos.API

data LedgerView crypto Source #

Data required by the Transitional Praos protocol from the Shelley ledger.

Instances

Instances details
Eq ( LedgerView crypto) Source #
Instance details

Defined in Cardano.Protocol.TPraos.API

Show ( LedgerView crypto) Source #
Instance details

Defined in Cardano.Protocol.TPraos.API

Generic ( LedgerView crypto) Source #
Instance details

Defined in Cardano.Protocol.TPraos.API

Associated Types

type Rep ( LedgerView crypto) :: Type -> Type Source #

NoThunks ( LedgerView crypto) Source #
Instance details

Defined in Cardano.Protocol.TPraos.API

type Rep ( LedgerView crypto) Source #
Instance details

Defined in Cardano.Protocol.TPraos.API

mkInitialShelleyLedgerView :: forall c. ShelleyGenesis ( ShelleyEra c) -> LedgerView c Source #

We construct a LedgerView using the Shelley genesis config in the same way as translateToShelleyLedgerState .

Chain state operations

The chain state is an amalgam of the protocol state and the ticked nonce.

data ChainDepState crypto Source #

Constructors

ChainDepState

Fields

Instances

Instances details
Eq ( ChainDepState crypto) Source #
Instance details

Defined in Cardano.Protocol.TPraos.API

Show ( ChainDepState crypto) Source #
Instance details

Defined in Cardano.Protocol.TPraos.API

Generic ( ChainDepState crypto) Source #
Instance details

Defined in Cardano.Protocol.TPraos.API

Associated Types

type Rep ( ChainDepState crypto) :: Type -> Type Source #

Crypto crypto => ToCBOR ( ChainDepState crypto) Source #
Instance details

Defined in Cardano.Protocol.TPraos.API

Crypto crypto => FromCBOR ( ChainDepState crypto) Source #
Instance details

Defined in Cardano.Protocol.TPraos.API

Crypto crypto => NoThunks ( ChainDepState crypto) Source #
Instance details

Defined in Cardano.Protocol.TPraos.API

type Rep ( ChainDepState crypto) Source #
Instance details

Defined in Cardano.Protocol.TPraos.API

type Rep ( ChainDepState crypto) = D1 (' MetaData "ChainDepState" "Cardano.Protocol.TPraos.API" "cardano-protocol-tpraos-0.1.0.0-La5Cvz4HrqgBuFHns9l3Vn" ' False ) ( C1 (' MetaCons "ChainDepState" ' PrefixI ' True ) ( S1 (' MetaSel (' Just "csProtocol") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 ( PrtclState crypto)) :*: ( S1 (' MetaSel (' Just "csTickn") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 TicknState ) :*: S1 (' MetaSel (' Just "csLabNonce") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 Nonce ))))

newtype ChainTransitionError crypto Source #

Instances

Instances details
Crypto crypto => Eq ( ChainTransitionError crypto) Source #
Instance details

Defined in Cardano.Protocol.TPraos.API

Crypto crypto => Show ( ChainTransitionError crypto) Source #
Instance details

Defined in Cardano.Protocol.TPraos.API

Generic ( ChainTransitionError crypto) Source #
Instance details

Defined in Cardano.Protocol.TPraos.API

Crypto crypto => NoThunks ( ChainTransitionError crypto) Source #
Instance details

Defined in Cardano.Protocol.TPraos.API

type Rep ( ChainTransitionError crypto) Source #
Instance details

Defined in Cardano.Protocol.TPraos.API

type Rep ( ChainTransitionError crypto) = D1 (' MetaData "ChainTransitionError" "Cardano.Protocol.TPraos.API" "cardano-protocol-tpraos-0.1.0.0-La5Cvz4HrqgBuFHns9l3Vn" ' True ) ( C1 (' MetaCons "ChainTransitionError" ' PrefixI ' False ) ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 [ PredicateFailure ( PRTCL crypto)])))

tickChainDepState Source #

Arguments

:: Globals
-> LedgerView crypto
-> Bool

Are we in a new epoch?

-> ChainDepState crypto
-> ChainDepState crypto

Tick the chain state to a new epoch.

updateChainDepState :: forall crypto m. ( PraosCrypto crypto, MonadError ( ChainTransitionError crypto) m) => Globals -> LedgerView crypto -> BHeader crypto -> ChainDepState crypto -> m ( ChainDepState crypto) Source #

Update the chain state based upon a new block header.

This also updates the last applied block hash.

reupdateChainDepState :: forall crypto. PraosCrypto crypto => Globals -> LedgerView crypto -> BHeader crypto -> ChainDepState crypto -> ChainDepState crypto Source #

Re-update the chain state based upon a new block header.

This function does no validation of whether the header is internally valid or consistent with the chain it is being applied to; the caller must ensure that this is valid through having previously applied it.

initialChainDepState :: Nonce -> Map ( KeyHash ' Genesis crypto) ( GenDelegPair crypto) -> ChainDepState crypto Source #

Construct an initial chain state given an initial nonce and a set of genesis delegates.

checkLeaderValue :: forall v. VRFAlgorithm v => OutputVRF v -> Rational -> ActiveSlotCoeff -> Bool Source #

Check that the certified VRF output, when used as a natural, is valid for being slot leader.

getLeaderSchedule :: ( Era era, Signable ( VRF ( Crypto era)) Seed , HasField "_d" ( PParams era) UnitInterval ) => Globals -> NewEpochState era -> ChainDepState ( Crypto era) -> KeyHash ' StakePool ( Crypto era) -> SignKeyVRF ( Crypto era) -> PParams era -> Set SlotNo Source #

Get the (private) leader schedule for this epoch.

Given a private VRF key, returns the set of slots in which this node is eligible to lead.