cardano-sl-0.4.3: Cardano SL main implementation

Safe HaskellNone
LanguageHaskell2010

Pos.Block.Arbitrary

Contents

Synopsis

Documentation

newtype HeaderAndParams ssc Source #

This type is used to generate a valid blockheader and associated header verification params. With regards to the block header function verifyHeader, the blockheaders that may be part of the verification parameters are guaranteed to be valid, as are the slot leaders and the current slot.

Constructors

HAndP 

Instances

Ssc ssc => Eq (HeaderAndParams ssc) Source # 
Ssc ssc => Show (HeaderAndParams ssc) Source # 
(Arbitrary (SscPayload ssc), SscHelpersClass ssc) => Arbitrary (HeaderAndParams ssc) Source #

A lot of the work to generate a valid sequence of blockheaders has already been done in the Arbitrary instance of the BlockHeaderList type, so it is used here and at most 3 blocks are taken from the generated list.

newtype BlockHeaderList ssc Source #

Constructors

BHL 

Fields

Instances

Ssc ssc => Eq (BlockHeaderList ssc) Source # 
BiSsc ssc => Show (BlockHeaderList ssc) Source # 
(Arbitrary (SscPayload ssc), SscHelpersClass ssc) => Arbitrary (BlockHeaderList ssc) Source #

This type is used to generate a blockchain, as well a list of leaders for every slot with which the chain will be paired. The leaders are in reverse order to the chain - the list goes from first to last leader. This is used in a verifyHeader test.

Note that every non-empty blockchain has at least one epoch, which may be complete or incomplete. To simulate this behavior, two random numbers are generated: one that stands for the number of complete epochs we have, and the other for the number of incomplete slots of the last epoch, which, in this instance, must exist.

A blockchain with only complete epochs is a subset of some blockchain with one incomplete epoch, so if the former is desired, a simple list takeWhile of the list this instance generates will be enough.

Note that a leader is generated for each slot. (Not exactly a leader - see previous comment)

Orphan instances

Arbitrary TxPayload Source # 
Arbitrary GenesisExtraBodyData Source # 
Arbitrary GenesisExtraHeaderData Source # 
Arbitrary MainExtraBodyData Source # 
Arbitrary MainExtraHeaderData Source # 
Arbitrary MsgGetBlocks Source # 
Arbitrary MsgGetHeaders Source # 
Arbitrary (Body (GenesisBlockchain ssc)) Source # 
Arbitrary (SscPayload ssc) => Arbitrary (Body (MainBlockchain ssc)) Source # 
Arbitrary (ConsensusData (GenesisBlockchain ssc)) Source # 
(Arbitrary (SscProof ssc), Bi Raw, Ssc ssc) => Arbitrary (ConsensusData (MainBlockchain ssc)) Source # 
Arbitrary (BodyProof (GenesisBlockchain ssc)) Source # 
(Arbitrary (SscProof ssc), Bi Raw) => Arbitrary (BodyProof (MainBlockchain ssc)) Source # 
Arbitrary (GenericBlock (GenesisBlockchain ssc)) Source # 
(Arbitrary (SscProof ssc), Arbitrary (SscPayloadDependsOnSlot ssc), SscHelpersClass ssc) => Arbitrary (GenericBlock (MainBlockchain ssc)) Source # 
Arbitrary h => Arbitrary (Attributes h) Source # 
Arbitrary (GenesisBlockHeader ssc) Source # 
(Arbitrary (SscProof ssc), Bi Raw, Ssc ssc) => Arbitrary (MainBlockHeader ssc) Source # 
(Arbitrary (SscProof ssc), Bi Raw, Ssc ssc) => Arbitrary (BlockSignature ssc) Source # 
(Ssc ssc, Arbitrary (SscProof ssc)) => Arbitrary (MainToSign ssc) Source # 

Methods

arbitrary :: Gen (MainToSign ssc) #

shrink :: MainToSign ssc -> [MainToSign ssc] #

(Arbitrary (SscProof ssc), Arbitrary (SscPayloadDependsOnSlot ssc), SscHelpersClass ssc) => Arbitrary (MsgBlock ssc) Source # 

Methods

arbitrary :: Gen (MsgBlock ssc) #

shrink :: MsgBlock ssc -> [MsgBlock ssc] #

(Arbitrary (SscProof ssc), Bi Raw, Ssc ssc) => Arbitrary (MsgHeaders ssc) Source # 

Methods

arbitrary :: Gen (MsgHeaders ssc) #

shrink :: MsgHeaders ssc -> [MsgHeaders ssc] #

BiSsc ssc => Buildable (BlockHeader ssc, PublicKey) Source # 

Methods

build :: (BlockHeader ssc, PublicKey) -> Builder #