storage-test
Safe HaskellSafe-Inferred
LanguageHaskell2010

Test.Ouroboros.Storage.ChainDB.StateMachine

Description

Main tests for the chain DB.

These are the main tests for the chain DB. Commands include

  • Add a block
  • Add a block with a SlotNo that is ahead of the wall-clock.
  • Get the current chain and/or ledger state
  • Create a new iterator and use it to stream blocks
  • Create a new follower and use it to follow the chain
  • (Limited) disk corruption (the chain DB relies on the immutable DB and volatile DB for the storage proper and they have extensive disk corruption tests, so we don't need to repeat that here).
Synopsis

Commands

newtype At t blk m r Source #

Instantiate functor t blk to t blk (IterRef blk m r) (FollowerRef blk m r).

Needed because we need to (partially) apply At t blk flr m to r.

Constructors

At 

Fields

Instances

Instances details
Bifoldable (t blk) ⇒ Foldable (At t blk m ∷ (TypeType) → Type) Source # 
Instance details

Defined in Test.Ouroboros.Storage.ChainDB.StateMachine

Methods

foldMapMonoid m0 ⇒ (∀ (x ∷ k). p x → m0) → At t blk m p → m0 Source #

Bifunctor (t blk) ⇒ Functor (At t blk m ∷ (TypeType) → Type) Source # 
Instance details

Defined in Test.Ouroboros.Storage.ChainDB.StateMachine

Methods

fmap ∷ (∀ (x ∷ k). p x → q x) → At t blk m p → At t blk m q Source #

Bitraversable (t blk) ⇒ Traversable (At t blk m ∷ (TypeType) → Type) Source # 
Instance details

Defined in Test.Ouroboros.Storage.ChainDB.StateMachine

Methods

traverseApplicative f ⇒ (∀ (a ∷ k). p a → f (q a)) → At t blk m p → f (At t blk m q) Source #

CommandNames (At Cmd blk m ∷ (TypeType) → Type) Source # 
Instance details

Defined in Test.Ouroboros.Storage.ChainDB.StateMachine

Methods

cmdName ∷ ∀ (r ∷ k). At Cmd blk m r → String Source #

cmdNames ∷ ∀ (r ∷ k). Proxy (At Cmd blk m r) → [String] Source #

Generic (At t blk m r) Source # 
Instance details

Defined in Test.Ouroboros.Storage.ChainDB.StateMachine

Associated Types

type Rep (At t blk m r) ∷ TypeType #

Methods

fromAt t blk m r → Rep (At t blk m r) x #

toRep (At t blk m r) x → At t blk m r #

Show (t blk (IterRef blk m r) (FollowerRef blk m r)) ⇒ Show (At t blk m r) Source # 
Instance details

Defined in Test.Ouroboros.Storage.ChainDB.StateMachine

Methods

showsPrecIntAt t blk m r → ShowS #

showAt t blk m r → String #

showList ∷ [At t blk m r] → ShowS #

(TestConstraints blk, Eq1 r) ⇒ Eq (At Resp blk m r) Source # 
Instance details

Defined in Test.Ouroboros.Storage.ChainDB.StateMachine

Methods

(==)At Resp blk m r → At Resp blk m r → Bool #

(/=)At Resp blk m r → At Resp blk m r → Bool #

type Rep (At t blk m r) Source # 
Instance details

Defined in Test.Ouroboros.Storage.ChainDB.StateMachine

type Rep (At t blk m r) = D1 ('MetaData "At" "Test.Ouroboros.Storage.ChainDB.StateMachine" "ouroboros-consensus-0.21.0.0-inplace-storage-test" 'True) (C1 ('MetaCons "At" 'PrefixI 'True) (S1 ('MetaSel ('Just "unAt") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (t blk (IterRef blk m r) (FollowerRef blk m r)))))

data Cmd blk it flr Source #

Commands

Constructors

AddBlock blk

Advance the current slot to the block's slot (unless smaller than the current slot), add the block and run chain selection.

GetCurrentChain 
GetLedgerDB 
GetTipBlock 
GetTipHeader 
GetTipPoint 
GetBlockComponent (RealPoint blk) 
GetGCedBlockComponent (RealPoint blk)

Only for blocks that may have been garbage collected.

GetMaxSlotNo 
GetIsValid (RealPoint blk) 
Stream (StreamFrom blk) (StreamTo blk) 
UpdateLoE (AnchoredFragment blk)

Update the LoE fragment and run chain selection.

IteratorNext it 
IteratorNextGCed it

Only for blocks that may have been garbage collected.

IteratorClose it 
NewFollower ChainType 
FollowerInstruction flr

followerInstructionBlocking is excluded, as it requires multiple threads. Its code path is pretty much the same as followerInstruction anyway.

FollowerForward flr [Point blk] 
FollowerClose flr 
Close 
Reopen 
PersistBlks

Copy the blocks older than k from the Volatile DB to the Immutable DB.

PersistBlksThenGC

Copy the blocks older than k from the Volatile DB to the Immutable DB and then perform garbage colllection.

The garbage collection procedure of the Chain DB (our system under test) removes the blocks from the volatile DB without caring about whether the removed blocks were persisted. Therefore, this part of the Chain DB logic assumes that copy to the immutable DB took place before garbage collection. The model uses this assumption as well. As a result, we cannot perform garbage collection in isolation, since this will break the model's invariant.

UpdateLedgerSnapshots

Write a new Success snapshot to disk and remove the oldest ones.

WipeVolatileDB 

Instances

Instances details
Bifoldable (Cmd blk) Source # 
Instance details

Defined in Test.Ouroboros.Storage.ChainDB.StateMachine

Methods

bifoldMonoid m ⇒ Cmd blk m m → m #

bifoldMapMonoid m ⇒ (a → m) → (b → m) → Cmd blk a b → m #

bifoldr ∷ (a → c → c) → (b → c → c) → c → Cmd blk a b → c #

bifoldl ∷ (c → a → c) → (c → b → c) → c → Cmd blk a b → c #

Bifunctor (Cmd blk) Source # 
Instance details

Defined in Test.Ouroboros.Storage.ChainDB.StateMachine

Methods

bimap ∷ (a → b) → (c → d) → Cmd blk a c → Cmd blk b d #

first ∷ (a → b) → Cmd blk a c → Cmd blk b c #

second ∷ (b → c) → Cmd blk a b → Cmd blk a c #

Bitraversable (Cmd blk) Source # 
Instance details

Defined in Test.Ouroboros.Storage.ChainDB.StateMachine

Methods

bitraverseApplicative f ⇒ (a → f c) → (b → f d) → Cmd blk a b → f (Cmd blk c d) #

Foldable (Cmd blk it) Source # 
Instance details

Defined in Test.Ouroboros.Storage.ChainDB.StateMachine

Methods

foldMonoid m ⇒ Cmd blk it m → m #

foldMapMonoid m ⇒ (a → m) → Cmd blk it a → m #

foldMap'Monoid m ⇒ (a → m) → Cmd blk it a → m #

foldr ∷ (a → b → b) → b → Cmd blk it a → b #

foldr' ∷ (a → b → b) → b → Cmd blk it a → b #

foldl ∷ (b → a → b) → b → Cmd blk it a → b #

foldl' ∷ (b → a → b) → b → Cmd blk it a → b #

foldr1 ∷ (a → a → a) → Cmd blk it a → a #

foldl1 ∷ (a → a → a) → Cmd blk it a → a #

toListCmd blk it a → [a] #

nullCmd blk it a → Bool #

lengthCmd blk it a → Int #

elemEq a ⇒ a → Cmd blk it a → Bool #

maximumOrd a ⇒ Cmd blk it a → a #

minimumOrd a ⇒ Cmd blk it a → a #

sumNum a ⇒ Cmd blk it a → a #

productNum a ⇒ Cmd blk it a → a #

Traversable (Cmd blk it) Source # 
Instance details

Defined in Test.Ouroboros.Storage.ChainDB.StateMachine

Methods

traverseApplicative f ⇒ (a → f b) → Cmd blk it a → f (Cmd blk it b) #

sequenceAApplicative f ⇒ Cmd blk it (f a) → f (Cmd blk it a) #

mapMMonad m ⇒ (a → m b) → Cmd blk it a → m (Cmd blk it b) #

sequenceMonad m ⇒ Cmd blk it (m a) → m (Cmd blk it a) #

Functor (Cmd blk it) Source # 
Instance details

Defined in Test.Ouroboros.Storage.ChainDB.StateMachine

Methods

fmap ∷ (a → b) → Cmd blk it a → Cmd blk it b #

(<$) ∷ a → Cmd blk it b → Cmd blk it a #

CommandNames (At Cmd blk m ∷ (TypeType) → Type) Source # 
Instance details

Defined in Test.Ouroboros.Storage.ChainDB.StateMachine

Methods

cmdName ∷ ∀ (r ∷ k). At Cmd blk m r → String Source #

cmdNames ∷ ∀ (r ∷ k). Proxy (At Cmd blk m r) → [String] Source #

Generic (Cmd blk it flr) Source # 
Instance details

Defined in Test.Ouroboros.Storage.ChainDB.StateMachine

Associated Types

type Rep (Cmd blk it flr) ∷ TypeType #

Methods

fromCmd blk it flr → Rep (Cmd blk it flr) x #

toRep (Cmd blk it flr) x → Cmd blk it flr #

(StandardHash blk, Show blk, Show it, Show flr) ⇒ Show (Cmd blk it flr) Source # 
Instance details

Defined in Test.Ouroboros.Storage.ChainDB.StateMachine

Methods

showsPrecIntCmd blk it flr → ShowS #

showCmd blk it flr → String #

showList ∷ [Cmd blk it flr] → ShowS #

Generic (Cmd blk it flr) Source # 
Instance details

Defined in Test.Ouroboros.Storage.ChainDB.StateMachine

Associated Types

type Code (Cmd blk it flr) ∷ [[Type]] Source #

Methods

fromCmd blk it flr → Rep (Cmd blk it flr) Source #

toRep (Cmd blk it flr) → Cmd blk it flr Source #

HasDatatypeInfo (Cmd blk it flr) Source # 
Instance details

Defined in Test.Ouroboros.Storage.ChainDB.StateMachine

Associated Types

type DatatypeInfoOf (Cmd blk it flr) ∷ DatatypeInfo Source #

Methods

datatypeInfo ∷ proxy (Cmd blk it flr) → DatatypeInfo (Code (Cmd blk it flr)) Source #

type Rep (Cmd blk it flr) Source # 
Instance details

Defined in Test.Ouroboros.Storage.ChainDB.StateMachine

type Rep (Cmd blk it flr) = D1 ('MetaData "Cmd" "Test.Ouroboros.Storage.ChainDB.StateMachine" "ouroboros-consensus-0.21.0.0-inplace-storage-test" 'False) ((((C1 ('MetaCons "AddBlock" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 blk)) :+: (C1 ('MetaCons "GetCurrentChain" 'PrefixI 'False) (U1TypeType) :+: C1 ('MetaCons "GetLedgerDB" 'PrefixI 'False) (U1TypeType))) :+: (C1 ('MetaCons "GetTipBlock" 'PrefixI 'False) (U1TypeType) :+: (C1 ('MetaCons "GetTipHeader" 'PrefixI 'False) (U1TypeType) :+: C1 ('MetaCons "GetTipPoint" 'PrefixI 'False) (U1TypeType)))) :+: ((C1 ('MetaCons "GetBlockComponent" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (RealPoint blk))) :+: (C1 ('MetaCons "GetGCedBlockComponent" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (RealPoint blk))) :+: C1 ('MetaCons "GetMaxSlotNo" 'PrefixI 'False) (U1TypeType))) :+: (C1 ('MetaCons "GetIsValid" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (RealPoint blk))) :+: (C1 ('MetaCons "Stream" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (StreamFrom blk)) :*: S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (StreamTo blk))) :+: C1 ('MetaCons "UpdateLoE" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 (AnchoredFragment blk))))))) :+: (((C1 ('MetaCons "IteratorNext" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 it)) :+: (C1 ('MetaCons "IteratorNextGCed" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 it)) :+: C1 ('MetaCons "IteratorClose" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 it)))) :+: (C1 ('MetaCons "NewFollower" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 ChainType)) :+: (C1 ('MetaCons "FollowerInstruction" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 flr)) :+: C1 ('MetaCons "FollowerForward" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 flr) :*: S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Point blk]))))) :+: ((C1 ('MetaCons "FollowerClose" 'PrefixI 'False) (S1 ('MetaSel ('NothingMaybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 flr)) :+: (C1 ('MetaCons "Close" 'PrefixI 'False) (U1TypeType) :+: C1 ('MetaCons "Reopen" 'PrefixI 'False) (U1TypeType))) :+: ((C1 ('MetaCons "PersistBlks" 'PrefixI 'False) (U1TypeType) :+: C1 ('MetaCons "PersistBlksThenGC" 'PrefixI 'False) (U1TypeType)) :+: (C1 ('MetaCons "UpdateLedgerSnapshots" 'PrefixI 'False) (U1TypeType) :+: C1 ('MetaCons "WipeVolatileDB" 'PrefixI 'False) (U1TypeType))))))
type Code (Cmd blk it flr) Source # 
Instance details

Defined in Test.Ouroboros.Storage.ChainDB.StateMachine

type Code (Cmd blk it flr) = GCode (Cmd blk it flr)
type DatatypeInfoOf (Cmd blk it flr) Source # 
Instance details

Defined in Test.Ouroboros.Storage.ChainDB.StateMachine

type DatatypeInfoOf (Cmd blk it flr) = GDatatypeInfoOf (Cmd blk it flr)

type FollowerRef blk m r = Reference (Opaque (TestFollower m blk)) r Source #

Concrete or symbolic references to a real follower

type IterRef blk m r = Reference (Opaque (TestIterator m blk)) r Source #

Concrete or symbolic references to a real iterator

data IteratorResult blk b Source #

Constructors

IteratorExhausted 
IteratorResult b 
IteratorBlockGCed (RealPoint blk)

The block that was supposed to be streamed was garbage-collected from the VolatileDB, but not added to the ImmutableDB.

This will only happen when streaming very old forks very slowly.

The following example illustrates a situation in which an iterator result could be a IteratorBlockGCed value. Suppose we start with an iterator positioned at block c, where [[ x ]] denotes a block in the immutable DB:

                          iterator i
                            ↓
... ⟶ [[ a ]] → [[ b ]] → [ c ] -> [ d ]
──────────────────────╯   ╰────────────╯
  Immutable DB             Current chain

Suppose we switch to a longer fork that branches off from the immutable tip ('[[b]]').

                           iterator i
                            ↓
... ⟶ [[ a ]] → [[ b ]] → [ c ] -> [ d ]
──────────────────────╯│
   Immutable DB        │
                       ╰-→ [ e ] -> [ f ] -> [ g ]
                           ╰─────────────────────╯
                                 Current chain

Assume k=2. This means that block e is the new immutable tip. If we would call iteratorNext on i after block e is copied to the immutable DB and c and d are garbage collected, then we will get IteratorBlockGCed.

Instances

Instances details
Foldable (IteratorResult blk) 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.API

Methods

foldMonoid m ⇒ IteratorResult blk m → m #

foldMapMonoid m ⇒ (a → m) → IteratorResult blk a → m #

foldMap'Monoid m ⇒ (a → m) → IteratorResult blk a → m #

foldr ∷ (a → b → b) → b → IteratorResult blk a → b #

foldr' ∷ (a → b → b) → b → IteratorResult blk a → b #

foldl ∷ (b → a → b) → b → IteratorResult blk a → b #

foldl' ∷ (b → a → b) → b → IteratorResult blk a → b #

foldr1 ∷ (a → a → a) → IteratorResult blk a → a #

foldl1 ∷ (a → a → a) → IteratorResult blk a → a #

toListIteratorResult blk a → [a] #

nullIteratorResult blk a → Bool #

lengthIteratorResult blk a → Int #

elemEq a ⇒ a → IteratorResult blk a → Bool #

maximumOrd a ⇒ IteratorResult blk a → a #

minimumOrd a ⇒ IteratorResult blk a → a #

sumNum a ⇒ IteratorResult blk a → a #

productNum a ⇒ IteratorResult blk a → a #

Traversable (IteratorResult blk) 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.API

Methods

traverseApplicative f ⇒ (a → f b) → IteratorResult blk a → f (IteratorResult blk b) #

sequenceAApplicative f ⇒ IteratorResult blk (f a) → f (IteratorResult blk a) #

mapMMonad m ⇒ (a → m b) → IteratorResult blk a → m (IteratorResult blk b) #

sequenceMonad m ⇒ IteratorResult blk (m a) → m (IteratorResult blk a) #

Functor (IteratorResult blk) 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.API

Methods

fmap ∷ (a → b) → IteratorResult blk a → IteratorResult blk b #

(<$) ∷ a → IteratorResult blk b → IteratorResult blk a #

(Show blk, Show b, StandardHash blk) ⇒ Show (IteratorResult blk b) 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.API

Methods

showsPrecIntIteratorResult blk b → ShowS #

showIteratorResult blk b → String #

showList ∷ [IteratorResult blk b] → ShowS #

(Eq blk, Eq b, StandardHash blk) ⇒ Eq (IteratorResult blk b) 
Instance details

Defined in Ouroboros.Consensus.Storage.ChainDB.API

Methods

(==)IteratorResult blk b → IteratorResult blk b → Bool #

(/=)IteratorResult blk b → IteratorResult blk b → Bool #

data IteratorResultGCed blk Source #

Similar to MaybeGCedBlock, but for the block returned by iteratorNext. A garbage-collected block could result in IteratorBlockGCed instead of IteratorResult.

Constructors

IteratorResultGCed 

Fields

Instances

Instances details
(Show blk, Show (Header blk), StandardHash blk, HasNestedContent Header blk) ⇒ Show (IteratorResultGCed blk) Source # 
Instance details

Defined in Test.Ouroboros.Storage.ChainDB.StateMachine

(Eq blk, Eq (Header blk), StandardHash blk, HasNestedContent Header blk) ⇒ Eq (IteratorResultGCed blk) Source # 
Instance details

Defined in Test.Ouroboros.Storage.ChainDB.StateMachine

Responses

newtype Resp blk it flr Source #

Responses are either successful termination or an error.

Constructors

Resp 

Fields

Instances

Instances details
Bifoldable (Resp blk) Source # 
Instance details

Defined in Test.Ouroboros.Storage.ChainDB.StateMachine

Methods

bifoldMonoid m ⇒ Resp blk m m → m #

bifoldMapMonoid m ⇒ (a → m) → (b → m) → Resp blk a b → m #

bifoldr ∷ (a → c → c) → (b → c → c) → c → Resp blk a b → c #

bifoldl ∷ (c → a → c) → (c → b → c) → c → Resp blk a b → c #

Bifunctor (Resp blk) Source # 
Instance details

Defined in Test.Ouroboros.Storage.ChainDB.StateMachine

Methods

bimap ∷ (a → b) → (c → d) → Resp blk a c → Resp blk b d #

first ∷ (a → b) → Resp blk a c → Resp blk b c #

second ∷ (b → c) → Resp blk a b → Resp blk a c #

Bitraversable (Resp blk) Source # 
Instance details

Defined in Test.Ouroboros.Storage.ChainDB.StateMachine

Methods

bitraverseApplicative f ⇒ (a → f c) → (b → f d) → Resp blk a b → f (Resp blk c d) #

Foldable (Resp blk it) Source # 
Instance details

Defined in Test.Ouroboros.Storage.ChainDB.StateMachine

Methods

foldMonoid m ⇒ Resp blk it m → m #

foldMapMonoid m ⇒ (a → m) → Resp blk it a → m #

foldMap'Monoid m ⇒ (a → m) → Resp blk it a → m #

foldr ∷ (a → b → b) → b → Resp blk it a → b #

foldr' ∷ (a → b → b) → b → Resp blk it a → b #

foldl ∷ (b → a → b) → b → Resp blk it a → b #

foldl' ∷ (b → a → b) → b → Resp blk it a → b #

foldr1 ∷ (a → a → a) → Resp blk it a → a #

foldl1 ∷ (a → a → a) → Resp blk it a → a #

toListResp blk it a → [a] #

nullResp blk it a → Bool #

lengthResp blk it a → Int #

elemEq a ⇒ a → Resp blk it a → Bool #

maximumOrd a ⇒ Resp blk it a → a #

minimumOrd a ⇒ Resp blk it a → a #

sumNum a ⇒ Resp blk it a → a #

productNum a ⇒ Resp blk it a → a #

Traversable (Resp blk it) Source # 
Instance details

Defined in Test.Ouroboros.Storage.ChainDB.StateMachine

Methods

traverseApplicative f ⇒ (a → f b) → Resp blk it a → f (Resp blk it b) #

sequenceAApplicative f ⇒ Resp blk it (f a) → f (Resp blk it a) #

mapMMonad m ⇒ (a → m b) → Resp blk it a → m (Resp blk it b) #

sequenceMonad m ⇒ Resp blk it (m a) → m (Resp blk it a) #

Functor (Resp blk it) Source # 
Instance details

Defined in Test.Ouroboros.Storage.ChainDB.StateMachine

Methods

fmap ∷ (a → b) → Resp blk it a → Resp blk it b #

(<$) ∷ a → Resp blk it b → Resp blk it a #

(TestConstraints blk, Show it, Show flr) ⇒ Show (Resp blk it flr) Source # 
Instance details

Defined in Test.Ouroboros.Storage.ChainDB.StateMachine

Methods

showsPrecIntResp blk it flr → ShowS #

showResp blk it flr → String #

showList ∷ [Resp blk it flr] → ShowS #

(TestConstraints blk, Eq it, Eq flr) ⇒ Eq (Resp blk it flr) Source # 
Instance details

Defined in Test.Ouroboros.Storage.ChainDB.StateMachine

Methods

(==)Resp blk it flr → Resp blk it flr → Bool #

(/=)Resp blk it flr → Resp blk it flr → Bool #

(TestConstraints blk, Eq1 r) ⇒ Eq (At Resp blk m r) Source # 
Instance details

Defined in Test.Ouroboros.Storage.ChainDB.StateMachine

Methods

(==)At Resp blk m r → At Resp blk m r → Bool #

(/=)At Resp blk m r → At Resp blk m r → Bool #

data Success blk it flr Source #

Return type for successful database operations.

Instances

Instances details
Bifoldable (Success blk) Source # 
Instance details

Defined in Test.Ouroboros.Storage.ChainDB.StateMachine

Methods

bifoldMonoid m ⇒ Success blk m m → m #

bifoldMapMonoid m ⇒ (a → m) → (b → m) → Success blk a b → m #

bifoldr ∷ (a → c → c) → (b → c → c) → c → Success blk a b → c #

bifoldl ∷ (c → a → c) → (c → b → c) → c → Success blk a b → c #

Bifunctor (Success blk) Source # 
Instance details

Defined in Test.Ouroboros.Storage.ChainDB.StateMachine

Methods

bimap ∷ (a → b) → (c → d) → Success blk a c → Success blk b d #

first ∷ (a → b) → Success blk a c → Success blk b c #

second ∷ (b → c) → Success blk a b → Success blk a c #

Bitraversable (Success blk) Source # 
Instance details

Defined in Test.Ouroboros.Storage.ChainDB.StateMachine

Methods

bitraverseApplicative f ⇒ (a → f c) → (b → f d) → Success blk a b → f (Success blk c d) #

Foldable (Success blk it) Source # 
Instance details

Defined in Test.Ouroboros.Storage.ChainDB.StateMachine

Methods

foldMonoid m ⇒ Success blk it m → m #

foldMapMonoid m ⇒ (a → m) → Success blk it a → m #

foldMap'Monoid m ⇒ (a → m) → Success blk it a → m #

foldr ∷ (a → b → b) → b → Success blk it a → b #

foldr' ∷ (a → b → b) → b → Success blk it a → b #

foldl ∷ (b → a → b) → b → Success blk it a → b #

foldl' ∷ (b → a → b) → b → Success blk it a → b #

foldr1 ∷ (a → a → a) → Success blk it a → a #

foldl1 ∷ (a → a → a) → Success blk it a → a #

toListSuccess blk it a → [a] #

nullSuccess blk it a → Bool #

lengthSuccess blk it a → Int #

elemEq a ⇒ a → Success blk it a → Bool #

maximumOrd a ⇒ Success blk it a → a #

minimumOrd a ⇒ Success blk it a → a #

sumNum a ⇒ Success blk it a → a #

productNum a ⇒ Success blk it a → a #

Traversable (Success blk it) Source # 
Instance details

Defined in Test.Ouroboros.Storage.ChainDB.StateMachine

Methods

traverseApplicative f ⇒ (a → f b) → Success blk it a → f (Success blk it b) #

sequenceAApplicative f ⇒ Success blk it (f a) → f (Success blk it a) #

mapMMonad m ⇒ (a → m b) → Success blk it a → m (Success blk it b) #

sequenceMonad m ⇒ Success blk it (m a) → m (Success blk it a) #

Functor (Success blk it) Source # 
Instance details

Defined in Test.Ouroboros.Storage.ChainDB.StateMachine

Methods

fmap ∷ (a → b) → Success blk it a → Success blk it b #

(<$) ∷ a → Success blk it b → Success blk it a #

(TestConstraints blk, Show it, Show flr) ⇒ Show (Success blk it flr) Source # 
Instance details

Defined in Test.Ouroboros.Storage.ChainDB.StateMachine

Methods

showsPrecIntSuccess blk it flr → ShowS #

showSuccess blk it flr → String #

showList ∷ [Success blk it flr] → ShowS #

(TestConstraints blk, Eq it, Eq flr) ⇒ Eq (Success blk it flr) Source # 
Instance details

Defined in Test.Ouroboros.Storage.ChainDB.StateMachine

Methods

(==)Success blk it flr → Success blk it flr → Bool #

(/=)Success blk it flr → Success blk it flr → Bool #

Model

data Model blk m r Source #

Execution model

Instances

Instances details
Generic (Model blk m r) Source # 
Instance details

Defined in Test.Ouroboros.Storage.ChainDB.StateMachine

Associated Types

type Rep (Model blk m r) ∷ TypeType #

Methods

fromModel blk m r → Rep (Model blk m r) x #

toRep (Model blk m r) x → Model blk m r #

(TestConstraints blk, Show1 r) ⇒ Show (Model blk m r) Source # 
Instance details

Defined in Test.Ouroboros.Storage.ChainDB.StateMachine

Methods

showsPrecIntModel blk m r → ShowS #

showModel blk m r → String #

showList ∷ [Model blk m r] → ShowS #

(ToExpr blk, ToExpr (HeaderHash blk), ToExpr (ChainDepState (BlockProtocol blk)), ToExpr (TipInfo blk), ToExpr (LedgerState blk), ToExpr (ExtValidationError blk)) ⇒ ToExpr (Model blk IO Concrete) Source # 
Instance details

Defined in Test.Ouroboros.Storage.ChainDB.StateMachine

type Rep (Model blk m r) Source # 
Instance details

Defined in Test.Ouroboros.Storage.ChainDB.StateMachine

type Rep (Model blk m r)

Running the model

System under test

data ChainDBEnv m blk Source #

Environment to run commands against the real ChainDB implementation.

Constructors

ChainDBEnv 

Fields

data ChainDBState m blk Source #

The current ChainDB instance and things related to it.

When closing and reopening the ChainDB, this record will be replaced in the $sel:varDB:ChainDBEnv field of ChainDBEnv with a new one.

Constructors

ChainDBState 

Fields

Instances

Instances details
NoThunks (ChainDBState m blk) Source # 
Instance details

Defined in Test.Ouroboros.Storage.ChainDB.StateMachine

closeIOLike m ⇒ ChainDBState m blk → m () Source #

open ∷ (IOLike m, TestConstraints blk) ⇒ ChainDbArgs Identity m blk → m (ChainDBState m blk) Source #

Specifying block components

type AllComponents blk = (blk, blk, Header blk, ByteString, ByteString, HeaderHash blk, SlotNo, IsEBB, SizeInBytes, Word16, SomeSecond (NestedCtxt Header) blk) Source #

A list of all the BlockComponent indices (b) we are interested in.

allComponentsBlockComponent blk (AllComponents blk) Source #

Product of all BlockComponents. As this is a GADT, generating random values of it (and combinations!) is not so simple. Therefore, we just always request all block components.

Constraints

Tracing

Entry point to the tests

Orphan instances

Generic (TraceAddBlockEvent blk) Source # 
Instance details

Associated Types

type Code (TraceAddBlockEvent blk) ∷ [[Type]] Source #

Generic (TraceCopyToImmutableDBEvent blk) Source # 
Instance details

Associated Types

type Code (TraceCopyToImmutableDBEvent blk) ∷ [[Type]] Source #

Generic (TraceEvent blk) Source # 
Instance details

Associated Types

type Code (TraceEvent blk) ∷ [[Type]] Source #

Methods

fromTraceEvent blk → Rep (TraceEvent blk) Source #

toRep (TraceEvent blk) → TraceEvent blk Source #

Generic (TraceFollowerEvent blk) Source # 
Instance details

Associated Types

type Code (TraceFollowerEvent blk) ∷ [[Type]] Source #

Generic (TraceGCEvent blk) Source # 
Instance details

Associated Types

type Code (TraceGCEvent blk) ∷ [[Type]] Source #

Methods

fromTraceGCEvent blk → Rep (TraceGCEvent blk) Source #

toRep (TraceGCEvent blk) → TraceGCEvent blk Source #

Generic (TraceInitChainSelEvent blk) Source # 
Instance details

Associated Types

type Code (TraceInitChainSelEvent blk) ∷ [[Type]] Source #

Generic (TraceIteratorEvent blk) Source # 
Instance details

Associated Types

type Code (TraceIteratorEvent blk) ∷ [[Type]] Source #

Generic (TraceOpenEvent blk) Source # 
Instance details

Associated Types

type Code (TraceOpenEvent blk) ∷ [[Type]] Source #

Generic (TraceValidationEvent blk) Source # 
Instance details

Associated Types

type Code (TraceValidationEvent blk) ∷ [[Type]] Source #

Generic (TraceEvent blk) Source # 
Instance details

Associated Types

type Code (TraceEvent blk) ∷ [[Type]] Source #

Methods

fromTraceEvent blk → Rep (TraceEvent blk) Source #

toRep (TraceEvent blk) → TraceEvent blk Source #

Generic (TraceReplayEvent blk) Source # 
Instance details

Associated Types

type Code (TraceReplayEvent blk) ∷ [[Type]] Source #

Generic (TraceSnapshotEvent blk) Source # 
Instance details

Associated Types

type Code (TraceSnapshotEvent blk) ∷ [[Type]] Source #

Generic (TraceEvent blk) Source # 
Instance details

Associated Types

type Code (TraceEvent blk) ∷ [[Type]] Source #

Methods

fromTraceEvent blk → Rep (TraceEvent blk) Source #

toRep (TraceEvent blk) → TraceEvent blk Source #

HasDatatypeInfo (TraceAddBlockEvent blk) Source # 
Instance details

Associated Types

type DatatypeInfoOf (TraceAddBlockEvent blk) ∷ DatatypeInfo Source #

HasDatatypeInfo (TraceCopyToImmutableDBEvent blk) Source # 
Instance details

HasDatatypeInfo (TraceEvent blk) Source # 
Instance details

Associated Types

type DatatypeInfoOf (TraceEvent blk) ∷ DatatypeInfo Source #

Methods

datatypeInfo ∷ proxy (TraceEvent blk) → DatatypeInfo (Code (TraceEvent blk)) Source #

HasDatatypeInfo (TraceFollowerEvent blk) Source # 
Instance details

Associated Types

type DatatypeInfoOf (TraceFollowerEvent blk) ∷ DatatypeInfo Source #

HasDatatypeInfo (TraceGCEvent blk) Source # 
Instance details

Associated Types

type DatatypeInfoOf (TraceGCEvent blk) ∷ DatatypeInfo Source #

Methods

datatypeInfo ∷ proxy (TraceGCEvent blk) → DatatypeInfo (Code (TraceGCEvent blk)) Source #

HasDatatypeInfo (TraceInitChainSelEvent blk) Source # 
Instance details

HasDatatypeInfo (TraceIteratorEvent blk) Source # 
Instance details

Associated Types

type DatatypeInfoOf (TraceIteratorEvent blk) ∷ DatatypeInfo Source #

HasDatatypeInfo (TraceOpenEvent blk) Source # 
Instance details

Associated Types

type DatatypeInfoOf (TraceOpenEvent blk) ∷ DatatypeInfo Source #

HasDatatypeInfo (TraceValidationEvent blk) Source # 
Instance details

HasDatatypeInfo (TraceEvent blk) Source # 
Instance details

Associated Types

type DatatypeInfoOf (TraceEvent blk) ∷ DatatypeInfo Source #

Methods

datatypeInfo ∷ proxy (TraceEvent blk) → DatatypeInfo (Code (TraceEvent blk)) Source #

HasDatatypeInfo (TraceReplayEvent blk) Source # 
Instance details

Associated Types

type DatatypeInfoOf (TraceReplayEvent blk) ∷ DatatypeInfo Source #

HasDatatypeInfo (TraceSnapshotEvent blk) Source # 
Instance details

Associated Types

type DatatypeInfoOf (TraceSnapshotEvent blk) ∷ DatatypeInfo Source #

HasDatatypeInfo (TraceEvent blk) Source # 
Instance details

Associated Types

type DatatypeInfoOf (TraceEvent blk) ∷ DatatypeInfo Source #

Methods

datatypeInfo ∷ proxy (TraceEvent blk) → DatatypeInfo (Code (TraceEvent blk)) Source #