Skip to content

Commit 1673b94

Browse files
authored
Merge branch 'IntersectMBO:master' into master
2 parents 09f2827 + 381d27d commit 1673b94

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+3766
-983
lines changed

.github/workflows/haskell.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ jobs:
3838

3939
env:
4040
# Modify this value to "invalidate" the cabal cache.
41-
CABAL_CACHE_VERSION: "2024-02-29"
41+
CABAL_CACHE_VERSION: "2024-03-07"
4242

4343
concurrency:
4444
group: >

Makefile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,8 @@ PROFILES_EPOCHTRANS := epoch-transition
8484
PROFILES_PLUTUSCALL := plutuscall-loop-plain plutuscall-secp-ecdsa-plain plutuscall-secp-schnorr-plain
8585
PROFILES_PLUTUSCALL += plutuscall-loop-half plutuscall-secp-ecdsa-half plutuscall-secp-schnorr-half
8686
PROFILES_PLUTUSCALL += plutuscall-loop-double plutuscall-secp-ecdsa-double plutuscall-secp-schnorr-double
87-
PROFILES_MODEL := model-value model-secp-ecdsa-plain model-secp-ecdsa-half model-secp-ecdsa-double
88-
PROFILES_MODEL += model-value-test
87+
PROFILES_MODEL := model-value model-secp-ecdsa-plain model-secp-ecdsa-half model-secp-ecdsa-double
88+
PROFILES_MODEL += model-value-test
8989
PROFILES_10 := 10 10-p2p 10-plutus 10-notracer
9090
PROFILES_FORGE_STRESS := forge-stress forge-stress-p2p forge-stress-plutus forge-stress-plutus-solo forge-stress-notracer forge-stress-large forge-stress-solo forge-stress-solo-xs
9191
PROFILES_FORGE_STRESS_PRE := forge-stress-pre forge-stress-pre-plutus forge-stress-pre-notracer forge-stress-pre-solo forge-stress-pre-solo-xl forge-stress-pre-solo-xs
@@ -97,9 +97,10 @@ PROFILES_VENDOR := dish dish-plutus dish-10M dish-10M-plutus
9797
# Cloud version of "default", "ci-test" and "ci-bench" plus value (52+explorer)
9898
# Not all local profiles are compatible or tested (yet) with a cloud runs
9999
PROFILES_NOMAD_PERF := default-nomadperf ci-test-nomadperf ci-bench-nomadperf value-nomadperf oldtracing-nomadperf ci-test-oldtracing-nomadperf ci-bench-oldtracing-nomadperf value-oldtracing-nomadperf
100-
PROFILES_NOMAD_PERF += plutus-nomadperf idle-nomadperf
100+
PROFILES_NOMAD_PERF += plutus-nomadperf fast-nomadperf latency-nomadperf
101101
PROFILES_NOMAD_PERF_NOP2P := default-nomadperf-nop2p oldtracing-nomadperf-nop2p ci-test-nomadperf-nop2p ci-bench-nomadperf-nop2p
102-
PROFILES_NOMAD_PERF_NOP2P += value-nomadperf-nop2p value-oldtracing-nomadperf-nop2p plutus-nomadperf-nop2p
102+
PROFILES_NOMAD_PERF_NOP2P += value-nomadperf-nop2p value-oldtracing-nomadperf-nop2p plutus-nomadperf-nop2p fast-nomadperf-nop2p
103+
PROFILES_NOMAD_PERFSSD := fast-nomadperfssd
103104

104105
LOCAL_PROFILES += $(PROFILES_BASE)
105106
LOCAL_PROFILES += $(PROFILES_FAST)
@@ -118,6 +119,7 @@ LOCAL_PROFILES += $(PROFILES_CHAINSYNC)
118119
LOCAL_PROFILES += $(PROFILES_VENDOR)
119120
CLOUD_PROFILES += $(PROFILES_NOMAD_PERF)
120121
CLOUD_PROFILES += $(PROFILES_NOMAD_PERF_NOP2P)
122+
CLOUD_PROFILES += $(PROFILES_NOMAD_PERFSSD)
121123

122124

123125
## Note: to enable a shell for a profile, just add its name (one of names from 'make ps') to SHELL_PROFILES

README.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616

1717
.. contents:: Contents
1818

19-
*************************
19+
*******************************************
2020
Overview of the ``cardano-node`` repository
21-
*************************
21+
*******************************************
2222

2323
Integration of the `ledger <https://github.com/input-output-hk/cardano-ledger-specs>`_, `consensus <https://github.com/input-output-hk/ouroboros-consensus>`_,
2424
`networking <https://github.com/input-output-hk/ouroboros-network/tree/master/ouroboros-network>`_ and

