Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data family TxId tx
- data family Header blk
- data family LedgerState blk
- data ShelleyLedgerEvent era
- = ShelleyLedgerEventBBODY (Event (EraRule "BBODY" era))
- | ShelleyLedgerEventTICK (Event (EraRule "TICK" era))
- newtype ApplyTxError era = ApplyTxError (NonEmpty (PredicateFailure (EraRule "LEDGER" era)))
- data family Validated x
- class HasHeader (Header blk) ⇒ GetHeader blk where
- getHeader ∷ blk → Header blk
- blockMatchesHeader ∷ Header blk → blk → Bool
- headerIsEBB ∷ Header blk → Maybe EpochNo
- data family StorageConfig blk
- data family CodecConfig blk
- data family BlockConfig blk
- data family Ticked st
- data family GenTx blk
- data family NestedCtxt_ blk ∷ (Type → Type) → Type → Type
- data family BlockQuery blk ∷ Type → Type
- data ShelleyBlock proto era = ShelleyBlock {
- shelleyBlockRaw ∷ !(Block (ShelleyProtocolHeader proto) era)
- shelleyBlockHeaderHash ∷ !(ShelleyHash (ProtoCrypto proto))
- class (ShelleyBasedEra era, ShelleyProtocol proto, Eq (ShelleyProtocolHeader proto), Show (ShelleyProtocolHeader proto), NoThunks (ShelleyProtocolHeader proto), EncCBOR (ShelleyProtocolHeader proto), DecCBOR (Annotator (ShelleyProtocolHeader proto)), Show (CannotForgeError proto), SelectView proto ~ PraosChainSelectView (EraCrypto era), SignedHeader (ShelleyProtocolHeader proto), DecodeDisk (ShelleyBlock proto era) (ChainDepState proto), EncodeDisk (ShelleyBlock proto era) (ChainDepState proto), EraCrypto era ~ ProtoCrypto proto, HasPartialConsensusConfig proto, DecCBOR (PState era), FromCBOR (LegacyPParams era), ToCBOR (LegacyPParams era)) ⇒ ShelleyCompatible proto era
- class (ShelleyCompatible (BlockProtocol blk) (ShelleyBlockLedgerEra blk), blk ~ ShelleyBlock (BlockProtocol blk) (ShelleyBlockLedgerEra blk)) ⇒ IsShelleyBlock blk
- type family ShelleyBlockLedgerEra blk where ...
- class (EraSegWits era, EraGov era, ApplyTx era, ApplyBlock era, EraTransition era, GetLedgerView era, NoThunks (StashedAVVMAddresses era), EncCBOR (StashedAVVMAddresses era), DecCBOR (StashedAVVMAddresses era), Show (StashedAVVMAddresses era), Eq (StashedAVVMAddresses era), DecCBOR (PredicateFailure (EraRule "LEDGER" era)), EncCBOR (PredicateFailure (EraRule "LEDGER" era)), DecCBOR (PredicateFailure (EraRule "UTXOW" era)), EncCBOR (PredicateFailure (EraRule "UTXOW" era)), DSignable (EraCrypto era) (Hash (EraCrypto era) EraIndependentTxBody), NoThunks (PredicateFailure (EraRule "BBODY" era)), NoThunks (TranslationContext era)) ⇒ ShelleyBasedEra era
- newtype ShelleyHash crypto = ShelleyHash {
- unShelleyHash ∷ Hash crypto EraIndependentBlockHeader
- data CompactGenesis c
- newtype ShelleyLedgerError era = BBodyError (BlockTransitionError era)
- data ShelleyTip proto era = ShelleyTip {
- shelleyTipSlotNo ∷ !SlotNo
- shelleyTipBlockNo ∷ !BlockNo
- shelleyTipHash ∷ !(HeaderHash (ShelleyBlock proto era))
- newtype ShelleyTransition = ShelleyTransitionInfo {}
- data ShelleyLedgerConfig era = ShelleyLedgerConfig {}
- data ShelleyReapplyException = ∀ era.Show (BlockTransitionError era) ⇒ ShelleyReapplyException (BlockTransitionError era)
- data AlonzoMeasure = AlonzoMeasure {
- byteSize ∷ !(IgnoringOverflow ByteSize32)
- exUnits ∷ !(ExUnits' Natural)
- data ConwayMeasure = ConwayMeasure {}
- data ShelleyNodeToClientVersion
- data ShelleyNodeToNodeVersion = ShelleyNodeToNodeVersion1
- newtype NonMyopicMemberRewards c = NonMyopicMemberRewards {
- unNonMyopicMemberRewards ∷ Map (Either Coin (Credential 'Staking c)) (Map (KeyHash 'StakePool c) Coin)
- data StakeSnapshot crypto = StakeSnapshot {}
- data StakeSnapshots crypto = StakeSnapshots {
- ssStakeSnapshots ∷ !(Map (KeyHash 'StakePool crypto) (StakeSnapshot crypto))
- ssMarkTotal ∷ !Coin
- ssSetTotal ∷ !Coin
- ssGoTotal ∷ !Coin
- verifyBlockIntegrity ∷ ShelleyCompatible proto era ⇒ Word64 → ShelleyBlock proto era → Bool
- verifyHeaderIntegrity ∷ ProtocolHeaderSupportsKES proto ⇒ Word64 → ShelleyProtocolHeader proto → Bool
- mkShelleyBlock ∷ ShelleyCompatible proto era ⇒ Block (ShelleyProtocolHeader proto) era → ShelleyBlock proto era
- mkShelleyHeader ∷ ShelleyCompatible proto era ⇒ ShelleyProtocolHeader proto → Header (ShelleyBlock proto era)
- decodeShelleyBlock ∷ ∀ proto era. ShelleyCompatible proto era ⇒ ∀ s. Decoder s (ByteString → ShelleyBlock proto era)
- decodeShelleyHeader ∷ ∀ proto era. ShelleyCompatible proto era ⇒ ∀ s. Decoder s (ByteString → Header (ShelleyBlock proto era))
- encodeShelleyBlock ∷ ∀ proto era. ShelleyCompatible proto era ⇒ ShelleyBlock proto era → Encoding
- encodeShelleyHeader ∷ ∀ proto era. ShelleyCompatible proto era ⇒ Header (ShelleyBlock proto era) → Encoding
- shelleyBinaryBlockInfo ∷ ∀ proto era. ShelleyCompatible proto era ⇒ ShelleyBlock proto era → BinaryBlockInfo
- fromShelleyPrevHash ∷ EraCrypto era ~ ProtoCrypto proto ⇒ PrevHash (EraCrypto era) → ChainHash (ShelleyBlock proto era)
- toShelleyPrevHash ∷ EraCrypto era ~ ProtoCrypto proto ⇒ ChainHash (Header (ShelleyBlock proto era)) → PrevHash (EraCrypto era)
- compactGenesis ∷ ShelleyGenesis c → CompactGenesis c
- mkShelleyBlockConfig ∷ ∀ proto era. ShelleyBasedEra era ⇒ ProtVer → ShelleyGenesis (EraCrypto era) → [VKey 'BlockIssuer (EraCrypto era)] → BlockConfig (ShelleyBlock proto era)
- forgeShelleyBlock ∷ ∀ m era proto. (ShelleyCompatible proto era, Monad m) ⇒ HotKey (EraCrypto era) m → CanBeLeader proto → TopLevelConfig (ShelleyBlock proto era) → BlockNo → SlotNo → TickedLedgerState (ShelleyBlock proto era) → [Validated (GenTx (ShelleyBlock proto era))] → IsLeader proto → m (ShelleyBlock proto era)
- castShelleyTip ∷ HeaderHash (ShelleyBlock proto era) ~ HeaderHash (ShelleyBlock proto' era') ⇒ ShelleyTip proto era → ShelleyTip proto' era'
- shelleyLedgerTipPoint ∷ LedgerState (ShelleyBlock proto era) → Point (ShelleyBlock proto era)
- shelleyTipToPoint ∷ WithOrigin (ShelleyTip proto era) → Point (ShelleyBlock proto era)
- mkShelleyLedgerConfig ∷ ShelleyGenesis (EraCrypto era) → TranslationContext era → EpochInfo (Except PastHorizonException) → MaxMajorProtVer → ShelleyLedgerConfig era
- shelleyEraParams ∷ ShelleyGenesis c → EraParams
- shelleyEraParamsNeverHardForks ∷ ShelleyGenesis c → EraParams
- shelleyLedgerGenesis ∷ ShelleyLedgerConfig era → ShelleyGenesis (EraCrypto era)
- getPParams ∷ EraGov era ⇒ NewEpochState era → PParams era
- decodeShelleyAnnTip ∷ ShelleyCompatible proto era ⇒ Decoder s (AnnTip (ShelleyBlock proto era))
- decodeShelleyLedgerState ∷ ∀ era proto s. ShelleyCompatible proto era ⇒ Decoder s (LedgerState (ShelleyBlock proto era))
- encodeShelleyAnnTip ∷ ShelleyCompatible proto era ⇒ AnnTip (ShelleyBlock proto era) → Encoding
- encodeShelleyHeaderState ∷ ShelleyCompatible proto era ⇒ HeaderState (ShelleyBlock proto era) → Encoding
- encodeShelleyLedgerState ∷ ShelleyCompatible proto era ⇒ LedgerState (ShelleyBlock proto era) → Encoding
- fixedBlockBodyOverhead ∷ Num a ⇒ a
- mkShelleyTx ∷ ∀ era proto. ShelleyBasedEra era ⇒ Tx era → GenTx (ShelleyBlock proto era)
- mkShelleyValidatedTx ∷ ∀ era proto. ShelleyBasedEra era ⇒ Validated (Tx era) → Validated (GenTx (ShelleyBlock proto era))
- perTxOverhead ∷ Num a ⇒ a
- fromExUnits ∷ ExUnits → ExUnits' Natural
- querySupportedVersion ∷ BlockQuery (ShelleyBlock proto era) result → ShelleyNodeToClientVersion → Bool
- decodeShelleyQuery ∷ ∀ era proto. ShelleyBasedEra era ⇒ ∀ s. Decoder s (SomeSecond BlockQuery (ShelleyBlock proto era))
- decodeShelleyResult ∷ ∀ proto era result. ShelleyCompatible proto era ⇒ ShelleyNodeToClientVersion → BlockQuery (ShelleyBlock proto era) result → ∀ s. Decoder s result
- encodeShelleyQuery ∷ ∀ era proto result. ShelleyBasedEra era ⇒ BlockQuery (ShelleyBlock proto era) result → Encoding
- encodeShelleyResult ∷ ∀ proto era result. ShelleyCompatible proto era ⇒ ShelleyNodeToClientVersion → BlockQuery (ShelleyBlock proto era) result → result → Encoding
Documentation
A generalized transaction, GenTx
, identifier.
Instances
data family Header blk Source #
Instances
data family LedgerState blk Source #
Ledger state associated with a block
This is the Consensus notion of a ledger state. Each block type is
associated with one of the Ledger types for the ledger state. Virtually
every concept in this codebase revolves around this type, or the referenced
blk
. Whenever we use the type variable l
, we intend to denote that the
expected instantiation is either a LedgerState
or some wrapper over it
(like the ExtLedgerState
).
The main operations we can do with a LedgerState
are ticking (defined in
IsLedger
), and applying a block (defined in
ApplyBlock
).
Instances
data ShelleyLedgerEvent era Source #
All events emitted by the Shelley ledger API
ShelleyLedgerEventBBODY (Event (EraRule "BBODY" era)) | An event emitted when (re)applying a block |
ShelleyLedgerEventTICK (Event (EraRule "TICK" era)) | An event emitted during the chain tick |
newtype ApplyTxError era Source #
ApplyTxError (NonEmpty (PredicateFailure (EraRule "LEDGER" era))) |
Instances
data family Validated x Source #
" Validated " transaction or block
The ledger defines how to validate transactions and blocks. It's possible the type before and after validation may be distinct (eg Alonzo transactions), which originally motivated this family.
We also gain the related benefit that certain interface functions, such as those that reapply blocks, can have a more precise type now. TODO
Similarly, the Node-to-Client mini protocols can explicitly indicate that the
client trusts the blocks from the local server, by having the server send
Validated
blocks to the client. TODO
Note that validation has different implications for a transaction than for a block. In particular, a validated transaction can be " reapplied " to different ledger states, whereas a validated block must only be " reapplied " to the exact same ledger state (eg as part of rebuilding from an on-disk ledger snapshot).
Since the ledger defines validation, see the ledger details for concrete
examples of what determines the validity (wrt to a LedgerState
) of a
transaction and/or block. Example properties include: a transaction's claimed
inputs exist and are still unspent, a block carries a sufficient
cryptographic signature, etc.
Instances
class HasHeader (Header blk) ⇒ GetHeader blk where Source #
getHeader ∷ blk → Header blk Source #
blockMatchesHeader ∷ Header blk → blk → Bool Source #
Check whether the header is the header of the block.
For example, by checking whether the hash of the body stored in the header matches that of the block.
headerIsEBB ∷ Header blk → Maybe EpochNo Source #
When the given header is the header of an Epoch Boundary Block, returns its epoch number.
Instances
GetHeader ByronBlock Source # | |
ShelleyCompatible proto era ⇒ GetHeader (ShelleyBlock proto era) Source # | |
Defined in Ouroboros.Consensus.Shelley.Ledger.Block getHeader ∷ ShelleyBlock proto era → Header (ShelleyBlock proto era) Source # blockMatchesHeader ∷ Header (ShelleyBlock proto era) → ShelleyBlock proto era → Bool Source # headerIsEBB ∷ Header (ShelleyBlock proto era) → Maybe EpochNo Source # |
data family StorageConfig blk Source #
Config needed for the
NodeInitStorage
class. Defined here to
avoid circular dependencies.
Instances
data family CodecConfig blk Source #
Static configuration required for serialisation and deserialisation of types pertaining to this type of block.
Data family instead of type family to get better type inference.
Instances
data family BlockConfig blk Source #
Static configuration required to work with this type of blocks
Instances
data family Ticked st Source #
" Ticked " piece of state, either LedgerState
or ChainDepState
Ticking refers to the passage of time (the ticking of the clock). When a
piece of state is marked as ticked, it means that time-related changes have
been applied to the state. There are exactly two methods in the interface
that do that: tickChainDepState
and
applyChainTickLedgerResult
.
Also note that a successful forecast
must equal
forecastFor
(ledgerViewForecastAt
cfg st)
slot
. Thus a
protocolLedgerView
cfg
(applyChainTick
cfg slot st)LedgerView
can only be projected
from a Ticked
state, but cannot itself be ticked.
Some examples of time related changes:
- Scheduled delegations might have been applied in Byron
- New leader schedule computed for Shelley
- Transition from Byron to Shelley activated in the hard fork combinator.
- Nonces switched out at the start of a new epoch.
Instances
data family GenTx blk Source #
Generalized transaction
The mempool (and, accordingly, blocks) consist of "generalized transactions"; this could be "proper" transactions (transferring funds) but also other kinds of things such as update proposals, delegations, etc.