Safe Haskell | None |
---|---|
Language | Haskell98 |
Shelley.Spec.Ledger.BlockChain
Synopsis
- newtype HashHeader crypto = HashHeader {
- unHashHeader :: Hash crypto (BHeader crypto)
- data PrevHash crypto
- = GenesisHash
- | BlockHash !(HashHeader crypto)
- data LastAppliedBlock crypto = LastAppliedBlock {
- labBlockNo :: !BlockNo
- labSlotNo :: !SlotNo
- labHash :: !(HashHeader crypto)
- lastAppliedHash :: WithOrigin (LastAppliedBlock crypto) -> PrevHash crypto
- data BHBody crypto = BHBody {
- bheaderBlockNo :: !BlockNo
- bheaderSlotNo :: !SlotNo
- bheaderPrev :: !(PrevHash crypto)
- bheaderVk :: !(VKey 'BlockIssuer crypto)
- bheaderVrfVk :: !(VerKeyVRF crypto)
- bheaderEta :: !(CertifiedVRF crypto Nonce)
- bheaderL :: !(CertifiedVRF crypto Natural)
- bsize :: !Natural
- bhash :: !(HashBBody crypto)
- bheaderOCert :: !(OCert crypto)
- bprotver :: !ProtVer
- poolIDfromBHBody :: Crypto crypto => BHBody crypto -> KeyHash 'BlockIssuer crypto
- issuerIDfromBHBody :: Crypto crypto => BHBody crypto -> KeyHash 'BlockIssuer crypto
- data BHeader crypto where
- data Block era where
- newtype LaxBlock era = LaxBlock (Block era)
- data TxSeq era where
- TxSeq' !(StrictSeq (Tx era)) ByteString ByteString ByteString
- pattern TxSeq :: (Era era, TxBodyConstraints era, ToCBOR (AuxiliaryData era)) => StrictSeq (Tx era) -> TxSeq era
- newtype HashBBody crypto = UnsafeHashBBody {
- unHashBody :: Hash crypto EraIndependentBlockBody
- bhHash :: forall crypto. Crypto crypto => BHeader crypto -> HashHeader crypto
- bbHash :: forall era. Era era => TxSeq era -> HashBBody (Crypto era)
- hashHeaderToNonce :: HashHeader crypto -> Nonce
- prevHashToNonce :: PrevHash crypto -> Nonce
- bHeaderSize :: forall crypto. Crypto crypto => BHeader crypto -> Int
- bBodySize :: forall era. Era era => TxSeq era -> Int
- slotToNonce :: SlotNo -> Nonce
- hBbsize :: BHBody crypto -> Natural
- bheader :: Era era => Block era -> BHeader (Crypto era)
- bhbody :: Crypto crypto => BHeader crypto -> BHBody crypto
- bbody :: Era era => Block era -> TxSeq era
- bnonce :: BHBody crypto -> Nonce
- seedEta :: Nonce
- seedL :: Nonce
- incrBlocks :: Bool -> KeyHash 'StakePool crypto -> BlocksMade crypto -> BlocksMade crypto
- mkSeed :: Nonce -> SlotNo -> Nonce -> Seed
- checkLeaderValue :: forall v. VRFAlgorithm v => OutputVRF v -> Rational -> ActiveSlotCoeff -> Bool
Documentation
newtype HashHeader crypto Source #
The hash of a Block Header
Constructors
HashHeader | |
Fields
|
Instances
The previous hash of a block
Constructors
GenesisHash | |
BlockHash !(HashHeader crypto) |
Instances
data LastAppliedBlock crypto Source #
Constructors
LastAppliedBlock | |
Fields
|
Instances
lastAppliedHash :: WithOrigin (LastAppliedBlock crypto) -> PrevHash crypto Source #
Constructors
BHBody | |
Fields
|
Instances
poolIDfromBHBody :: Crypto crypto => BHBody crypto -> KeyHash 'BlockIssuer crypto Source #
Deprecated: poolIDfromBHBody has been deprecated (the name is misleading), use issuerIDfromBHBody
Retrieve the pool id (the hash of the pool operator's cold key) from the body of the block header.
issuerIDfromBHBody :: Crypto crypto => BHBody crypto -> KeyHash 'BlockIssuer crypto Source #
Retrieve the issuer id (the hash of the cold key) from the body of the block header. This corresponds to either a genesis/core node or a stake pool.
data BHeader crypto where Source #
Bundled Patterns
pattern BHeader :: Crypto crypto => BHBody crypto -> SignedKES crypto (BHBody crypto) -> BHeader crypto |
Instances
Crypto crypto => Eq (BHeader crypto) Source # | |
Crypto crypto => Show (BHeader crypto) Source # | |
Generic (BHeader crypto) Source # | |
Crypto crypto => ToCBOR (BHeader crypto) Source # | |
Defined in Shelley.Spec.Ledger.BlockChain | |
Crypto crypto => FromCBOR (Annotator (BHeader crypto)) Source # | |
Crypto crypto => NoThunks (BHeader crypto) Source # | |
type Rep (BHeader crypto) Source # | |
Defined in Shelley.Spec.Ledger.BlockChain type Rep (BHeader crypto) = D1 ('MetaData "BHeader" "Shelley.Spec.Ledger.BlockChain" "shelley-spec-ledger-0.1.0.0-Is3EknyvW92LxCl96jGQVW" 'False) (C1 ('MetaCons "BHeader'" 'PrefixI 'True) (S1 ('MetaSel ('Just "bHeaderBody'") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (BHBody crypto)) :*: (S1 ('MetaSel ('Just "bHeaderSig'") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (SignedKES crypto (BHBody crypto))) :*: S1 ('MetaSel ('Just "bHeaderBytes") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 ByteString)))) |
Constructors
Block' !(BHeader (Crypto era)) !(TxSeq era) ByteString |
Instances
ShelleyBased era => Eq (Block era) Source # | |
ShelleyBased era => Show (Block era) Source # | |
Generic (Block era) Source # | |
Era era => ToCBOR (Block era) Source # | |
(ShelleyBased era, ValidateScript era) => FromCBOR (Annotator (Block era)) Source # | |
ShelleyBased era => NoThunks (Block era) Source # | |
type Rep (Block era) Source # | |
Defined in Shelley.Spec.Ledger.BlockChain type Rep (Block era) = D1 ('MetaData "Block" "Shelley.Spec.Ledger.BlockChain" "shelley-spec-ledger-0.1.0.0-Is3EknyvW92LxCl96jGQVW" 'False) (C1 ('MetaCons "Block'" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (BHeader (Crypto era))) :*: (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (TxSeq era)) :*: S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString)))) |
Constructors
TxSeq' !(StrictSeq (Tx era)) ByteString ByteString ByteString |
Bundled Patterns
pattern TxSeq :: (Era era, TxBodyConstraints era, ToCBOR (AuxiliaryData era)) => StrictSeq (Tx era) -> TxSeq era |
Instances
ShelleyBased era => Eq (TxSeq era) Source # | |
ShelleyBased era => Show (TxSeq era) Source # | |
Generic (TxSeq era) Source # | |
ShelleyBased era => NoThunks (TxSeq era) Source # | |
Era era => ToCBORGroup (TxSeq era) Source # | |
type Rep (TxSeq era) Source # | |
Defined in Shelley.Spec.Ledger.BlockChain type Rep (TxSeq era) = D1 ('MetaData "TxSeq" "Shelley.Spec.Ledger.BlockChain" "shelley-spec-ledger-0.1.0.0-Is3EknyvW92LxCl96jGQVW" 'False) (C1 ('MetaCons "TxSeq'" 'PrefixI 'True) ((S1 ('MetaSel ('Just "txSeqTxns'") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 (StrictSeq (Tx era))) :*: S1 ('MetaSel ('Just "txSeqBodyBytes") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString)) :*: (S1 ('MetaSel ('Just "txSeqWitsBytes") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString) :*: S1 ('MetaSel ('Just "txSeqMetadataBytes") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ByteString)))) |
newtype HashBBody crypto Source #
Hash of block body
Constructors
UnsafeHashBBody | |
Fields
|
Instances
Eq (HashBBody crypto) Source # | |
Ord (HashBBody crypto) Source # | |
Defined in Shelley.Spec.Ledger.BlockChain Methods compare :: HashBBody crypto -> HashBBody crypto -> Ordering # (<) :: HashBBody crypto -> HashBBody crypto -> Bool # (<=) :: HashBBody crypto -> HashBBody crypto -> Bool # (>) :: HashBBody crypto -> HashBBody crypto -> Bool # (>=) :: HashBBody crypto -> HashBBody crypto -> Bool # max :: HashBBody crypto -> HashBBody crypto -> HashBBody crypto # min :: HashBBody crypto -> HashBBody crypto -> HashBBody crypto # | |
Show (HashBBody crypto) Source # | |
Crypto crypto => ToCBOR (HashBBody crypto) Source # | |
Defined in Shelley.Spec.Ledger.BlockChain | |
Crypto crypto => FromCBOR (HashBBody crypto) Source # | |
NoThunks (HashBBody crypto) Source # | |
bhHash :: forall crypto. Crypto crypto => BHeader crypto -> HashHeader crypto Source #
Hash a given block header
bbHash :: forall era. Era era => TxSeq era -> HashBBody (Crypto era) Source #
Hash a given block body
hashHeaderToNonce :: HashHeader crypto -> Nonce Source #
HashHeader to Nonce
prevHashToNonce :: PrevHash crypto -> Nonce Source #
slotToNonce :: SlotNo -> Nonce Source #
incrBlocks :: Bool -> KeyHash 'StakePool crypto -> BlocksMade crypto -> BlocksMade crypto Source #
Construct a seed to use in the VRF computation.
checkLeaderValue :: forall v. VRFAlgorithm v => OutputVRF v -> Rational -> ActiveSlotCoeff -> Bool Source #
Check that the certified input natural is valid for being slot leader. This means we check that
fromNat (certNat) < 1 - (1 - f)^σ
where fromNat creates an appropriate value in [0;1] from the certified natural. The calculation is done using the following optimization:
let p = fromNat (certNat) and c = ln(1 - f)
then p < 1 - (1 - f)^σ = 1 / (1 - p) < exp(-σ * c)
this can be efficiently be computed by taylorExpCmp
which returns ABOVE
in case the reference value `1 / (1 - p)` is above the exponential function
at `-σ * c`, BELOW
if it is below or MaxReached
if it couldn't
conclusively compute this within the given iteration bounds.