cabal.project

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ repository cardano-haskell-packages
1313
-- See CONTRIBUTING for information about these, including some Nix commands
1414
-- you need to run if you change them
1515
index-state:
16-
, hackage.haskell.org 2024-02-27T08:06:51Z
17-
, cardano-haskell-packages 2024-02-26T17:55:44Z
16+
, hackage.haskell.org 2024-03-07T07:48:20Z
17+
, cardano-haskell-packages 2024-03-05T10:16:08Z
1818

1919
packages:
2020
cardano-git-rev

cardano-node/cardano-node.cabal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ library
187187
, ouroboros-consensus-cardano ^>= 0.14
188188
, ouroboros-consensus-diffusion ^>= 0.11
189189
, ouroboros-consensus-protocol
190-
, ouroboros-network-api
190+
, ouroboros-network-api >= 0.7.0.0 && < 0.7.1.0
191191
, ouroboros-network ^>= 0.12
192192
, ouroboros-network-framework
193193
, ouroboros-network-protocols ^>= 0.8

cardano-testnet/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog for cardano-testnet
22

3+
## Next version
4+
5+
* Update `cardano-ping` dependency
6+
37
## 8.7.0
48

59
* Using `cardano-node-8.7.0`, `cardano-api-8.33` and `cardano-cli-8.15`

cardano-testnet/cardano-testnet.cabal

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ library
4848
, cardano-ledger-core:testlib
4949
, cardano-ledger-shelley
5050
, cardano-node
51-
, cardano-ping ^>= 0.2.0.10
51+
, cardano-ping ^>= 0.2.0.13
5252
, contra-tracer
5353
, containers
5454
, data-default-class
@@ -175,6 +175,7 @@ test-suite cardano-testnet-test
175175
Cardano.Testnet.Test.Cli.Conway.Plutus
176176
Cardano.Testnet.Test.Cli.Conway.StakeSnapshot
177177
Cardano.Testnet.Test.Cli.KesPeriodInfo
178+
Cardano.Testnet.Test.Cli.Queries
178179
Cardano.Testnet.Test.Cli.QuerySlotNumber
179180
Cardano.Testnet.Test.FoldBlocks
180181
Cardano.Testnet.Test.Misc
@@ -206,7 +207,6 @@ test-suite cardano-testnet-test
206207
, cardano-testnet
207208
, containers
208209
, directory
209-
, exceptions
210210
, filepath
211211
, hedgehog
212212
, hedgehog-extras
@@ -220,6 +220,7 @@ test-suite cardano-testnet-test
220220
, text
221221
, time
222222
, transformers
223+
, vector
223224

224225
ghc-options: -threaded -rtsopts "-with-rtsopts=-N -T"
225226

