ouroboros-consensus-protocol-0.12.0.0: Cardano consensus protocols
Safe HaskellNone
LanguageHaskell2010

Ouroboros.Consensus.Protocol.Ledger.HotKey

Description

Hot key

Intended for qualified import

Synopsis

KES Info

type KESEvolution = Period Source #

We call the relative periods that a KES key is valid its evolution, to avoid confusion with absolute periods.

data KESInfo Source #

Constructors

KESInfo 

Fields

Instances

Instances details
Generic KESInfo Source # 
Instance details

Defined in Ouroboros.Consensus.Protocol.Ledger.HotKey

Associated Types

type Rep KESInfo 
Instance details

Defined in Ouroboros.Consensus.Protocol.Ledger.HotKey

type Rep KESInfo = D1 ('MetaData "KESInfo" "Ouroboros.Consensus.Protocol.Ledger.HotKey" "ouroboros-consensus-protocol-0.12.0.0-inplace" 'False) (C1 ('MetaCons "KESInfo" 'PrefixI 'True) (S1 ('MetaSel ('Just "kesStartPeriod") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 KESPeriod) :*: (S1 ('MetaSel ('Just "kesEndPeriod") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 KESPeriod) :*: S1 ('MetaSel ('Just "kesEvolution") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 KESEvolution))))

Methods

fromKESInfoRep KESInfo x #

toRep KESInfo x → KESInfo #

Show KESInfo Source # 
Instance details

Defined in Ouroboros.Consensus.Protocol.Ledger.HotKey

Methods

showsPrecIntKESInfoShowS #

showKESInfoString #

showList ∷ [KESInfo] → ShowS #

NoThunks KESInfo Source # 
Instance details

Defined in Ouroboros.Consensus.Protocol.Ledger.HotKey

type Rep KESInfo Source # 
Instance details

Defined in Ouroboros.Consensus.Protocol.Ledger.HotKey

type Rep KESInfo = D1 ('MetaData "KESInfo" "Ouroboros.Consensus.Protocol.Ledger.HotKey" "ouroboros-consensus-protocol-0.12.0.0-inplace" 'False) (C1 ('MetaCons "KESInfo" 'PrefixI 'True) (S1 ('MetaSel ('Just "kesStartPeriod") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 KESPeriod) :*: (S1 ('MetaSel ('Just "kesEndPeriod") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 KESPeriod) :*: S1 ('MetaSel ('Just "kesEvolution") 'NoSourceUnpackedness 'SourceStrict 'DecidedStrict) (Rec0 KESEvolution))))

kesAbsolutePeriodKESInfoKESPeriod Source #

Return the absolute KES period

KES Status

data KESStatus Source #

Constructors

BeforeKESStart

The given period is before the start period of the KES key.

Fields

InKESRange

The given period is in the range of the KES key.

Fields

  • KESEvolution

    Relative period or evolution corresponding to the given absolute period

AfterKESEnd

The given period is after the end period of the KES key.

Fields

kesStatusKESInfoKESPeriodKESStatus Source #

Return the evolution of the given KES period, when it falls within the range of the HotKey ([hkStart, hkEnd)).

Note that the upper bound is exclusive, the spec says: > c0 <= kesPeriod s < c0 + MaxKESEvo

Hot Key

data HotKey c (m ∷ TypeType) Source #

API to interact with the key.

Constructors

HotKey 

Fields

  • evolveKESPeriod → m KESEvolutionInfo

    Evolve the KES signing key to the given absolute KES period.

    When the key cannot evolve anymore, we poison it.

  • getInfo ∷ m KESInfo

    Return KESInfo of the signing key.

  • getOCertMaybe ∷ m (Maybe (OCert c))

    Return the OCert corresponding to the KES signing key, if any.

  • isPoisoned ∷ m Bool

    Check whether a valid KES signing key exists. Poisoned means no key exists; reasons for this could be: - no signing key has been set yet - the signing key has been explicitly erased (forget) - the signing key has been evolved past the end of the available evolutions

  • sign_ ∷ ∀ toSign. (Signable (KES c) toSign, HasCallStack) ⇒ toSign → m (SignedKES (KES c) toSign)

    Sign the given toSign with the current signing key.

    PRECONDITION: the key is not poisoned.

    POSTCONDITION: the signature is in normal form.

  • finalize ∷ m ()

    Release any resources held by the HotKey, including the signing key itself. This should be called exactly once per HotKey instance.

Instances

Instances details
NoThunks (HotKey c m) Source # 
Instance details

Defined in Ouroboros.Consensus.Protocol.Ledger.HotKey

data KESEvolutionError Source #

Failed to evolve the KES key.

Constructors

KESCouldNotEvolve

The KES key could not be evolved to the target period.

Fields

  • KESInfo
     
  • KESPeriod

    Target period outside the range of the current KES key. Typically the current KES period according to the wallclock slot.

KESKeyAlreadyPoisoned

The KES key was already poisoned.

Fields

  • KESInfo
     
  • KESPeriod

    Target period outside the range of the current KES key. Typically the current KES period according to the wallclock slot.

type KESEvolutionInfo = UpdateInfo KESInfo KESEvolutionError Source #

Result of evolving the KES key.

getOCertMonad m ⇒ HotKey c m → m (OCert c) Source #

mkDynamicHotKey Source #

Arguments

∷ ∀ m c. (Crypto c, IOLike m) 
Word64

Max KES evolutions

Maybe (KeyProducer c m) 
→ m (HotKey c m) 

Create a new HotKey that runs a key-producer action on a separate thread. The key producer action will receive a callback that can be used to pass keys into the HotKey; the HotKey will dynamically update its internal state to reflect new keys as they arrive.

mkEmptyHotKey Source #

Arguments

∷ ∀ m c. (Crypto c, IOLike m) 
Word64

Max KES evolutions

→ m (HotKey c m) 

Create a new HotKey and initialize it to a poisoned state (containing no valid KES sign key).

mkHotKey Source #

Arguments

∷ ∀ m c. (Crypto c, IOLike m) 
OCert c 
SignKeyKES (KES c) 
KESPeriod

Start period

Word64

Max KES evolutions

→ m (HotKey c m) 

mkHotKeyAtEvolution Source #

Arguments

∷ ∀ m c. (Crypto c, IOLike m) 
Word 
OCert c 
SignKeyKES (KES c) 
KESPeriod

Start period

Word64

Max KES evolutions

→ m (HotKey c m) 

sign ∷ (Signable (KES c) toSign, HasCallStack) ⇒ HotKey c m → toSign → m (SignedKES (KES c) toSign) Source #