Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 11 additions & 51 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ source-repository-package
-- NOTE: If you would like to update the above,
-- see CONTRIBUTING.md#to-update-the-referenced-agda-ledger-spec
index-state:
, hackage.haskell.org 2026-05-06T14:09:41Z
, cardano-haskell-packages 2026-04-11T06:29:42Z
, hackage.haskell.org 2026-05-26T01:52:59Z
, cardano-haskell-packages 2026-05-25T13:25:40Z

packages:
-- == Byron era ==
Expand Down Expand Up @@ -124,61 +124,21 @@ if impl(ghc >=9.14)
, containers >= 0.8
, foldl >= 1.4.18

-- cabal-allow-newer begin
if impl(ghc >=9.14)
allow-newer:
-- https://github.com/IntersectMBO/cardano-ledger/issues/5588
-- Plutus stuff has been fixed in the master branch on Github,
-- but not yet released to CHaP.
, aeson:QuickCheck
, aeson:base
, aeson:containers
, aeson:data-fix
, aeson:template-haskell
, aeson:time
, binary-orphans:base
, boring:base
, canonical-json:containers
, cborg:base
, cborg:containers
, serialise:base
, serialise:containers
, config-ini:containers
, constraints-extras:base
, constraints-extras:template-haskell
, dependent-map:constraints-extras
, constrained-generators:QuickCheck
, dependent-map:containers
, dictionary-sharing:containers
, dec:base
, bin:base
, fin:base
, ral:base
, http-api-data:base
, http-api-data:containers
, indexed-traversable:base
, indexed-traversable:containers
, indexed-traversable-instances:base
, microstache:base
, microstache:containers
, nonempty-vector:base
, hedgehog-quickcheck:QuickCheck
, ordered-containers:containers
, partial-order:containers
, persistent:template-haskell
, plutus-core:dependent-map
, plutus-core:vty
, plutus-core:vty-crossplatform
, pqueue:base
, quickcheck-instances:base
, quickcheck-instances:containers
, quickcheck-instances:these
, quickcheck-instances:uuid-types
, safe-wild-cards:template-haskell
, semialign:base
, semialign:containers
, semialign:indexed-traversable
, semialign:indexed-traversable-instances
, these:base
, tree-diff:QuickCheck
, tree-diff:base
, tree-diff:containers
, tree-diff:time
, universe-base:base
, universe-base:containers
, uuid-types:template-haskell
, serialise:base
, serialise:containers
, serialise:time
-- cabal-allow-newer end
2 changes: 1 addition & 1 deletion eras/mary/impl/cardano-ledger-mary.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ library testlib
build-depends:
base,
bytestring,
cardano-base:testlib,
cardano-base:testlib >=0.1.4,
cardano-crypto-class,
cardano-data:testlib,
cardano-ledger-allegra:{cardano-ledger-allegra, testlib},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ spec :: Spec
spec = do
describe "MultiAsset" $ do
prop "Canonical construction agrees" $
withMaxSuccess 10000 propCanonicalConstructionAgrees
withNumTests 10000 propCanonicalConstructionAgrees
describe "CBOR roundtrip" $ do
describe "Coin" $ do
prop "Non-negative Coin succeeds for all eras" $
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ exampleMultiAssets = [s0, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12]
-- This was used to diagnose https://github.com/input-output-hk/cardano-node/issues/4826
subtractionIsTotal :: TestTree
subtractionIsTotal = testProperty "multi-asset subtraction is total" $
QC.withMaxSuccess 100000 $
QC.withNumTests 100000 $
do
shuffle1 <- take 12 <$> QC.shuffle exampleMultiAssets
shuffle2 <- take 2 <$> QC.shuffle exampleMultiAssets
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ import Test.Tasty.QuickCheck (
noShrinking,
property,
testProperty,
withMaxSuccess,
withNumTests,
)

-- ========================================================================
Expand Down Expand Up @@ -671,7 +671,7 @@ lastElem (_ : xs) = lastElem xs