cardano-testnet/src/Cardano/Testnet.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ module Cardano.Testnet (
1313
TestnetNodeOptions(..),
1414
cardanoDefaultTestnetOptions,
1515
cardanoDefaultTestnetNodeOptions,
16+
getDefaultAlonzoGenesis,
17+
getDefaultShelleyGenesis,
1618

1719
-- * Configuration
1820
Conf(..),

cardano-testnet/src/Testnet/Components/Query.hs

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
{-# LANGUAGE DataKinds #-}
22
{-# LANGUAGE GADTs #-}
3+
{-# LANGUAGE NamedFieldPuns #-}
34
{-# LANGUAGE OverloadedStrings #-}
45
{-# LANGUAGE ScopedTypeVariables #-}
56
{-# LANGUAGE TypeApplications #-}
67

78
module Testnet.Components.Query
89
( QueryTip
910
, EpochStateView
11+
, checkDRepsNumber
1012
, getEpochState
1113
, queryTip
1214
, waitUntilEpoch
@@ -19,6 +21,8 @@ module Testnet.Components.Query
1921
) where
2022

2123
import Cardano.Api as Api
24+
import Cardano.Api.Ledger (StandardCrypto)
25+
import qualified Cardano.Api.Ledger as L
2226
import Cardano.Api.Shelley (ShelleyLedgerEra, fromShelleyTxIn, fromShelleyTxOut)
2327

2428
import Cardano.CLI.Types.Output
@@ -28,6 +32,7 @@ import qualified Cardano.Ledger.UTxO as L
2832
import Control.Exception.Safe (MonadCatch)
2933
import Control.Monad
3034
import Control.Monad.Trans.Resource
35+
import Control.Monad.Trans.State.Strict (put)
3136
import Data.Aeson
3237
import Data.Bifunctor (bimap)
3338
import Data.IORef
@@ -44,6 +49,7 @@ import GHC.Stack
4449
import Lens.Micro ((^.))
4550
import System.Directory (doesFileExist, removeFile)
4651

52+
import qualified Testnet.Process.Cli as P
4753
import qualified Testnet.Process.Run as H
4854
import Testnet.Property.Assert
4955
import Testnet.Property.Utils (runInBackground)
@@ -218,3 +224,65 @@ findLargestUtxoForPaymentKey epochStateView sbe address =
218224
. H.nothingFailM
219225
$ findLargestUtxoWithAddress epochStateView sbe (paymentKeyInfoAddr address)
220226

227+
228+
-- | @checkDRepsNumber config socket execConfig n@
229+
-- wait for the number of DReps being @n@ for two epochs. If
230+
-- this number is not attained before two epochs, the test is failed.
231+
checkDRepsNumber ::
232+
(HasCallStack, MonadIO m, MonadCatch m, MonadTest m)
233+
=> ShelleyBasedEra ConwayEra -- ^ The era in which the test runs
234+
-> NodeConfigFile 'In
235+
-> SocketPath
236+
-> H.ExecConfig
237+
-> Int
238+
-> m ()
239+
checkDRepsNumber sbe configurationFile socketPath execConfig expectedDRepsNb = do
240+
QueryTipLocalStateOutput{mEpoch} <- P.execCliStdoutToJson execConfig [ "query", "tip" ]
241+
currentEpoch <- H.evalMaybe mEpoch
242+
let terminationEpoch = succ . succ $ currentEpoch
243+
void $ H.evalMaybeM $ checkDRepsNumber' sbe configurationFile socketPath terminationEpoch expectedDRepsNb
244+
245+
-- | @checkDRepsNumber' config socket terminationEpoch n@
246+
-- wait until @terminationEpoch@ for the number of DReps being @n@. If
247+
-- this number is not attained before @terminationEpoch@, the test is failed.
248+
-- So if you call this function, you are expecting the number of DReps to already
249+
-- be @n@, or to be @n@ before @terminationEpoch@
250+
checkDRepsNumber' ::
251+
(HasCallStack, MonadIO m, MonadTest m)
252+
=> ShelleyBasedEra ConwayEra -- ^ The era in which the test runs
253+
-> NodeConfigFile In
254+
-> SocketPath
255+
-> EpochNo -- ^ The termination epoch: the constitution proposal must be found *before* this epoch
256+
-> Int -- ^ The expected numbers of DReps. If this number is not reached until the termination epoch, this function fails the test.
257+
-> m (Maybe [L.DRepState StandardCrypto]) -- ^ The DReps when the expected number of DReps was attained.
258+
checkDRepsNumber' sbe nodeConfigFile socketPath maxEpoch expectedDRepsNb = do
259+
result <- runExceptT $ foldEpochState nodeConfigFile socketPath QuickValidation maxEpoch Nothing
260+
$ \(AnyNewEpochState actualEra newEpochState) -> do
261+
case testEquality sbe actualEra of
262+
Just Refl -> do
263+
let dreps = Map.elems $ shelleyBasedEraConstraints sbe newEpochState
264+
^. L.nesEsL
265+
. L.esLStateL
266+
. L.lsCertStateL
267+
. L.certVStateL
268+
. L.vsDRepsL
269+
if length dreps == expectedDRepsNb then do
270+
put $ Just dreps
271+
pure ConditionMet
272+
else
273+
pure ConditionNotMet
274+
Nothing -> do
275+
error $ "Eras mismatch! expected: " <> show sbe <> ", actual: " <> show actualEra
276+
case result of
277+
Left (FoldBlocksApplyBlockError (TerminationEpochReached epochNo)) -> do
278+
H.note_ $ unlines
279+
[ "waitDRepsNumber: drep number did not become " <> show expectedDRepsNb <> " before termination epoch: " <> show epochNo
280+
, "This is likely an error of this test." ]
281+
H.failure
282+
Left err -> do
283+
H.note_ $ unlines
284+
[ "waitDRepsNumber: could not reach termination epoch: " <> docToString (prettyError err)
285+
, "This is probably an error unrelated to this test." ]
286+
H.failure
287+
Right (_, val) ->
288+
return val

cardano-testnet/src/Testnet/Process/Cli.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,11 +126,11 @@ cliNodeKeyGen tmpDir vkey skey counter = do
126126
-- returning JSON to stdout, and needs going through a file instead, probably
127127
-- you should add a similar function to this one.
128128
execCliStdoutToJson :: ()
129-
=> (Aeson.FromJSON a, MonadTest m, MonadCatch m, MonadIO m)
129+
=> (HasCallStack, Aeson.FromJSON a, MonadTest m, MonadCatch m, MonadIO m)
130130
=> ExecConfig -- ^ The configuration with which to call the CLI
131131
-> [String] -- ^ The CLI command to execute
132132
-> m a
133-
execCliStdoutToJson execConfig cmd = do
133+
execCliStdoutToJson execConfig cmd = GHC.withFrozenCallStack $ do
134134
result <- execCli' execConfig cmd
135135
H.leftFail $ Aeson.eitherDecode $ Data.String.fromString result
136136

0 commit comments

Comments
 (0)