ouroboros-consensus-shelley-0.1.0.1: Shelley ledger integration in the Ouroboros consensus layer
Safe Haskell None
Language Haskell2010

Ouroboros.Consensus.Shelley.Node.TPraos

Synopsis

Documentation

newtype MaxMajorProtVer Source #

The maximum major protocol version.

Must be at least the current major protocol version. For Cardano mainnet, the Shelley era has major protocol verison 2 .

Instances

Instances details
Eq MaxMajorProtVer
Instance details

Defined in Ouroboros.Consensus.Protocol.Praos.Common

Show MaxMajorProtVer
Instance details

Defined in Ouroboros.Consensus.Protocol.Praos.Common

Generic MaxMajorProtVer
Instance details

Defined in Ouroboros.Consensus.Protocol.Praos.Common

NoThunks MaxMajorProtVer
Instance details

Defined in Ouroboros.Consensus.Protocol.Praos.Common

type Rep MaxMajorProtVer
Instance details

Defined in Ouroboros.Consensus.Protocol.Praos.Common

type Rep MaxMajorProtVer = D1 (' MetaData "MaxMajorProtVer" "Ouroboros.Consensus.Protocol.Praos.Common" "ouroboros-consensus-protocol-0.1.0.1-zKRBoYOfUlKsvZd6xB0lb" ' True ) ( C1 (' MetaCons "MaxMajorProtVer" ' PrefixI ' True ) ( S1 (' MetaSel (' Just "getMaxMajorProtVer") ' NoSourceUnpackedness ' NoSourceStrictness ' DecidedLazy ) ( Rec0 Natural )))

data ProtocolParamsShelleyBased era Source #

Parameters common to all Shelley-based ledgers.

When running a chain with multiple Shelley-based eras, in addition to the per-era protocol parameters, one value of ProtocolParamsShelleyBased will be needed, which is shared among all Shelley-based eras.

The era parameter determines from which era the genesis config will be used.

Constructors

ProtocolParamsShelleyBased

Fields

data Nonce Source #

Evolving nonce type.

Instances

Instances details
Eq Nonce
Instance details

Defined in Cardano.Ledger.BaseTypes

Ord Nonce
Instance details

Defined in Cardano.Ledger.BaseTypes

Show Nonce
Instance details

Defined in Cardano.Ledger.BaseTypes

Generic Nonce
Instance details

Defined in Cardano.Ledger.BaseTypes

NFData Nonce
Instance details

Defined in Cardano.Ledger.BaseTypes

ToJSON Nonce
Instance details

Defined in Cardano.Ledger.BaseTypes

FromJSON Nonce
Instance details

Defined in Cardano.Ledger.BaseTypes

ToCBOR Nonce
Instance details

Defined in Cardano.Ledger.BaseTypes

FromCBOR Nonce
Instance details

Defined in Cardano.Ledger.BaseTypes

NoThunks Nonce
Instance details

Defined in Cardano.Ledger.BaseTypes

type Rep Nonce
Instance details

Defined in Cardano.Ledger.BaseTypes

