| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Cardano.Api.LedgerState
Synopsis
- envSecurityParam :: Env -> Word64
- data LedgerState where
- LedgerState {
- clsState :: CardanoLedgerState StandardCrypto EmptyMK
- clsTables :: LedgerTables (HardForkBlock (CardanoEras StandardCrypto)) ValuesMK
- pattern LedgerStateByron :: LedgerState ByronBlock EmptyMK -> LedgerState
- pattern LedgerStateShelley :: LedgerState StandardShelleyBlock EmptyMK -> LedgerState
- pattern LedgerStateAllegra :: LedgerState StandardAllegraBlock EmptyMK -> LedgerState
- pattern LedgerStateMary :: LedgerState StandardMaryBlock EmptyMK -> LedgerState
- pattern LedgerStateAlonzo :: LedgerState StandardAlonzoBlock EmptyMK -> LedgerState
- pattern LedgerStateBabbage :: LedgerState StandardBabbageBlock EmptyMK -> LedgerState
- pattern LedgerStateConway :: LedgerState StandardConwayBlock EmptyMK -> LedgerState
- LedgerState {
- encodeLedgerState :: LedgerState -> Encoding
- decodeLedgerState :: Decoder s LedgerState
- initialLedgerState :: forall t (m :: Type -> Type). MonadIOTransError InitialLedgerStateError t m => SomeHasFS IO -> NodeConfigFile 'In -> t m (Env, LedgerState)
- applyBlock :: Env -> LedgerState -> ValidationMode -> BlockInMode -> Either LedgerStateError (LedgerState, [LedgerEvent])
- data ValidationMode
- applyBlockWithEvents :: Env -> LedgerState -> Bool -> CardanoBlock StandardCrypto -> Either LedgerStateError LedgerStateEvents
- data AnyNewEpochState where
- AnyNewEpochState :: forall era. ShelleyBasedEra era -> NewEpochState (ShelleyLedgerEra era) -> LedgerTables (CardanoBlock StandardCrypto) ValuesMK -> AnyNewEpochState
- getAnyNewEpochState :: ShelleyBasedEra era -> LedgerState -> Either LedgerStateError AnyNewEpochState
- getLedgerTablesUTxOValues :: ShelleyBasedEra era -> LedgerTables (CardanoBlock StandardCrypto) ValuesMK -> Map TxIn (TxOut CtxUTxO era)
- foldBlocks :: forall a t (m :: Type -> Type). (HasCallStack, Show a, MonadIOTransError FoldBlocksError t m) => SomeHasFS IO -> NodeConfigFile 'In -> SocketPath -> ValidationMode -> a -> (Env -> LedgerState -> [LedgerEvent] -> BlockInMode -> a -> IO (a, FoldStatus)) -> t m a
- data FoldStatus
- chainSyncClientWithLedgerState :: forall (m :: Type -> Type) a. (HasCallStack, Monad m) => Env -> LedgerState -> ValidationMode -> ChainSyncClient (BlockInMode, Either LedgerStateError (LedgerState, [LedgerEvent])) ChainPoint ChainTip m a -> ChainSyncClient BlockInMode ChainPoint ChainTip m a
- chainSyncClientPipelinedWithLedgerState :: forall (m :: Type -> Type) a. (HasCallStack, Monad m) => Env -> LedgerState -> ValidationMode -> ChainSyncClientPipelined (BlockInMode, Either LedgerStateError (LedgerState, [LedgerEvent])) ChainPoint ChainTip m a -> ChainSyncClientPipelined BlockInMode ChainPoint ChainTip m a
- data ConditionResult
- fromConditionResult :: ConditionResult -> Bool
- toConditionResult :: Bool -> ConditionResult
- foldEpochState :: forall t (m :: Type -> Type) s. (HasCallStack, MonadIOTransError FoldBlocksError t m) => SomeHasFS IO -> NodeConfigFile 'In -> SocketPath -> ValidationMode -> EpochNo -> s -> (AnyNewEpochState -> SlotNo -> BlockNo -> StateT s IO ConditionResult) -> t m (ConditionResult, s)
- data LedgerEvent
- = PoolRegistration
- | PoolReRegistration
- | IncrementalRewardsDistribution EpochNo (Map StakeCredential (Set Reward))
- | RewardsDistribution EpochNo (Map StakeCredential (Set Reward))
- | MIRDistribution MIRDistributionDetails
- | PoolReap PoolReapDetails
- | SuccessfulPlutusScript (NonEmpty PlutusWithContext)
- | FailedPlutusScript (NonEmpty PlutusWithContext)
- | NewGovernanceProposals TxId AnyProposals
- | RemovedGovernanceVotes TxId (Set (Voter, GovActionId)) (Set (Credential 'DRepRole))
- | EpochBoundaryRatificationState AnyRatificationState
- data AnyProposals = EraPParams era => AnyProposals (Proposals era)
- data AnyRatificationState = EraPParams era => AnyRatificationState (RatifyState era)
- data MIRDistributionDetails = MIRDistributionDetails {}
- data PoolReapDetails = PoolReapDetails {}
- convertRetiredPoolsMap :: Map (Credential 'Staking) (Map (KeyHash 'StakePool) (CompactForm Coin)) -> Map StakeCredential (Map (Hash StakePoolKey) Coin)
- data LedgerStateError
- = ApplyBlockHashMismatch Text
- | ApplyBlockError (CardanoLedgerError StandardCrypto)
- | InvalidRollback SlotNo ChainPoint
- | TerminationEpochReached EpochNo
- | UnexpectedLedgerState AnyShelleyBasedEra (NS (Current (Flip LedgerState EmptyMK)) (CardanoEras StandardCrypto))
- | ByronEraUnsupported
- | DebugError !String
- data FoldBlocksError
- data GenesisConfigError
- data InitialLedgerStateError
- data LeadershipError
- = LeaderErrDecodeLedgerStateFailure
- | LeaderErrDecodeProtocolStateFailure (ByteString, DecoderError)
- | LeaderErrDecodeProtocolEpochStateFailure DecoderError
- | LeaderErrDecodePoolDistributionFailure DecoderError
- | LeaderErrGenesisSlot
- | LeaderErrStakePoolHasNoStake PoolId
- | LeaderErrStakeDistribUnstable SlotNo SlotNo SlotNo SlotNo
- | LeaderErrSlotRangeCalculationFailure Text
- | LeaderErrCandidateNonceStillEvolving
- constructGlobals :: ShelleyGenesis -> EpochInfo (Either Text) -> Globals
- currentEpochEligibleLeadershipSlots :: ShelleyBasedEra era -> ShelleyGenesis -> EpochInfo (Either Text) -> PParams (ShelleyLedgerEra era) -> ProtocolState era -> PoolId -> SigningKey VrfKey -> Serialised (PoolDistribution era) -> EpochNo -> Either LeadershipError (Set SlotNo)
- nextEpochEligibleLeadershipSlots :: ShelleyBasedEra era -> ShelleyGenesis -> SerialisedCurrentEpochState era -> ProtocolState era -> PoolId -> SigningKey VrfKey -> PParams (ShelleyLedgerEra era) -> EpochInfo (Either Text) -> (ChainTip, EpochNo) -> Either LeadershipError (Set SlotNo)
- data NodeConfig = NodeConfig {
- ncPBftSignatureThreshold :: !(Maybe Double)
- ncByronGenesisFile :: !(File ByronGenesisConfig 'In)
- ncByronGenesisHash :: !(Maybe GenesisHashByron)
- ncShelleyGenesisFile :: !(File ShelleyGenesisConfig 'In)
- ncShelleyGenesisHash :: !(Maybe GenesisHashShelley)
- ncAlonzoGenesisFile :: !(File AlonzoGenesis 'In)
- ncAlonzoGenesisHash :: !(Maybe GenesisHashAlonzo)
- ncConwayGenesisFile :: !(File ConwayGenesisConfig 'In)
- ncConwayGenesisHash :: !(Maybe GenesisHashConway)
- ncRequiresNetworkMagic :: !RequiresNetworkMagic
- ncByronProtocolVersion :: !ProtocolVersion
- ncHardForkTriggers :: !CardanoHardForkTriggers
- type NodeConfigFile = File NodeConfig
- readNodeConfig :: (MonadError Text m, MonadIO m) => NodeConfigFile 'In -> m NodeConfig
- data GenesisConfig = GenesisCardano !NodeConfig !Config !GenesisHashShelley !(TransitionConfig LatestKnownEra)
- readCardanoGenesisConfig :: forall t (m :: Type -> Type). MonadIOTransError GenesisConfigError t m => NodeConfig -> t m GenesisConfig
- mkProtocolInfoCardano :: SomeHasFS IO -> GenesisConfig -> IO (ProtocolInfo (CardanoBlock StandardCrypto), Tracer IO KESAgentClientTrace -> IO [MkBlockForging IO (CardanoBlock StandardCrypto)])
- resolveShelleyInitialFunds :: (MonadST m, MonadThrow m) => SomeHasFS m -> ShelleyGenesis -> m ShelleyGenesis
- readByronGenesisConfig :: forall t (m :: Type -> Type). MonadIOTransError GenesisConfigError t m => NodeConfig -> t m Config
- data ShelleyConfig = ShelleyConfig {}
- newtype GenesisHashShelley = GenesisHashShelley {}
- readShelleyGenesisConfig :: forall t (m :: Type -> Type). MonadIOTransError GenesisConfigError t m => NodeConfig -> t m ShelleyConfig
- readShelleyGenesis :: forall (m :: Type -> Type) t. MonadIOTransError ShelleyGenesisError t m => ShelleyGenesisFile 'In -> Maybe GenesisHashShelley -> t m ShelleyConfig
- data ShelleyGenesisError
- renderShelleyGenesisError :: ShelleyGenesisError -> Text
- shelleyPraosNonce :: GenesisHashShelley -> Nonce
- newtype GenesisHashAlonzo = GenesisHashAlonzo {}
- readAlonzoGenesisConfig :: forall t (m :: Type -> Type). MonadIOTransError GenesisConfigError t m => NodeConfig -> t m AlonzoGenesis
- newtype GenesisHashConway = GenesisHashConway {}
- readConwayGenesisConfig :: forall t (m :: Type -> Type). MonadIOTransError GenesisConfigError t m => NodeConfig -> t m ConwayGenesis
- data Env = Env {
- envLedgerConfig :: CardanoLedgerConfig StandardCrypto
- envConsensusConfig :: CardanoConsensusConfig StandardCrypto
- genesisConfigToEnv :: SomeHasFS IO -> GenesisConfig -> IO (Either GenesisConfigError Env)
Initialization / Accumulation
envSecurityParam :: Env -> Word64 Source #
data LedgerState Source #
Constructors
| LedgerState | |
Fields
| |
Bundled Patterns
| pattern LedgerStateByron :: LedgerState ByronBlock EmptyMK -> LedgerState | Deprecated: Use 'LedgerState $ Consensus.LedgerStateByron' instead |
| pattern LedgerStateShelley :: LedgerState StandardShelleyBlock EmptyMK -> LedgerState | Deprecated: Use 'LedgerState $ Consensus.LedgerStateShelley' instead |
| pattern LedgerStateAllegra :: LedgerState StandardAllegraBlock EmptyMK -> LedgerState | Deprecated: Use 'LedgerState $ Consensus.LedgerStateAllegra' instead |
| pattern LedgerStateMary :: LedgerState StandardMaryBlock EmptyMK -> LedgerState | Deprecated: Use 'LedgerState $ Consensus.LedgerStateMary' instead |
| pattern LedgerStateAlonzo :: LedgerState StandardAlonzoBlock EmptyMK -> LedgerState | Deprecated: Use 'LedgerState $ Consensus.LedgerAlonzo' instead |
| pattern LedgerStateBabbage :: LedgerState StandardBabbageBlock EmptyMK -> LedgerState | Deprecated: Use 'LedgerState $ Consensus.LedgerBabbage' instead |
| pattern LedgerStateConway :: LedgerState StandardConwayBlock EmptyMK -> LedgerState | Deprecated: Use 'LedgerState $ Consensus.LedgerConway' instead |
Instances
| Show LedgerState Source # | |
Defined in Cardano.Api.LedgerState | |
Arguments
| :: forall t (m :: Type -> Type). MonadIOTransError InitialLedgerStateError t m | |
| => SomeHasFS IO | Filesystem capability used by Ledger for testing/benchmarking, to stream Shelley/Conway genesis data from the extraConfig. |
| -> NodeConfigFile 'In | Path to the cardano-node config file (e.g. to cardano-node projectconfigurationcardano/mainnet-config.json) |
| -> t m (Env, LedgerState) | The environment and initial ledger state |
Get the environment and initial ledger state.
Arguments
| :: Env | The environment returned by |
| -> LedgerState | The current ledger state |
| -> ValidationMode | |
| -> BlockInMode | Some block to apply |
| -> Either LedgerStateError (LedgerState, [LedgerEvent]) | The new ledger state (or an error). |
Apply a single block to the current ledger state.
data ValidationMode Source #
How to do validation when applying a block to a ledger state.
Constructors
| FullValidation | Do all validation implied by the ledger layer's |
| QuickValidation | Only check that the previous hash from the block matches the head hash of the ledger state. |
Arguments
| :: Env | |
| -> LedgerState | |
| -> Bool | True to validate |
| -> CardanoBlock StandardCrypto | |
| -> Either LedgerStateError LedgerStateEvents |
data AnyNewEpochState where Source #
Constructors
| AnyNewEpochState :: forall era. ShelleyBasedEra era -> NewEpochState (ShelleyLedgerEra era) -> LedgerTables (CardanoBlock StandardCrypto) ValuesMK -> AnyNewEpochState |
Instances
| Show AnyNewEpochState Source # | |
Defined in Cardano.Api.LedgerState | |
getAnyNewEpochState :: ShelleyBasedEra era -> LedgerState -> Either LedgerStateError AnyNewEpochState Source #
Retrieve new epoch state from the ledger state, or an error on failure
getLedgerTablesUTxOValues :: ShelleyBasedEra era -> LedgerTables (CardanoBlock StandardCrypto) ValuesMK -> Map TxIn (TxOut CtxUTxO era) Source #
Traversing the block chain
Arguments
| :: forall a t (m :: Type -> Type). (HasCallStack, Show a, MonadIOTransError FoldBlocksError t m) | |
| => SomeHasFS IO | Filesystem capability used by Ledger for testing/benchmarking, to stream Shelley/Conway genesis data from the extraConfig. |
| -> NodeConfigFile 'In | Path to the cardano-node config file (e.g. to cardano-node projectconfigurationcardano/mainnet-config.json) |
| -> SocketPath | Path to local cardano-node socket. This is the path specified by the |
| -> ValidationMode | |
| -> a | The initial accumulator state. |
| -> (Env -> LedgerState -> [LedgerEvent] -> BlockInMode -> a -> IO (a, FoldStatus)) | Accumulator function Takes:
And returns:
Note: This function can safely assume no rollback will occur even though internally this is implemented with a client protocol that may require rollback. This is achieved by only calling the accumulator on states/blocks that are older than the security parameter, k. This has the side effect of truncating the last k blocks before the node's tip. |
| -> t m a | The final state |
Monadic fold over all blocks and ledger states. Stopping k blocks before
the node's tip where k is the security parameter.
data FoldStatus Source #
Type that lets us decide whether to continue or stop the fold from within our accumulation function.
Constructors
| ContinueFold | |
| StopFold | |
| DebugFold |
Instances
| Eq FoldStatus Source # | |
Defined in Cardano.Api.LedgerState Methods (==) :: FoldStatus -> FoldStatus -> Bool Source # (/=) :: FoldStatus -> FoldStatus -> Bool Source # | |
| Show FoldStatus Source # | |
Defined in Cardano.Api.LedgerState | |
chainSyncClientWithLedgerState Source #
Arguments
| :: forall (m :: Type -> Type) a. (HasCallStack, Monad m) | |
| => Env | |
| -> LedgerState | Initial ledger state |
| -> ValidationMode | |
| -> ChainSyncClient (BlockInMode, Either LedgerStateError (LedgerState, [LedgerEvent])) ChainPoint ChainTip m a | A client to wrap. The block is annotated with a 'Either LedgerStateError
LedgerState'. This is either an error from validating a block or
the current |
| -> ChainSyncClient BlockInMode ChainPoint ChainTip m a | A client that acts just like the wrapped client but doesn't require the
|
Wrap a ChainSyncClient with logic that tracks the ledger state.
chainSyncClientPipelinedWithLedgerState :: forall (m :: Type -> Type) a. (HasCallStack, Monad m) => Env -> LedgerState -> ValidationMode -> ChainSyncClientPipelined (BlockInMode, Either LedgerStateError (LedgerState, [LedgerEvent])) ChainPoint ChainTip m a -> ChainSyncClientPipelined BlockInMode ChainPoint ChainTip m a Source #
Ledger state conditions
data ConditionResult Source #
Type isomorphic to bool, representing condition check result
Constructors
| ConditionNotMet | |
| ConditionMet |
Instances
Arguments
| :: forall t (m :: Type -> Type) s. (HasCallStack, MonadIOTransError FoldBlocksError t m) | |
| => SomeHasFS IO | Filesystem capability used by Ledger for testing/benchmarking, to stream Shelley/Conway genesis data from the extraConfig. |
| -> NodeConfigFile 'In | Path to the cardano-node config file (e.g. to cardano-node projectconfigurationcardano/mainnet-config.json) |
| -> SocketPath | Path to local cardano-node socket. This is the path specified by the |
| -> ValidationMode | |
| -> EpochNo | Termination epoch |
| -> s | an initial value for the condition state |
| -> (AnyNewEpochState -> SlotNo -> BlockNo -> StateT s IO ConditionResult) | Condition you want to check against the new epoch state.
Note: This function can safely assume no rollback will occur even though internally this is implemented with a client protocol that may require rollback. This is achieved by only calling the accumulator on states/blocks that are older than the security parameter, k. This has the side effect of truncating the last k blocks before the node's tip. |
| -> t m (ConditionResult, s) | The final state |
Reconstructs the ledger's new epoch state and applies a supplied condition to it for every block. This function only terminates if the condition is met or we have reached the termination epoch. We need to provide a termination epoch otherwise blocks would be applied indefinitely.
Ledger events
data LedgerEvent Source #
Constructors
| PoolRegistration | The given pool is being registered for the first time on chain. |
| PoolReRegistration | The given pool already exists and is being re-registered. |
| IncrementalRewardsDistribution EpochNo (Map StakeCredential (Set Reward)) | Incremental rewards are being computed. |
| RewardsDistribution EpochNo (Map StakeCredential (Set Reward)) | Reward distribution has completed. |
| MIRDistribution MIRDistributionDetails | MIR are being distributed. |
| PoolReap PoolReapDetails | Pools have been reaped and deposits refunded. |
| SuccessfulPlutusScript (NonEmpty PlutusWithContext) | A number of succeeded Plutus script evaluations. |
| FailedPlutusScript (NonEmpty PlutusWithContext) | A number of failed Plutus script evaluations. |
| NewGovernanceProposals TxId AnyProposals | Newly submittted governance proposals in a single transaction. |
| RemovedGovernanceVotes | Governance votes that were invalidated. |
Fields
| |
| EpochBoundaryRatificationState AnyRatificationState | The current state of governance matters at the epoch boundary. I.E the current constitution, committee, protocol parameters, etc. |
Instances
data AnyProposals Source #
Constructors
| EraPParams era => AnyProposals (Proposals era) |
Instances
data AnyRatificationState Source #
Constructors
| EraPParams era => AnyRatificationState (RatifyState era) |
Instances
data MIRDistributionDetails Source #
Details of fund transfers due to MIR certificates.
Note that the transfers from reserves to treasury and treasury to reserves are inverse; a transfer of 100 ADA in either direction will result in a net movement of 0, but we include both directions for assistance in debugging.
Constructors
| MIRDistributionDetails | |
Instances
data PoolReapDetails Source #
Constructors
| PoolReapDetails | |
Fields
| |
Instances
convertRetiredPoolsMap :: Map (Credential 'Staking) (Map (KeyHash 'StakePool) (CompactForm Coin)) -> Map StakeCredential (Map (Hash StakePoolKey) Coin) Source #
Errors
data LedgerStateError Source #
Constructors
| ApplyBlockHashMismatch Text | When using QuickValidation, the block hash did not match the expected block hash after applying a new block to the current ledger state. |
| ApplyBlockError (CardanoLedgerError StandardCrypto) | When using FullValidation, an error occurred when applying a new block to the current ledger state. |
| InvalidRollback | Encountered a rollback larger than the security parameter. |
Fields
| |
| TerminationEpochReached EpochNo | The ledger state condition you were interested in was not met prior to the termination epoch. |
| UnexpectedLedgerState | |
Fields
| |
| ByronEraUnsupported | |
| DebugError !String | |
Instances
| Error LedgerStateError Source # | |
Defined in Cardano.Api.LedgerState Methods prettyError :: LedgerStateError -> Doc ann Source # | |
| Exception LedgerStateError Source # | |
Defined in Cardano.Api.LedgerState Methods toException :: LedgerStateError -> SomeException Source # fromException :: SomeException -> Maybe LedgerStateError Source # | |
| Show LedgerStateError Source # | |
Defined in Cardano.Api.LedgerState | |
data FoldBlocksError Source #
Constructors
| FoldBlocksInitialLedgerStateError !InitialLedgerStateError | |
| FoldBlocksApplyBlockError !LedgerStateError | |
| FoldBlocksIOException !IOException | |
| FoldBlocksMuxError !Error |
Instances
| Error FoldBlocksError Source # | |
Defined in Cardano.Api.LedgerState Methods prettyError :: FoldBlocksError -> Doc ann Source # | |
| Show FoldBlocksError Source # | |
Defined in Cardano.Api.LedgerState | |
data GenesisConfigError Source #
Constructors
| NEError !Text | |
| NEByronConfig !FilePath !ConfigurationError | |
| NEShelleyConfig !FilePath !Text | |
| NEAlonzoConfig !FilePath !Text | |
| NEConwayConfig !FilePath !Text | |
| NECardanoConfig !Text |
Instances
| Error GenesisConfigError Source # | |
Defined in Cardano.Api.LedgerState Methods prettyError :: GenesisConfigError -> Doc ann Source # | |
| Exception GenesisConfigError Source # | |
Defined in Cardano.Api.LedgerState | |
| Show GenesisConfigError Source # | |
Defined in Cardano.Api.LedgerState | |
data InitialLedgerStateError Source #
Constructors
| ILSEConfigFile Text | Failed to read or parse the network config file. |
| ILSEGenesisFile GenesisConfigError | Failed to read or parse a genesis file linked from the network config file. |
| ILSELedgerConsensusConfig GenesisConfigError | Failed to derive the Ledger or Consensus config. |
Instances
| Error InitialLedgerStateError Source # | |
Defined in Cardano.Api.LedgerState Methods prettyError :: InitialLedgerStateError -> Doc ann Source # | |
| Exception InitialLedgerStateError Source # | |
Defined in Cardano.Api.LedgerState | |
| Show InitialLedgerStateError Source # | |
Defined in Cardano.Api.LedgerState | |
Leadership schedule
data LeadershipError Source #
Constructors
Instances
| Error LeadershipError Source # | |
Defined in Cardano.Api.LedgerState Methods prettyError :: LeadershipError -> Doc ann Source # | |
| Show LeadershipError Source # | |
Defined in Cardano.Api.LedgerState | |
constructGlobals :: ShelleyGenesis -> EpochInfo (Either Text) -> Globals Source #
currentEpochEligibleLeadershipSlots Source #
Arguments
| :: ShelleyBasedEra era | |
| -> ShelleyGenesis | |
| -> EpochInfo (Either Text) | |
| -> PParams (ShelleyLedgerEra era) | |
| -> ProtocolState era | |
| -> PoolId | |
| -> SigningKey VrfKey | |
| -> Serialised (PoolDistribution era) | |
| -> EpochNo | Current EpochInfo |
| -> Either LeadershipError (Set SlotNo) |
Return the slots at which a particular stake pool operator is expected to mint a block.
nextEpochEligibleLeadershipSlots Source #
Arguments
| :: ShelleyBasedEra era | |
| -> ShelleyGenesis | |
| -> SerialisedCurrentEpochState era | We need the mark stake distribution in order to predict the following epoch's leadership schedule |
| -> ProtocolState era | |
| -> PoolId | Potential slot leading stake pool |
| -> SigningKey VrfKey | VRF signing key of the stake pool |
| -> PParams (ShelleyLedgerEra era) | |
| -> EpochInfo (Either Text) | |
| -> (ChainTip, EpochNo) | |
| -> Either LeadershipError (Set SlotNo) |
Node Config
data NodeConfig Source #
Constructors
| NodeConfig | |
Fields
| |
Instances
| FromJSON NodeConfig Source # | |
Defined in Cardano.Api.LedgerState | |
Network Config
type NodeConfigFile = File NodeConfig Source #
readNodeConfig :: (MonadError Text m, MonadIO m) => NodeConfigFile 'In -> m NodeConfig Source #
Genesis Config
data GenesisConfig Source #
Constructors
| GenesisCardano !NodeConfig !Config !GenesisHashShelley !(TransitionConfig LatestKnownEra) |
readCardanoGenesisConfig :: forall t (m :: Type -> Type). MonadIOTransError GenesisConfigError t m => NodeConfig -> t m GenesisConfig Source #
mkProtocolInfoCardano :: SomeHasFS IO -> GenesisConfig -> IO (ProtocolInfo (CardanoBlock StandardCrypto), Tracer IO KESAgentClientTrace -> IO [MkBlockForging IO (CardanoBlock StandardCrypto)]) Source #
resolveShelleyInitialFunds Source #
Arguments
| :: (MonadST m, MonadThrow m) | |
| => SomeHasFS m | Filesystem capability used to stream an |
| -> ShelleyGenesis | The Shelley genesis whose initial funds to resolve. |
| -> m ShelleyGenesis |
Resolve a Shelley genesis' sgInitialFunds against its
sgExtraConfig, mirroring the resolution ledger's own
registerInitialFunds performs when building the initial ledger state
from genesis.
A ShelleyGenesis carries two sources of initial funds: the legacy
sgInitialFunds field, and sgExtraConfig, which is where
cardano-cli create-testnet-data puts the funded addresses, embedded or in
an external hash-verified file. The ledger reconciles the two only while
building the initial ledger state and never writes the result back into the
ShelleyGenesis value, so a parsed genesis read outside that path
must repeat the resolution. Once the ledger drops the legacy field, the
two-source reconciliation here can go, but turning secInitialFunds
into actual funds (including reading and hash-checking an injection file)
is still needed.
Throws InjectionConflictingSources if the genesis specifies initial
funds through both the legacy field and the extra config, and
InjectionHashMismatch if an InjectionFromFile source does
not hash to the value the genesis declares for it.
Byron Genesis Config
readByronGenesisConfig :: forall t (m :: Type -> Type). MonadIOTransError GenesisConfigError t m => NodeConfig -> t m Config Source #
Shelley Genesis Config
data ShelleyConfig Source #
Constructors
| ShelleyConfig | |
Fields | |
newtype GenesisHashShelley Source #
Constructors
| GenesisHashShelley | |
Fields | |
Instances
| Eq GenesisHashShelley Source # | |
Defined in Cardano.Api.Genesis.Internal Methods (==) :: GenesisHashShelley -> GenesisHashShelley -> Bool Source # (/=) :: GenesisHashShelley -> GenesisHashShelley -> Bool Source # | |
| Show GenesisHashShelley Source # | |
Defined in Cardano.Api.Genesis.Internal | |
readShelleyGenesisConfig :: forall t (m :: Type -> Type). MonadIOTransError GenesisConfigError t m => NodeConfig -> t m ShelleyConfig Source #
readShelleyGenesis :: forall (m :: Type -> Type) t. MonadIOTransError ShelleyGenesisError t m => ShelleyGenesisFile 'In -> Maybe GenesisHashShelley -> t m ShelleyConfig Source #
data ShelleyGenesisError Source #
Constructors
| ShelleyGenesisReadError !FilePath !Text | |
| ShelleyGenesisHashMismatch !GenesisHashShelley !GenesisHashShelley | |
| ShelleyGenesisDecodeError !FilePath !Text |
Instances
| Exception ShelleyGenesisError Source # | |
Defined in Cardano.Api.LedgerState | |
| Show ShelleyGenesisError Source # | |
Defined in Cardano.Api.LedgerState | |
shelleyPraosNonce :: GenesisHashShelley -> Nonce Source #
Compute the Nonce from the hash of the Genesis file.
Alonzo Genesis Config
newtype GenesisHashAlonzo Source #
Constructors
| GenesisHashAlonzo | |
Fields | |
Instances
| Eq GenesisHashAlonzo Source # | |
Defined in Cardano.Api.Genesis.Internal Methods (==) :: GenesisHashAlonzo -> GenesisHashAlonzo -> Bool Source # (/=) :: GenesisHashAlonzo -> GenesisHashAlonzo -> Bool Source # | |
| Show GenesisHashAlonzo Source # | |
Defined in Cardano.Api.Genesis.Internal | |
readAlonzoGenesisConfig :: forall t (m :: Type -> Type). MonadIOTransError GenesisConfigError t m => NodeConfig -> t m AlonzoGenesis Source #
Conway Genesis Config
newtype GenesisHashConway Source #
Constructors
| GenesisHashConway | |
Fields | |
Instances
| Eq GenesisHashConway Source # | |
Defined in Cardano.Api.Genesis.Internal Methods (==) :: GenesisHashConway -> GenesisHashConway -> Bool Source # (/=) :: GenesisHashConway -> GenesisHashConway -> Bool Source # | |
| Show GenesisHashConway Source # | |
Defined in Cardano.Api.Genesis.Internal | |
readConwayGenesisConfig :: forall t (m :: Type -> Type). MonadIOTransError GenesisConfigError t m => NodeConfig -> t m ConwayGenesis Source #
If the conway genesis file does not exist we simply put in a default.
Environment
Constructors
| Env | |
Fields
| |
genesisConfigToEnv :: SomeHasFS IO -> GenesisConfig -> IO (Either GenesisConfigError Env) Source #