ouroboros-consensus-shelley-test-0.1.0.0: Test infrastructure for Shelley
Safe HaskellNone
LanguageHaskell2010

Test.Consensus.Shelley.Generators

Synopsis

Documentation

data SomeResult blk where Source #

To easily generate all the possible results of the Query GADT, we introduce an existential that also bundles the corresponding Query as evidence. We also capture Eq, Show, and Typeable constraints, as we need them in the tests.

Constructors

SomeResult ∷ ∀ result blk. (Eq result, Show result, Typeable result) ⇒ BlockQuery blk result → result → SomeResult blk 

Instances

Instances details
Eq (SomeResult blk) 
Instance details

Defined in Test.Util.Serialisation.Roundtrip

Methods

(==)SomeResult blk → SomeResult blk → Bool Source #

(/=)SomeResult blk → SomeResult blk → Bool Source #

Show (SomeResult blk) 
Instance details

Defined in Test.Util.Serialisation.Roundtrip

Methods

showsPrecIntSomeResult blk → ShowS Source #

showSomeResult blk → String Source #

showList ∷ [SomeResult blk] → ShowS Source #

CanMock proto era ⇒ Arbitrary (SomeResult (ShelleyBlock proto era)) 
Instance details

Defined in Test.Consensus.Shelley.Generators

Methods

arbitrary ∷ Gen (SomeResult (ShelleyBlock proto era))

shrinkSomeResult (ShelleyBlock proto era) → [SomeResult (ShelleyBlock proto era)]

Orphan instances

Arbitrary ShelleyTransition Source # 
Instance details

Arbitrary ShelleyNodeToNodeVersion Source # 
Instance details

Arbitrary ShelleyNodeToClientVersion Source # 
Instance details

CanMock proto era ⇒ Arbitrary (AnnTip (ShelleyBlock proto era)) Source # 
Instance details

Methods

arbitrary ∷ Gen (AnnTip (ShelleyBlock proto era))

shrinkAnnTip (ShelleyBlock proto era) → [AnnTip (ShelleyBlock proto era)]

CanMock proto era ⇒ Arbitrary (GenTx (ShelleyBlock proto era)) Source # 
Instance details

Methods

arbitrary ∷ Gen (GenTx (ShelleyBlock proto era))

shrinkGenTx (ShelleyBlock proto era) → [GenTx (ShelleyBlock proto era)]

CanMock proto era ⇒ Arbitrary (GenTxId (ShelleyBlock proto era)) Source # 
Instance details

Methods

arbitrary ∷ Gen (GenTxId (ShelleyBlock proto era))

shrinkGenTxId (ShelleyBlock proto era) → [GenTxId (ShelleyBlock proto era)]

CanMock proto era ⇒ Arbitrary (LedgerState (ShelleyBlock proto era)) Source # 
Instance details

Methods

arbitrary ∷ Gen (LedgerState (ShelleyBlock proto era))

shrinkLedgerState (ShelleyBlock proto era) → [LedgerState (ShelleyBlock proto era)]

(CanMock (Praos crypto) era, crypto ~ EraCrypto era) ⇒ Arbitrary (Header (ShelleyBlock (Praos crypto) era)) Source # 
Instance details

Methods

arbitrary ∷ Gen (Header (ShelleyBlock (Praos crypto) era))

shrinkHeader (ShelleyBlock (Praos crypto) era) → [Header (ShelleyBlock (Praos crypto) era)]

(CanMock (TPraos crypto) era, crypto ~ EraCrypto era) ⇒ Arbitrary (Header (ShelleyBlock (TPraos crypto) era)) Source # 
Instance details

Methods

arbitrary ∷ Gen (Header (ShelleyBlock (TPraos crypto) era))

shrinkHeader (ShelleyBlock (TPraos crypto) era) → [Header (ShelleyBlock (TPraos crypto) era)]

CanMock proto era ⇒ Arbitrary (Point (ShelleyBlock proto era)) Source # 
Instance details

Methods

arbitrary ∷ Gen (Point (ShelleyBlock proto era))

shrinkPoint (ShelleyBlock proto era) → [Point (ShelleyBlock proto era)]

PraosCrypto c ⇒ Arbitrary (TPraosState c) Source # 
Instance details

Methods

