ouroboros-consensus:unstable-cardano-testlib
Safe HaskellNone
LanguageHaskell2010

Test.Consensus.Cardano.ProtocolInfo

Description

Utility functions to elaborate a Cardano ProtocolInfo from certain parameters.

Synopsis

ProtocolInfo elaboration parameter types

Hard-fork specification

data Era Source #

Instances

Instances details
Eq Era Source # 
Instance details

Defined in Test.Consensus.Cardano.ProtocolInfo

Methods

(==) ∷ Era → Era → Bool #

(/=) ∷ Era → Era → Bool #

Ord Era Source # 
Instance details

Defined in Test.Consensus.Cardano.ProtocolInfo

Methods

compare ∷ Era → Era → Ordering #

(<) ∷ Era → Era → Bool #

(<=) ∷ Era → Era → Bool #

(>) ∷ Era → Era → Bool #

(>=) ∷ Era → Era → Bool #

max ∷ Era → Era → Era #

min ∷ Era → Era → Era #

Enum Era Source # 
Instance details

Defined in Test.Consensus.Cardano.ProtocolInfo

Methods

succ ∷ Era → Era #

pred ∷ Era → Era #

toEnum ∷ Int → Era #

fromEnum ∷ Era → Int #

enumFrom ∷ Era → [Era] #

enumFromThen ∷ Era → Era → [Era] #

enumFromTo ∷ Era → Era → [Era] #

enumFromThenTo ∷ Era → Era → Era → [Era] #

Show Era Source # 
Instance details

Defined in Test.Consensus.Cardano.ProtocolInfo

Methods

showsPrec ∷ Int → Era → ShowS #

show ∷ Era → String #

showList ∷ [Era] → ShowS #

hardForkInto ∷ Era → CardanoHardForkTriggers Source #

hardForkOnDefaultProtocolVersions ∷ CardanoHardForkTriggers Source #

ProtocolInfo elaboration

mkSimpleTestProtocolInfo Source #

Arguments

∷ (CardanoHardForkConstraints c, AgentCrypto c) 
⇒ DecentralizationParam

Network decentralization parameter.

→ SecurityParam 
→ ByronSlotLengthInSeconds 
→ ShelleySlotLengthInSeconds 
→ ProtVer 
→ CardanoHardForkTriggers 
→ IO (ProtocolInfo (CardanoBlock c)) 

Create a Cardano protocol info for testing purposes, using some predifined settings (see below). For a more general version see mkTestProtocolInfo.

The resulting ProtocolInfo will use a randomly generated core node. This generation will use a fixed seed. See mkTestProtocolInfo for a function that takes a core node as parameter.

The resulting ProtocolInfo will:

  • Use a NeutralNonce.
  • Use a fixed number of slots per KES evolution.
  • Have version 0 0 0 as Byron protocol version.
  • Use 1 as PbftSignatureThreshold

If you want to tweak the resulting protocol info further see mkTestProtocolInfo.

The resulting ProtocolInfo contains a ledger state. The CardanoHardForkTriggers parameter will determine to which era this ledger state belongs. See hardForkInto and hardForkOnDefaultProtocolVersions for more details on how to specify a value of this type.

mkTestProtocolInfo Source #

Arguments

∷ ∀ m c. (CardanoHardForkConstraints c, KESAgentContext c m) 
⇒ SomeHasFS m 
→ (CoreNodeId, CoreNode c)

Id of the node for which the protocol info will be elaborated.

→ ShelleyGenesis

These nodes will be part of the initial delegation mapping, and funds will be allocated to these nodes.

→ ProtocolVersion

Protocol version of the Byron era proposal.

→ Nonce 
→ Config 
→ GeneratedSecrets 
→ Maybe PBftSignatureThreshold 
→ ProtVer

See protocolInfoCardano for the details of what is the relation between this version and any TriggerHardForkAtVersion that might appear in the CardanoHardForkTriggers parameter.

→ CardanoHardForkTriggers

Specification of the era to which the initial state should hard-fork to.

→ m (ProtocolInfo (CardanoBlock c), Tracer m KESAgentClientTrace → m [MkBlockForging m (CardanoBlock c)]) 

A more generalized version of mkSimpleTestProtocolInfo.