Skip to content

Commit

Permalink
[#788][#817] Set up for DCert conformance testing
Browse files Browse the repository at this point in the history
  • Loading branch information
mhuesch committed Sep 19, 2019
1 parent 3635c01 commit d4b9d54
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 4 deletions.
6 changes: 6 additions & 0 deletions byron/ledger/executable-spec/src/Ledger/Delegation.hs
Expand Up @@ -87,6 +87,7 @@ module Ledger.Delegation
, S_BeforeExistingDelegation, S_NoLastDelegation
, S_AfterExistingDelegation, S_AlreadyADelegateOf
)
, tamperedDcerts
)
where

Expand Down Expand Up @@ -795,3 +796,8 @@ mkGoblinGens
, "SDelegSFailure_SDelegFailure_IsAlreadyScheduled"
, "SDelegSFailure_SDelegFailure_IsNotGenesisKey"
]

tamperedDcerts :: DIEnv -> DIState -> Gen [DCert]
tamperedDcerts env st = do
sg <- Gen.element goblinGensDELEG
sg env st
22 changes: 22 additions & 0 deletions byron/ledger/executable-spec/src/Ledger/Update/Test.hs
Expand Up @@ -4,6 +4,7 @@
module Ledger.Update.Test
( coverUpiregFailures
, coverUpivoteFailures
, coverDelegFailures
)
where

Expand All @@ -13,6 +14,7 @@ import GHC.Stack (HasCallStack)
import Hedgehog (MonadTest)
import Hedgehog.Internal.Property (CoverPercentage)

import Ledger.Delegation (PredicateFailure (EpochInThePast, EpochPastNextEpoch, IsAlreadyScheduled, IsNotGenesisKey))
import Ledger.Update (PredicateFailure (AVSigDoesNotVerify, AlreadyProposedPv, AlreadyProposedSv, CannotFollowPv, CannotFollowSv, CannotUpdatePv, DoesNotVerify, InvalidApplicationName, InvalidSystemTags, NoUpdateProposal, NotGenesisDelegate))
import Ledger.Update (UpId (UpId))

Expand Down Expand Up @@ -71,3 +73,23 @@ coverUpivoteFailures coverPercentage someData =
, NoUpdateProposal (UpId 0) -- We need to pass a dummy update id here.
]
someData


coverDelegFailures
:: forall m a
. ( MonadTest m
, HasCallStack
, Data a
)
=> CoverPercentage
-> a
-> m ()
coverDelegFailures coverPercentage someData =
Generator.coverFailures
coverPercentage
[ EpochInThePast undefined
, EpochPastNextEpoch undefined
, IsAlreadyScheduled
, IsNotGenesisKey
]
someData
2 changes: 1 addition & 1 deletion cabal.project
Expand Up @@ -29,4 +29,4 @@ source-repository-package
source-repository-package
type: git
location: https://github.com/input-output-hk/goblins
tag: b5e99cf153a3abb1b764f80095f6a930ba056048
tag: 545448938bf620bb2a25212e1686916cfa3acee9
4 changes: 2 additions & 2 deletions nix/.stack.nix/goblins.nix

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion stack.yaml
Expand Up @@ -23,7 +23,7 @@ extra-deps:
- cardano-crypto-class

- git: https://github.com/input-output-hk/goblins
commit: b5e99cf153a3abb1b764f80095f6a930ba056048
commit: 545448938bf620bb2a25212e1686916cfa3acee9
- moo-1.2
- gray-code-0.3.1

Expand Down

0 comments on commit d4b9d54

Please sign in to comment.