arbitrary ∷ Gen (TPraosState c)

shrinkTPraosState c → [TPraosState c]

PraosCrypto c ⇒ Arbitrary (NonMyopicMemberRewards c) Source # 
Instance details

Mock c ⇒ Arbitrary (ShelleyHash c) Source # 
Instance details

Methods

arbitrary ∷ Gen (ShelleyHash c)

shrinkShelleyHash c → [ShelleyHash c]

(CanMock (Praos crypto) era, crypto ~ EraCrypto era) ⇒ Arbitrary (Coherent (ShelleyBlock (Praos crypto) era)) Source #

Create a coherent Praos block

TODO Establish a coherent block without doing this translation from a TPraos header.

Instance details

Methods

arbitrary ∷ Gen (Coherent (ShelleyBlock (Praos crypto) era))

shrinkCoherent (ShelleyBlock (Praos crypto) era) → [Coherent (ShelleyBlock (Praos crypto) era)]

(CanMock (TPraos crypto) era, crypto ~ EraCrypto era) ⇒ Arbitrary (Coherent (ShelleyBlock (TPraos crypto) era)) Source #

This uses a different upstream generator to ensure the header and block body relate as expected.

Instance details

Methods

arbitrary ∷ Gen (Coherent (ShelleyBlock (TPraos crypto) era))

shrinkCoherent (ShelleyBlock (TPraos crypto) era) → [Coherent (ShelleyBlock (TPraos crypto) era)]

CanMock proto era ⇒ Arbitrary (SomeResult (ShelleyBlock proto era)) Source # 
Instance details

Methods

arbitrary ∷ Gen (SomeResult (ShelleyBlock proto era))

shrinkSomeResult (ShelleyBlock proto era) → [SomeResult (ShelleyBlock proto era)]

PraosCrypto c ⇒ Arbitrary (ChainDepState c) Source # 
Instance details

Methods

arbitrary ∷ Gen (ChainDepState c)

shrink ∷ ChainDepState c → [ChainDepState c]

CanMock proto era ⇒ Arbitrary (SomeSecond BlockQuery (ShelleyBlock proto era)) Source # 
Instance details

ShelleyBasedEra era ⇒ Arbitrary (SomeSecond (NestedCtxt f) (ShelleyBlock proto era)) Source # 
Instance details

Methods

arbitrary ∷ Gen (SomeSecond (NestedCtxt f) (ShelleyBlock proto era))

shrinkSomeSecond (NestedCtxt f) (ShelleyBlock proto era) → [SomeSecond (NestedCtxt f) (ShelleyBlock proto era)]

CanMock proto era ⇒ Arbitrary (ShelleyTip proto era) Source # 
Instance details

Methods

arbitrary ∷ Gen (ShelleyTip proto era)

shrinkShelleyTip proto era → [ShelleyTip proto era]

(PraosCrypto crypto, CanMock (Praos crypto) era, crypto ~ EraCrypto era) ⇒ Arbitrary (ShelleyBlock (Praos crypto) era) Source # 
Instance details

Methods

arbitrary ∷ Gen (ShelleyBlock (Praos crypto) era)

shrinkShelleyBlock (Praos crypto) era → [ShelleyBlock (Praos crypto) era]

(CanMock (TPraos crypto) era, crypto ~ EraCrypto era) ⇒ Arbitrary (ShelleyBlock (TPraos crypto) era) Source #

The upstream Arbitrary instance for Shelley blocks does not generate coherent blocks, so neither does this.

Instance details

Methods

arbitrary ∷ Gen (ShelleyBlock (TPraos crypto) era)

shrinkShelleyBlock (TPraos crypto) era → [ShelleyBlock (TPraos crypto) era]

CanMock proto era ⇒ Arbitrary (WithVersion ShelleyNodeToClientVersion (SomeSecond BlockQuery (ShelleyBlock proto era))) Source #

Some Querys are only supported by ShelleyNodeToClientVersion2, so we make sure to not generate those queries in combination with ShelleyNodeToClientVersion1.

Instance details

Arbitrary (PParams' StrictMaybe era) Source # 
Instance details

Methods

arbitrary ∷ Gen (PParams' StrictMaybe era)

shrink ∷ PParams' StrictMaybe era → [PParams' StrictMaybe era]