cardano-rpc:testlib
Safe HaskellNone
LanguageHaskell2010

Test.Cardano.Rpc.FixtureBlock

Description

Genuine Byron blocks, a fixed slot timestamp and the AnyChainBlock built from them before field masks, shared by the block handler tests.

Synopsis

Documentation

oldAnyChainBlock Source #

Arguments

:: ByteString

Raw CBOR bytes of the block, exactly as stored on chain

-> BlockInMode

The same block, parsed and placed in its era context

-> UTCTime

Slot wall-clock time; encoded as milliseconds since the Unix epoch

-> Proto AnyChainBlock 

The AnyChainBlock that FetchBlock and FollowTip built before field masks, the oracle for their responses under an absent mask, independent of the code under test: raw CBOR bytes, the cardano header, the parsed transactions and the given slot timestamp.

mainBlockInMode :: (HasCallStack, MonadTest m, MonadIO m) => m (ByteString, BlockInMode) Source #

A genuine Byron BlockInMode decoded from the mainnet main-block golden fixture also used by ByronTx. The block handlers read scripted blocks through their real block reads, so the blocks must be real, valid blocks rather than placeholders; decoding an existing fixture through the same mkByronBlock smart constructor the node's ChainDB uses is the cheapest way to get one, and reuses a fixture already checked in for this purpose.

boundaryBlockInMode :: (HasCallStack, MonadTest m, MonadIO m) => m (ByteString, BlockInMode) Source #

A genuine Byron BlockInMode decoded from the mainnet epoch-boundary golden fixture also used by ByronTx; see mainBlockInMode. Distinct from it (a boundary block instead of a main block, at a different slot and hash), so a two-block script has two genuinely different blocks to distinguish, for free.

stubTimestamp :: UTCTime Source #

A fixed stub slot timestamp, returned regardless of the slot asked for.

decodeBlockOrBoundaryFixture :: (HasCallStack, MonadTest m) => ByteString -> m (ABlockOrBoundary ByteString) Source #

Decode a ABlockOrBoundary fixture from the wire encoding the node's ImmutableDB stores, annotating the result with the original bytes, exactly as a block fetched from the node would carry them.