[input-output-hk/cardano-sl] [CDEC-348] Add Hedgehog generators for data types in core (#3081)

mhuesch commented on this pull request.

> + , genScriptWitness
+ , genUnknownWitnessType
+ ]
+
+genTxWitness :: Gen TxWitness
+genTxWitness = singleton genTxInWitness
+
+genUnknownWitnessType :: Gen TxInWitness
+genUnknownWitnessType =
+ UnknownWitnessType Gen.word8 Range.constantBounded gen32Bytes
+
+—————————————————————————-
+– Pos.Core.Update Generators
+—————————————————————————-
+
+genApplicationName :: Gen ApplicationName

Is this also intentionally not exported?

> +genSlotId = SlotId genEpochIndex genLocalSlotIndex
+
+genTimeDiff :: Gen TimeDiff
+genTimeDiff = TimeDiff genMicrosecond
+
+genTimestamp :: Gen Timestamp
+genTimestamp = Timestamp genMicrosecond
+
+—————————————————————————-
+– Pos.Core.Ssc Generators
+—————————————————————————-
+
+genGenesisAvvmBalances :: Gen GenesisAvvmBalances
+genGenesisAvvmBalances = GenesisAvvmBalances customHashMapGen genRedeemPublicKey genCoin
+
+data CommitmentOpening = CommitmentOpening

Why is this duplicated from `Pos.Arbitrary.Ssc`? Having a comment to explain the duplication would be helpful for the reader.

> +—————————————————————————-
+– Pos.Core.Ssc Generators
+—————————————————————————-
+
+genGenesisAvvmBalances :: Gen GenesisAvvmBalances
+genGenesisAvvmBalances = GenesisAvvmBalances customHashMapGen genRedeemPublicKey genCoin
+
+data CommitmentOpening = CommitmentOpening
+ { unCommitment :: !Commitment
+ , unOpening :: !Opening
+ }
+
+genCommitment :: Gen Commitment
+genCommitment = unCommitment genCommitmentOpening
+
+genCommitmentOpening :: Gen CommitmentOpening

Related to the above comment: should this be exported if CommitmentOpening is an exported type of `Pos.Arbitrary.Ssc`? Or is CommitmentOpening a sort of ‘implementation detail’ datatype?

This post was last modified on June 13, 2018, 7:33 pm