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

Ouroboros.Consensus.ByronDual.Ledger

Synopsis

Shorthand

type DualByronBlock = DualBlock ByronBlock ByronSpecBlock Source #

type DualByronBridge = BridgeLedger ByronBlock ByronSpecBlock Source #

Bridge

data ByronSpecBridge Source #

Bridge the gap between the Byron implementation and specification

The relation between the Byron implementation and specification for the linear case is tested in the Byron implementation itself, specifically in ts_prop_generatedChainsAreValidated. The main goal of the consensus DualByron tests is to lift these tests to the general consensus setting, where time is not linear but branching.

In the linear case, the tests maintain some state linking the spec and the implementation. In the consensus case, this state cannot be maintained like this, and so it has to become part of transactions, blocks, and the ledger state itself.

Constructors

ByronSpecBridge 

Fields

  • toSpecKeys ∷ Map (PBftVerKeyHash PBftByronCrypto) VKey

    Map between keys

    Some observations:

    • The abstract chain environment contains a set of allowed delegators (of type Set VKeyGenesis), which gets translated to gdGenesisKeyHashes (of type Set Common.KeyHash) in the concrete genesis config.
    • During the translation from abstract blocks to concrete blocks, the VKey of the block is translated to a concrete SigningKey (as well as a VerificationKey) in elaborateKeyPair.
    • Although this translation is deterministic, it doesn't have an easily definable inverse. For this reason, we maintain an opposite mapping as part of the ledger state.
  • toImplIds ∷ SpecToImplIds

    Mapping between abstract and concrete Ids

    We need to maintain this mapping so that we can use the abstract state generators and then elaborate to concrete values.

Instances

Instances details
Eq ByronSpecBridge Source # 
Instance details

Defined in Ouroboros.Consensus.ByronDual.Ledger

Generic ByronSpecBridge Source # 
Instance details

Defined in Ouroboros.Consensus.ByronDual.Ledger

Associated Types

type Rep ByronSpecBridge 
Instance details

Defined in Ouroboros.Consensus.ByronDual.Ledger

type Rep ByronSpecBridge = D1 ('MetaData "ByronSpecBridge" "Ouroboros.Consensus.ByronDual.Ledger" "ouroboros-consensus-4.0.0.0-inplace-unstable-byron-testlib" 'False) (C1 ('MetaCons "ByronSpecBridge" 'PrefixI 'True) (S1 ('MetaSel ('Just "toSpecKeys") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map (PBftVerKeyHash PBftByronCrypto) VKey)) :*: S1 ('MetaSel ('Just "toImplIds") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SpecToImplIds)))
Show ByronSpecBridge Source # 
Instance details

Defined in Ouroboros.Consensus.ByronDual.Ledger

Serialise ByronSpecBridge Source # 
Instance details

Defined in Ouroboros.Consensus.ByronDual.Ledger

type Rep ByronSpecBridge Source # 
Instance details

Defined in Ouroboros.Consensus.ByronDual.Ledger

type Rep ByronSpecBridge = D1 ('MetaData "ByronSpecBridge" "Ouroboros.Consensus.ByronDual.Ledger" "ouroboros-consensus-4.0.0.0-inplace-unstable-byron-testlib" 'False) (C1 ('MetaCons "ByronSpecBridge" 'PrefixI 'True) (S1 ('MetaSel ('Just "toSpecKeys") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (Map (PBftVerKeyHash PBftByronCrypto) VKey)) :*: S1 ('MetaSel ('Just "toImplIds") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 SpecToImplIds)))

newtype SpecToImplIds Source #

Constructors

SpecToImplIds 

Fields

Instances

Instances details
Monoid SpecToImplIds Source # 
Instance details

Defined in Ouroboros.Consensus.ByronDual.Ledger

Semigroup SpecToImplIds Source # 
Instance details

Defined in Ouroboros.Consensus.ByronDual.Ledger

Eq SpecToImplIds Source # 
Instance details

Defined in Ouroboros.Consensus.ByronDual.Ledger

Generic SpecToImplIds Source # 
Instance details

Defined in Ouroboros.Consensus.ByronDual.Ledger

Associated Types

type Rep SpecToImplIds 
Instance details

Defined in Ouroboros.Consensus.ByronDual.Ledger

type Rep SpecToImplIds = D1 ('MetaData "SpecToImplIds" "Ouroboros.Consensus.ByronDual.Ledger" "ouroboros-consensus-4.0.0.0-inplace-unstable-byron-testlib" 'True) (C1 ('MetaCons "SpecToImplIds" 'PrefixI 'True) (S1 ('MetaSel ('Just "getSpecToImplIds") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 AbstractToConcreteIdMaps)))
Show SpecToImplIds Source # 
Instance details

Defined in Ouroboros.Consensus.ByronDual.Ledger

Serialise SpecToImplIds Source # 
Instance details

Defined in Ouroboros.Consensus.ByronDual.Ledger

type Rep SpecToImplIds Source # 
Instance details

Defined in Ouroboros.Consensus.ByronDual.Ledger

type Rep SpecToImplIds = D1 ('MetaData "SpecToImplIds" "Ouroboros.Consensus.ByronDual.Ledger" "ouroboros-consensus-4.0.0.0-inplace-unstable-byron-testlib" 'True) (C1 ('MetaCons "SpecToImplIds" 'PrefixI 'True) (S1 ('MetaSel ('Just "getSpecToImplIds") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 AbstractToConcreteIdMaps)))

bridgeToSpecKey ∷ DualByronBridge → PBftVerKeyHash PBftByronCrypto → VKey Source #

Translate issuer key

We get a proof from PBFT that we are the leader, including a signing key (of type SigningKey). In order to produce the corresponding abstract block, we need a VKey.

initByronSpecBridge Source #

Arguments

∷ ByronSpecGenesis 
→ Map TxId TxId

Mapping for the transaction in the initial UTxO

→ ByronSpecBridge 

specToImplTx ∷ Tx → ATxAux ByteString → SpecToImplIds Source #

Construct singleton SpecToImplIds for a transaction

Block forging

Orphan instances

Bridge ByronBlock ByronSpecBlock Source # 
Instance details

Associated Types

type BridgeLedger ByronBlock ByronSpecBlock 
Instance details

Defined in Ouroboros.Consensus.ByronDual.Ledger

type BridgeLedger ByronBlock ByronSpecBlock = ByronSpecBridge
type BridgeBlock ByronBlock ByronSpecBlock 
Instance details

Defined in Ouroboros.Consensus.ByronDual.Ledger

type BridgeBlock ByronBlock ByronSpecBlock = SpecToImplIds
type BridgeTx ByronBlock ByronSpecBlock 
Instance details

Defined in Ouroboros.Consensus.ByronDual.Ledger

type BridgeTx ByronBlock ByronSpecBlock = SpecToImplIds

Methods

updateBridgeWithBlock ∷ DualBlock ByronBlock ByronSpecBlock → BridgeLedger ByronBlock ByronSpecBlock → BridgeLedger ByronBlock ByronSpecBlock Source #

updateBridgeWithTx ∷ Validated (GenTx (DualBlock ByronBlock ByronSpecBlock)) → BridgeLedger ByronBlock ByronSpecBlock → BridgeLedger ByronBlock ByronSpecBlock Source #