Safe Haskell | None |
---|---|
Language | Haskell2010 |
Ouroboros.Consensus.Shelley.Node.TPraos
Synopsis
- newtype MaxMajorProtVer = MaxMajorProtVer {
- getMaxMajorProtVer ∷ Version
- data ProtocolParamsAllegra c = ProtocolParamsAllegra {}
- data ProtocolParamsAlonzo c = ProtocolParamsAlonzo {}
- data ProtocolParamsMary c = ProtocolParamsMary {}
- data ProtocolParamsShelley c = ProtocolParamsShelley {}
- data ProtocolParamsShelleyBased era = ProtocolParamsShelleyBased {}
- data Nonce
- = Nonce !(Hash Blake2b_256 Nonce)
- | NeutralNonce
- data ProtVer = ProtVer {}
- data ShelleyGenesis c = ShelleyGenesis {
- sgSystemStart ∷ !UTCTime
- sgNetworkMagic ∷ !Word32
- sgNetworkId ∷ !Network
- sgActiveSlotsCoeff ∷ !PositiveUnitInterval
- sgSecurityParam ∷ !Word64
- sgEpochLength ∷ !EpochSize
- sgSlotsPerKESPeriod ∷ !Word64
- sgMaxKESEvolutions ∷ !Word64
- sgSlotLength ∷ !NominalDiffTimeMicro
- sgUpdateQuorum ∷ !Word64
- sgMaxLovelaceSupply ∷ !Word64
- sgProtocolParams ∷ !(PParams (ShelleyEra c))
- sgGenDelegs ∷ !(Map (KeyHash 'Genesis c) (GenDelegPair c))
- sgInitialFunds ∷ ListMap (Addr c) Coin
- sgStaking ∷ ShelleyGenesisStaking c
- data ShelleyGenesisStaking c = ShelleyGenesisStaking {}
- emptyGenesisStaking ∷ ShelleyGenesisStaking c
- data ShelleyLeaderCredentials c = ShelleyLeaderCredentials {}
- protocolInfoShelley ∷ ∀ m c. (IOLike m, PraosCrypto c, ShelleyCompatible (TPraos c) (ShelleyEra c), TxLimits (ShelleyBlock (TPraos c) (ShelleyEra c))) ⇒ ProtocolParamsShelleyBased (ShelleyEra c) → ProtocolParamsShelley c → ProtocolInfo m (ShelleyBlock (TPraos c) (ShelleyEra c))
- protocolInfoTPraosShelleyBased ∷ ∀ m era c. (IOLike m, PraosCrypto c, ShelleyCompatible (TPraos c) era, TxLimits (ShelleyBlock (TPraos c) era), c ~ EraCrypto era) ⇒ ProtocolParamsShelleyBased era → (AdditionalGenesisConfig era, TranslationContext era) → ProtVer → TxOverrides (ShelleyBlock (TPraos c) era) → ProtocolInfo m (ShelleyBlock (TPraos c) era)
- registerGenesisStaking ∷ ∀ era. ShelleyBasedEra era ⇒ ShelleyGenesisStaking (EraCrypto era) → NewEpochState era → NewEpochState era
- registerInitialFunds ∷ ∀ era. (ShelleyBasedEra era, HasCallStack) ⇒ Map (Addr (EraCrypto era)) Coin → NewEpochState era → NewEpochState era
- shelleyBlockForging ∷ ∀ m era c. (ShelleyCompatible (TPraos c) era, PraosCrypto c, c ~ EraCrypto era, TxLimits (ShelleyBlock (TPraos c) era), IOLike m) ⇒ TPraosParams → TxOverrides (ShelleyBlock (TPraos c) era) → ShelleyLeaderCredentials (EraCrypto era) → m (BlockForging m (ShelleyBlock (TPraos c) era))
- shelleySharedBlockForging ∷ ∀ m c era. (PraosCrypto c, ShelleyEraWithCrypto c (TPraos c) era, IOLike m) ⇒ HotKey c m → (SlotNo → KESPeriod) → ShelleyLeaderCredentials c → TxOverrides (ShelleyBlock (TPraos c) era) → BlockForging m (ShelleyBlock (TPraos c) era)
- validateGenesis ∷ PraosCrypto c ⇒ ShelleyGenesis c → Either String ()
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.
Constructors
MaxMajorProtVer | |
Fields
|
Instances
Eq MaxMajorProtVer | |
Defined in Ouroboros.Consensus.Protocol.Praos.Common Methods | |
Show MaxMajorProtVer | |
Defined in Ouroboros.Consensus.Protocol.Praos.Common | |
Generic MaxMajorProtVer | |
Defined in Ouroboros.Consensus.Protocol.Praos.Common Methods from ∷ MaxMajorProtVer → Rep MaxMajorProtVer x Source # to ∷ Rep MaxMajorProtVer x → MaxMajorProtVer Source # | |
NoThunks MaxMajorProtVer | |
Defined in Ouroboros.Consensus.Protocol.Praos.Common Methods noThunks ∷ Context → MaxMajorProtVer → IO (Maybe ThunkInfo) # wNoThunks ∷ Context → MaxMajorProtVer → IO (Maybe ThunkInfo) # | |
type Rep MaxMajorProtVer | |
Defined in Ouroboros.Consensus.Protocol.Praos.Common type Rep MaxMajorProtVer = D1 ('MetaData "MaxMajorProtVer" "Ouroboros.Consensus.Protocol.Praos.Common" "ouroboros-consensus-protocol-0.3.1.0-inplace" 'True) (C1 ('MetaCons "MaxMajorProtVer" 'PrefixI 'True) (S1 ('MetaSel ('Just "getMaxMajorProtVer") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Version))) |
data ProtocolParamsAllegra c Source #
Parameters needed to run Allegra
Constructors
ProtocolParamsAllegra | |
Fields |
data ProtocolParamsAlonzo c Source #
Parameters needed to run Alonzo
Constructors
ProtocolParamsAlonzo | |
Fields |
data ProtocolParamsMary c Source #
Parameters needed to run Mary
Constructors
ProtocolParamsMary | |
Fields
|
data ProtocolParamsShelley c Source #
Parameters needed to run Shelley
Constructors
ProtocolParamsShelley | |
Fields |
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
|
Constructors
Nonce !(Hash Blake2b_256 Nonce) | |
NeutralNonce |
Instances
Eq Nonce | |
Ord Nonce | |
Defined in Cardano.Ledger.BaseTypes | |
Show Nonce | |
Generic Nonce | |
NFData Nonce | |
Defined in Cardano.Ledger.BaseTypes | |
NoThunks Nonce | |
ToCBOR Nonce | |
Defined in Cardano.Ledger.BaseTypes Methods encodedSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy Nonce → Size encodedListSizeExpr ∷ (∀ t. ToCBOR t ⇒ Proxy t → Size) → Proxy [Nonce] → Size | |
DecCBOR Nonce | |
EncCBOR Nonce | |
Defined in Cardano.Ledger.BaseTypes Methods encodedSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy Nonce → Size encodedListSizeExpr ∷ (∀ t. EncCBOR t ⇒ Proxy t → Size) → Proxy [Nonce] → Size | |
FromCBOR Nonce | |
FromJSON Nonce | |
Defined in Cardano.Ledger.BaseTypes | |
ToExpr Nonce | |
Defined in Cardano.Ledger.BaseTypes | |
ToJSON Nonce | |
Defined in Cardano.Ledger.BaseTypes | |
type Rep Nonce | |
Defined in Cardano.Ledger.BaseTypes type Rep Nonce = D1 ('MetaData "Nonce" "Cardano.Ledger.BaseTypes" "cardano-ledger-core-1.0.0.0-bd78daa4b267dd5077191bcdf8063ce0cc95e53fc5e214cefb9a40c991fa58a9" '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)) |
Instances
data ShelleyGenesis c #
Constructors
ShelleyGenesis | |
Fields
|
Instances
data ShelleyGenesisStaking c #
Constructors
ShelleyGenesisStaking | |
Instances
data ShelleyLeaderCredentials c Source #
Constructors
ShelleyLeaderCredentials | |
Fields
|
protocolInfoShelley ∷ ∀ m c. (IOLike m, PraosCrypto c, ShelleyCompatible (TPraos c) (ShelleyEra c), TxLimits (ShelleyBlock (TPraos c) (ShelleyEra c))) ⇒ ProtocolParamsShelleyBased (ShelleyEra c) → ProtocolParamsShelley c → ProtocolInfo m (ShelleyBlock (TPraos c) (ShelleyEra c)) Source #
protocolInfoTPraosShelleyBased ∷ ∀ m era c. (IOLike m, PraosCrypto c, ShelleyCompatible (TPraos c) era, TxLimits (ShelleyBlock (TPraos c) era), c ~ EraCrypto era) ⇒ ProtocolParamsShelleyBased era → (AdditionalGenesisConfig era, TranslationContext era) → ProtVer → TxOverrides (ShelleyBlock (TPraos c) era) → ProtocolInfo m (ShelleyBlock (TPraos c) era) Source #
registerGenesisStaking ∷ ∀ 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
.
registerInitialFunds ∷ ∀ 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 ∷ ∀ m era c. (ShelleyCompatible (TPraos c) era, PraosCrypto c, c ~ EraCrypto era, TxLimits (ShelleyBlock (TPraos c) era), IOLike m) ⇒ TPraosParams → TxOverrides (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 ∷ ∀ m c era. (PraosCrypto c, ShelleyEraWithCrypto c (TPraos c) era, IOLike m) ⇒ HotKey c m → (SlotNo → KESPeriod) → ShelleyLeaderCredentials c → TxOverrides (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 ∷ PraosCrypto c ⇒ ShelleyGenesis c → Either String () Source #
Check the validity of the genesis config. To be used in conjunction with
assertWithMsg
.