type Rep Nonce = D1 (' MetaData "Nonce" "Cardano.Ledger.BaseTypes" "cardano-ledger-core-0.1.0.0-3EJt5rxsPizAWHDEqGPh9V" ' False ) ( C1 (' MetaCons "Nonce" ' PrefixI ' False ) ( S1 (' MetaSel (' Nothing :: Maybe Symbol ) ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 ( Hash Blake2b_256 Nonce ))) :+: C1 (' MetaCons "NeutralNonce" ' PrefixI ' False ) ( U1 :: Type -> Type ))

data ProtVer Source #

Instances

Instances details
Eq ProtVer
Instance details

Defined in Cardano.Ledger.BaseTypes

Ord ProtVer
Instance details

Defined in Cardano.Ledger.BaseTypes

Show ProtVer
Instance details

Defined in Cardano.Ledger.BaseTypes

Generic ProtVer
Instance details

Defined in Cardano.Ledger.BaseTypes

NFData ProtVer
Instance details

Defined in Cardano.Ledger.BaseTypes

ToJSON ProtVer
Instance details

Defined in Cardano.Ledger.BaseTypes

FromJSON ProtVer
Instance details

Defined in Cardano.Ledger.BaseTypes

ToCBOR ProtVer
Instance details

Defined in Cardano.Ledger.BaseTypes

FromCBOR ProtVer
Instance details

Defined in Cardano.Ledger.BaseTypes

ToCBORGroup ProtVer
Instance details

Defined in Cardano.Ledger.BaseTypes

FromCBORGroup ProtVer
Instance details

Defined in Cardano.Ledger.BaseTypes

NoThunks ProtVer
Instance details

Defined in Cardano.Ledger.BaseTypes

HasField "_protocolVersion" ( RewardSnapShot crypto) ProtVer

RewardSnapShot can act as a Proxy for PParams when only the protocol version is needed.

Instance details

Defined in Cardano.Ledger.Shelley.RewardUpdate

HasField "_protocolVersion" ( FreeVars crypto) ProtVer

FreeVars can act as a Proxy for PParams when only the protocol version is needed.

Instance details

Defined in Cardano.Ledger.Shelley.RewardUpdate

type Rep ProtVer
Instance details

Defined in Cardano.Ledger.BaseTypes

type Rep ProtVer = D1 (' MetaData "ProtVer" "Cardano.Ledger.BaseTypes" "cardano-ledger-core-0.1.0.0-3EJt5rxsPizAWHDEqGPh9V" ' False ) ( C1 (' MetaCons "ProtVer" ' PrefixI ' True ) ( S1 (' MetaSel (' Just "pvMajor") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 Natural ) :*: S1 (' MetaSel (' Just "pvMinor") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 Natural )))

data ShelleyGenesis era Source #

Shelley genesis information

Note that this is needed only for a pure Shelley network, hence it being defined here rather than in its own module. In mainnet, Shelley will transition naturally from Byron, and thus will never have its own genesis information.

Instances

Instances details
Eq ( ShelleyGenesis era)
Instance details

Defined in Cardano.Ledger.Shelley.Genesis

Show ( ShelleyGenesis era)
Instance details

Defined in Cardano.Ledger.Shelley.Genesis

Generic ( ShelleyGenesis era)
Instance details

Defined in Cardano.Ledger.Shelley.Genesis

Associated Types

type Rep ( ShelleyGenesis era) :: Type -> Type Source #

Era era => ToJSON ( ShelleyGenesis era)
Instance details

Defined in Cardano.Ledger.Shelley.Genesis

Era era => FromJSON ( ShelleyGenesis era)
Instance details

Defined in Cardano.Ledger.Shelley.Genesis

Era era => ToCBOR ( ShelleyGenesis era)
Instance details

Defined in Cardano.Ledger.Shelley.Genesis

Era era => FromCBOR ( ShelleyGenesis era)
Instance details

Defined in Cardano.Ledger.Shelley.Genesis

Era era => NoThunks ( ShelleyGenesis era)
Instance details

Defined in Cardano.Ledger.Shelley.Genesis

type Rep ( ShelleyGenesis era)
Instance details

Defined in Cardano.Ledger.Shelley.Genesis

type Rep ( ShelleyGenesis era) = D1 (' MetaData "ShelleyGenesis" "Cardano.Ledger.Shelley.Genesis" "cardano-ledger-shelley-0.1.0.0-4LNBTpyKcsy6EW18a3tTt2" ' False ) ( C1 (' MetaCons "ShelleyGenesis" ' PrefixI ' True ) ((( S1 (' MetaSel (' Just "sgSystemStart") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 UTCTime ) :*: ( S1 (' MetaSel (' Just "sgNetworkMagic") ' NoSourceUnpackedness ' SourceStrict ' DecidedUnpack ) ( Rec0 Word32 ) :*: S1 (' MetaSel (' Just "sgNetworkId") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 Network ))) :*: (( S1 (' MetaSel (' Just "sgActiveSlotsCoeff") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 PositiveUnitInterval ) :*: S1 (' MetaSel (' Just "sgSecurityParam") ' NoSourceUnpackedness ' SourceStrict ' DecidedUnpack ) ( Rec0 Word64 )) :*: ( S1 (' MetaSel (' Just "sgEpochLength") ' NoSourceUnpackedness ' SourceStrict ' DecidedUnpack ) ( Rec0 EpochSize ) :*: S1 (' MetaSel (' Just "sgSlotsPerKESPeriod") ' NoSourceUnpackedness ' SourceStrict ' DecidedUnpack ) ( Rec0 Word64 )))) :*: ((( S1 (' MetaSel (' Just "sgMaxKESEvolutions") ' NoSourceUnpackedness ' SourceStrict ' DecidedUnpack ) ( Rec0 Word64 ) :*: S1 (' MetaSel (' Just "sgSlotLength") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 NominalDiffTime )) :*: ( S1 (' MetaSel (' Just "sgUpdateQuorum") ' NoSourceUnpackedness ' SourceStrict ' DecidedUnpack ) ( Rec0 Word64 ) :*: S1 (' MetaSel (' Just "sgMaxLovelaceSupply") ' NoSourceUnpackedness ' SourceStrict ' DecidedUnpack ) ( Rec0 Word64 ))) :*: (( S1 (' MetaSel (' Just "sgProtocolParams") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 ( PParams era)) :*: S1 (' MetaSel (' Just "sgGenDelegs") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 ( Map ( KeyHash ' Genesis ( Crypto era)) ( GenDelegPair ( Crypto era))))) :*: ( S1 (' MetaSel (' Just "sgInitialFunds") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 ( Map ( Addr ( Crypto era)) Coin )) :*: S1 (' MetaSel (' Just "sgStaking") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 ( ShelleyGenesisStaking ( Crypto era))))))))
type TranslationError ( AlonzoEra c) ShelleyGenesis
Instance details

Defined in Cardano.Ledger.Alonzo.Translation

type TranslationError ( BabbageEra c) ShelleyGenesis
Instance details

Defined in Cardano.Ledger.Babbage.Translation

type TranslationError ( AllegraEra c) ShelleyGenesis
Instance details

Defined in Cardano.Ledger.Allegra.Translation

type TranslationError ( MaryEra c) ShelleyGenesis
Instance details

Defined in Cardano.Ledger.Mary.Translation

data ShelleyGenesisStaking crypto Source #

Genesis Shelley staking configuration.

This allows us to configure some initial stake pools and delegation to them, in order to test Praos in a static configuration, without requiring on-chain registration and delegation.

For simplicity, pools defined in the genesis staking do not pay deposits for their registration.

Constructors

ShelleyGenesisStaking

Fields

  • sgsPools :: !( Map ( KeyHash ' StakePool crypto) ( PoolParams crypto))

    Pools to register

    The key in this map is the hash of the public key of the _pool_. This need not correspond to any payment or staking key, but must correspond to the cold key held by TPraosIsCoreNode .

  • sgsStake :: !( Map ( KeyHash ' Staking crypto) ( KeyHash ' StakePool crypto))

    Stake-holding key hash credentials and the pools to delegate that stake to. We require the raw staking key hash in order to:

    • Avoid pointer addresses, which would be tricky when there's no slot or transaction to point to.
    • Avoid script credentials.

Instances

Instances details
Eq ( ShelleyGenesisStaking crypto)
Instance details

Defined in Cardano.Ledger.Shelley.Genesis

Show ( ShelleyGenesisStaking crypto)
Instance details

Defined in Cardano.Ledger.Shelley.Genesis

Generic ( ShelleyGenesisStaking crypto)
Instance details

Defined in Cardano.Ledger.Shelley.Genesis

Crypto crypto => ToJSON ( ShelleyGenesisStaking crypto)
Instance details

Defined in Cardano.Ledger.Shelley.Genesis

Crypto crypto => FromJSON ( ShelleyGenesisStaking crypto)
Instance details

Defined in Cardano.Ledger.Shelley.Genesis

Crypto crypto => ToCBOR ( ShelleyGenesisStaking crypto)
Instance details

Defined in Cardano.Ledger.Shelley.Genesis

Crypto crypto => FromCBOR ( ShelleyGenesisStaking crypto)
Instance details

Defined in Cardano.Ledger.Shelley.Genesis

NoThunks ( ShelleyGenesisStaking crypto)
Instance details

Defined in Cardano.Ledger.Shelley.Genesis

type Rep ( ShelleyGenesisStaking crypto)
Instance details

Defined in Cardano.Ledger.Shelley.Genesis

type Rep ( ShelleyGenesisStaking crypto) = D1 (' MetaData "ShelleyGenesisStaking" "Cardano.Ledger.Shelley.Genesis" "cardano-ledger-shelley-0.1.0.0-4LNBTpyKcsy6EW18a3tTt2" ' False ) ( C1 (' MetaCons "ShelleyGenesisStaking" ' PrefixI ' True ) ( S1 (' MetaSel (' Just "sgsPools") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 ( Map ( KeyHash ' StakePool crypto) ( PoolParams crypto))) :*: S1 (' MetaSel (' Just "sgsStake") ' NoSourceUnpackedness ' SourceStrict ' DecidedStrict ) ( Rec0 ( Map ( KeyHash ' Staking crypto) ( KeyHash ' StakePool crypto)))))

data ShelleyLeaderCredentials c Source #

Constructors

ShelleyLeaderCredentials

Fields

registerGenesisStaking :: forall era. ShelleyBasedEra era => ShelleyGenesisStaking ( EraCrypto era) -> NewEpochState era -> NewEpochState era Source #

Register the initial staking information in the NewEpochState .

HERE BE DRAGONS! This function is intended to help in testing.

In production, the genesis should not contain any initial staking.

Any existing staking information is overridden, but the UTxO is left untouched.

TODO adapt and reuse registerGenesisStaking from cardano-ledger-specs .

registerInitialFunds :: forall era. ( ShelleyBasedEra era, HasCallStack ) => Map ( Addr ( EraCrypto era)) Coin -> NewEpochState era -> NewEpochState era Source #

Register the initial funds in the NewEpochState .

HERE BE DRAGONS! This function is intended to help in testing.

In production, the genesis should not contain any initial funds.

The given funds are added to the existing UTxO.

PRECONDITION: the given funds must not be part of the existing UTxO. > forall (addr, _) in initialFunds. > Map.notElem (SL.initialFundsPseudoTxIn addr) existingUTxO

PROPERTY: > genesisUTxO genesis > == genesisUTxO' (sgInitialFunds genesis) > == extractUTxO (registerInitialFunds (sgInitialFunds genesis) > NewEpochState )

TODO move to cardano-ledger-specs .

shelleyBlockForging :: forall m era c. ( ShelleyCompatible ( TPraos c) era, PraosCrypto c, c ~ EraCrypto era, TxLimits ( ShelleyBlock ( TPraos c) era), IOLike m) => TPraosParams -> Overrides ( ShelleyBlock ( TPraos c) era) -> ShelleyLeaderCredentials ( EraCrypto era) -> m ( BlockForging m ( ShelleyBlock ( TPraos c) era)) Source #

Create a BlockForging record for a single era.

In case the same credentials should be shared across multiple Shelley-based eras, use shelleySharedBlockForging .

shelleySharedBlockForging :: forall m c era. ( PraosCrypto c, ShelleyEraWithCrypto c ( TPraos c) era, IOLike m) => HotKey c m -> ( SlotNo -> KESPeriod ) -> ShelleyLeaderCredentials c -> Overrides ( ShelleyBlock ( TPraos c) era) -> BlockForging m ( ShelleyBlock ( TPraos c) era) Source #

Create a BlockForging record safely using a given Hotkey .

The name of the era (separated by a _ ) will be appended to each forgeLabel .

validateGenesis :: ShelleyBasedEra era => ShelleyGenesis era -> Either String () Source #

Check the validity of the genesis config. To be used in conjunction with assertWithMsg .