-- | Provide a legitimate NewEpochState to make an test Property
newEpochProp :: Word64 -> (NewEpochState ShelleyEra -> Property) -> Property
newEpochProp tracelen propf = withMaxSuccess 100 $
newEpochProp tracelen propf = withNumTests 100 $
forAllChainTrace @ShelleyEra tracelen defaultConstants $ \tr ->
case lastElem (sourceSignalTargets tr) of
Just SourceSignalTarget {target} -> propf (chainNes target)
Expand All @@ -680,7 +680,7 @@ newEpochProp tracelen propf = withMaxSuccess 100 $
-- | Given a NewEpochState and [ChainEvent], test a Property at every Epoch Boundary
newEpochEventsProp ::
Word64 -> ([ChainEvent ShelleyEra] -> NewEpochState ShelleyEra -> Property) -> Property
newEpochEventsProp tracelen propf = withMaxSuccess 10 $
newEpochEventsProp tracelen propf = withNumTests 10 $
forEachEpochTrace @ShelleyEra 10 tracelen defaultConstants $ \tr ->
case lastElem (sourceSignalTargets tr) of
Just SourceSignalTarget {target} ->
Expand Down Expand Up @@ -724,7 +724,7 @@ eventsMirrorRewards events nes = same eventRew compRew
total = getMostRecentTotalRewardEvent events
aggevent = aggIncrementalRewardEvents events
FilteredRewards aggFilteredEvent _ _ _ = filterAllRewards aggevent (nesEs nes)
same x y = withMaxSuccess 1 $ counterexample message (x === y)
same x y = withNumTests 1 $ counterexample message (x === y)
where
message =
"events don't mirror rewards "
Expand Down Expand Up @@ -810,7 +810,7 @@ tests =
testGroup
"Reward Tests"
[ testProperty "Sum of rewards is bounded by reward pot" $
withMaxSuccess numberOfTests (rewardsBoundedByPot (Proxy @ShelleyEra))
withNumTests numberOfTests (rewardsBoundedByPot (Proxy @ShelleyEra))
, testProperty "compare with reference impl, no provenance, v3" . noShrinking $
newEpochProp chainlen (oldEqualsNew @ShelleyEra (ProtVer (natVersion @3) 0))
, testProperty "compare with reference impl, no provenance, v7" . noShrinking $
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ import Test.QuickCheck (
(.||.),
(===),
)
import Test.QuickCheck.Property (withMaxSuccess)
import Test.QuickCheck.Property (withNumTests)
import Test.Tasty (TestTree)
import qualified Test.Tasty.QuickCheck as TQC

Expand All @@ -111,7 +111,7 @@ tests ::
tests n =
TQC.testProperty
"total amount of Ada is preserved (Chain)"
(noShrinking $ withMaxSuccess n (adaPreservationProps @era))
(noShrinking $ withNumTests n (adaPreservationProps @era))

-- | Various preservation properties
adaPreservationProps ::
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ import Test.QuickCheck (
forAllBlind,
property,
stdConfidence,
withMaxSuccess,
withNumTests,
)
import Test.Tasty (TestTree)
import qualified Test.Tasty.QuickCheck as TQC
Expand All @@ -108,7 +108,7 @@ relevantCasesAreCovered ::
relevantCasesAreCovered n =
TQC.testProperty
"Chain and Ledger traces cover the relevant cases"
(TQC.withMaxSuccess n prop)
(TQC.withNumTests n prop)
where
prop = do
let tl = 100
Expand Down Expand Up @@ -314,7 +314,7 @@ onlyValidLedgerSignalsAreGenerated =
TQC.testProperty "Only valid Ledger STS signals are generated" prop
where
prop =
withMaxSuccess 200 $
withNumTests 200 $
onlyValidSignalsAreGeneratedFromInitState
@ledger
testGlobals
Expand Down Expand Up @@ -401,7 +401,7 @@ onlyValidChainSignalsAreGenerated =
TQC.testProperty "Only valid CHAIN STS signals are generated" prop
where
prop =
withMaxSuccess 100 $
withNumTests 100 $
onlyValidSignalsAreGeneratedFromInitState @(CHAIN era)
testGlobals
100
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ import Test.QuickCheck (
Property,
Testable (..),
conjoin,
withMaxSuccess,
withNumTests,
)

------------------------------
Expand Down Expand Up @@ -135,7 +135,7 @@ shortChainTrace ::
Constants ->
(SourceSignalTarget (CHAIN era) -> Property) ->
Property
shortChainTrace constants f = withMaxSuccess 100 $ forAllChainTrace @era 10 constants $ \tr -> conjoin (map f (sourceSignalTargets tr))
shortChainTrace constants f = withNumTests 100 $ forAllChainTrace @era 10 constants $ \tr -> conjoin (map f (sourceSignalTargets tr))

----------------------------------------------------------------------
-- Projections of CHAIN Trace
Expand Down Expand Up @@ -337,7 +337,7 @@ forAllChainTrace ::
(Trace (CHAIN era) -> prop) ->
Property
forAllChainTrace n constants prop =
withMaxSuccess (fromIntegral numberOfTests) . property $
withNumTests (fromIntegral numberOfTests) . property $
forAllTraceFromInitState
testGlobals
n
Expand Down
12 changes: 6 additions & 6 deletions flake.lock

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

2 changes: 1 addition & 1 deletion libs/cardano-ledger-core/cardano-ledger-core.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ library cddl
cardano-ledger-binary,
cardano-ledger-core,
cborg,
cuddle >=1.7,
cuddle >=1.7 && <1.8,
heredoc,
mempack,
quickcheck-transformer,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import Test.QuickCheck (
Property,
counterexample,
property,
withMaxSuccess,
withNumTests,
)

-- ====================================================================================
Expand Down Expand Up @@ -114,7 +114,7 @@ soundSpecWith ::
forall t.
(HasSpec t, ToExpr t) =>
Int -> Gen (Specification t) -> SpecWith (Arg Property)
soundSpecWith n specx = it (show (typeRep (Proxy @t))) $ withMaxSuccess n $ property $ (soundSpec @t specx)
soundSpecWith n specx = it (show (typeRep (Proxy @t))) $ withNumTests n $ property $ (soundSpec @t specx)

-- | A bunch of soundness tests on different LederTypes, all in the same Era.
-- The idea is to run this suite on every era.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ runMinitrace ::
runMinitrace cgb classifier =
prop
(symbolVal $ Proxy @rule)
(withMaxSuccess 50 (minitraceProp @rule @era 50 cgb classifier))
(withNumTests 50 (minitraceProp @rule @era 50 cgb classifier))

genDelegCtx :: Gen (WitUniv ConwayEra, ConwayCertGenContext ConwayEra)
genDelegCtx = do
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ forAllTraceFromInitState baseEnv maxTraceLength traceGenEnv genSt0 =
-- like not getting turned off because the tests take too long. A glaring failure is
-- likely to be caught in 'n' tests, rather than the standard '100'
testPropMax :: (HasCallStack, Testable prop) => Int -> String -> prop -> Spec
testPropMax n name x = prop name (withMaxSuccess n x)
testPropMax n name x = prop name (withNumTests n x)

chainTest ::
forall era.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ import Test.Cardano.Ledger.Generic.ModelState (
import Test.Cardano.Ledger.Generic.Proof hiding (lift)
import Test.Cardano.Ledger.Shelley.Serialisation.EraIndepGenerators ()
import Test.Cardano.Ledger.Shelley.Utils (epochFromSlotNo, runShelleyBase)
import Test.QuickCheck
import Test.QuickCheck hiding (Some)

alonzoMkRedeemersFromTags ::
(AlonzoEraScript era, EraModel era) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ calcPoolDistOldEqualsNew :: Spec
calcPoolDistOldEqualsNew =
describe "calculatePoolDistr" $ do
prop "old==new" $
withMaxSuccess 500 $ \snap ->
withNumTests 500 $ \snap ->
counterexample "BAD" $
oldCalculatePoolDistr (const True) snap === Shelley.calculatePoolDistr snap

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ blockEraSpec ::
Spec
blockEraSpec =
prop (show (typeRep $ Proxy @(Block (BHeader StandardCrypto) era))) $
withMaxSuccess 3 $
withNumTests 3 $
decoderEquivalenceProp @(Block (BHeader StandardCrypto) era)
(eraProtVerLow @era)
(eraProtVerHigh @era)
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ roundTripBlockSpec ::
Spec
roundTripBlockSpec =
prop (show (typeRep $ Proxy @(Block h era))) $ do
withMaxSuccess 3 $ do
withNumTests 3 $ do
conjoin
[ roundTripEraExpectation @era @(Block h era)
, roundTripAnnEraExpectation @era @(Block h era)
Expand Down
1 change: 1 addition & 0 deletions libs/non-integral/non-integral.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,5 @@ test-suite non-integral-test
build-depends:
QuickCheck,
base,
cardano-base:testlib >=0.1.5.0,
non-integral,
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{-# LANGUAGE CPP #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE PartialTypeSignatures #-}
{-# LANGUAGE TypeSynonymInstances #-}
Expand All @@ -6,6 +7,7 @@ module Tests.Cardano.Ledger.NonIntegral where

import Cardano.Ledger.NonIntegral
import qualified Data.Fixed as FP
import qualified Test.Cardano.Base.QuickCheck as BaseQC
import Test.QuickCheck

data E34
Expand Down Expand Up @@ -243,7 +245,7 @@ qcWithLabel :: Testable prop => String -> Int -> prop -> IO ()
qcWithLabel text count prop = do
putStrLn text
if count > 0
then quickCheck (withMaxSuccess count prop)
then quickCheck (BaseQC.withNumTests count prop)
else putStrLn "--- SKIPPED, takes too long"

-- Test of Double --
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import Test.QuickCheck (
elements,
oneof,
shrink,
withMaxSuccess,
withNumTests,
)
import Prelude hiding (id)

Expand Down Expand Up @@ -240,7 +240,7 @@ prop_qc_UniqueData =
-- where it shouldn't be possible to shrink @d0@ any further.
prop_qc_OnlyValidSignals :: Property
prop_qc_OnlyValidSignals =
withMaxSuccess 5000 $ -- We need to test a large
withNumTests 5000 $ -- We need to test a large
-- number of times to make sure
-- we get a collision in the
-- generated data
Expand Down
Loading
Loading