Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cardano-node 9.2.0 release #5944

Merged
merged 17 commits into from
Sep 18, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
cardano-testnet changes
  • Loading branch information
Jimbo4350 committed Sep 17, 2024
commit 78ecf34db55042b6a0f4583c1b87cbc254ff9e22
1 change: 1 addition & 0 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -66,3 +66,4 @@ allow-newer:
-- IMPORTANT
-- Do NOT add more source-repository-package stanzas here unless they are strictly
-- temporary! Please read the section in CONTRIBUTING about updating dependencies.

8 changes: 4 additions & 4 deletions cardano-node/cardano-node.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ common project-config
-Wpartial-fields
-Wredundant-constraints
-Wunused-packages
common maybe-Win32
if os(windows)
build-depends: Win32
common maybe-Win32
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are some trailing whitespaces, not particularly important

if os(windows)
build-depends: Win32

common maybe-unix
if !os(windows)
Expand All @@ -55,7 +55,7 @@ common text
library
import: project-config
, maybe-unix
, maybe-Win32
, maybe-Win32
, text
if flag(unexpected_thunks)
cpp-options: -DUNEXPECTED_THUNKS
Expand Down
7 changes: 5 additions & 2 deletions cardano-node/src/Cardano/Node/Run.hs
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,18 @@ import qualified Data.Text.IO as Text
import Data.Time.Clock (getCurrentTime)
import Data.Time.Clock.POSIX (utcTimeToPOSIXSeconds)
import Data.Version (showVersion)
import GHC.Weak (deRefWeak)
import Network.HostName (getHostName)
import Network.Socket (Socket)
import System.Directory (canonicalizePath, createDirectoryIfMissing, makeAbsolute)
import System.Environment (lookupEnv)
#ifdef UNIX
import GHC.Weak (deRefWeak)
import System.Posix.Files
import qualified System.Posix.Signals as Signals
import System.Posix.Types (FileMode)

#else
import System.Win32.File
#endif
import Paths_cardano_node (version)


Expand Down
2 changes: 1 addition & 1 deletion cardano-testnet/cardano-testnet.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ library
, cardano-ledger-core:{cardano-ledger-core, testlib}
, cardano-ledger-shelley
, cardano-node
, cardano-ping ^>= 0.2.0.13
, cardano-ping ^>= 0.4
, contra-tracer
, containers
, data-default-class
Expand Down
2 changes: 1 addition & 1 deletion cardano-testnet/src/Testnet/Process/Cli/SPO.hs
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ registerSingleSpo asbe identifier tap@(TmpAbsolutePath tempAbsPath') nodeConfigF

createStakeKeyRegistrationCertificate tap asbe
poolOwnerstakeVkeyFp
2_000_000
0
(workDir </> "pledger.regcert")

void $ execCli' execConfig
Expand Down
4 changes: 2 additions & 2 deletions cardano-testnet/src/Testnet/Runtime.hs
Original file line number Diff line number Diff line change
Expand Up @@ -190,10 +190,10 @@ startNode tp node ipv4 port testnetMagic nodeCmd = GHC.withFrozenCallStack $ do
NodeExecutableError . hsep $
["Socket", pretty socketAbsPath, "was not created after 30 seconds. There was no output on stderr. Exception:", prettyException ioex])
$ hoistEither eSprocketError

-- Ping node and fail on error
Ping.pingNode (fromIntegral testnetMagic) sprocket
>>= (firstExceptT (NodeExecutableError . ("Ping error:" <+>) . prettyError) . hoistEither)
>>= (firstExceptT (NodeExecutableError . ("Ping error:" <+>) . prettyError) . hoistEither)

pure $ NodeRuntime node ipv4 port sprocket stdIn nodeStdoutFile nodeStderrFile hProcess
where
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,16 @@ Available options:
--num-pool-nodes COUNT Number of pool nodes. Note this uses a default node
configuration for all nodes.
(default: [SpoTestnetNodeOptions Nothing [],SpoTestnetNodeOptions Nothing [],SpoTestnetNodeOptions Nothing []])
--shelley-era Specify the Shelley era
--allegra-era Specify the Allegra era
--mary-era Specify the Mary era
--alonzo-era Specify the Alonzo era
--babbage-era Specify the Babbage era (default)
--shelley-era Specify the Shelley era - DEPRECATED - will be
removed in the future
--allegra-era Specify the Allegra era - DEPRECATED - will be
removed in the future
--mary-era Specify the Mary era - DEPRECATED - will be removed
in the future
--alonzo-era Specify the Alonzo era - DEPRECATED - will be removed
in the future
--babbage-era Specify the Babbage era (default) - DEPRECATED - will
be removed in the future
--conway-era Specify the Conway era
--max-lovelace-supply WORD64
Max lovelace supply that your testnet starts with.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ import qualified Hedgehog.Extras as H
-- Certifying YES
-- Voting NO
-- Proposing NO
-- Execute me with:
-- @DISABLE_RETRIES=1 cabal test cardano-testnet-test --test-options '-p "/PlutusV3/"'@
hprop_plutus_v3 :: Property
hprop_plutus_v3 = integrationWorkspace "all-plutus-script-purposes" $ \tempAbsBasePath' -> H.runWithDefaultWatchdog_ $ do
H.note_ SYS.os
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@ import qualified Hedgehog.Extras.Test.Base as H
import qualified Hedgehog.Extras.Test.File as H
import qualified Hedgehog.Extras.Test.TestWatchdog as H


-- | Execute me with:
-- @DISABLE_RETRIES=1 cabal test cardano-testnet-test --test-options '-p "/kes-period-info/"'@
hprop_kes_period_info :: Property
hprop_kes_period_info = integrationRetryWorkspace 2 "kes-period-info" $ \tempAbsBasePath' -> H.runWithDefaultWatchdog_ $ do
H.note_ SYS.os
Expand All @@ -57,8 +60,7 @@ hprop_kes_period_info = integrationRetryWorkspace 2 "kes-period-info" $ \tempAbs
<- mkConf tempAbsBasePath'

let tempBaseAbsPath = makeTmpBaseAbsPath tempAbsPath
sbe = ShelleyBasedEraBabbage -- TODO: We should only support the latest era and the upcoming era
asbe = AnyShelleyBasedEra sbe
sbe = ShelleyBasedEraConway
eraString = eraToString sbe
cTestnetOptions = def { cardanoNodeEra = asbe }

Expand Down Expand Up @@ -95,7 +97,9 @@ hprop_kes_period_info = integrationRetryWorkspace 2 "kes-period-info" $ \tempAbs
testnetMagic
execConfig
(txin1, utxoSKeyFile, utxoAddr)


H.noteShow_ $ "Test SPO stake pool id: " <> stakePoolId

-- Create test stake address to delegate to the new stake pool
-- NB: We need to fund the payment credential of the overall address
--------------------------------------------------------------
Expand Down Expand Up @@ -135,7 +139,7 @@ hprop_kes_period_info = integrationRetryWorkspace 2 "kes-period-info" $ \tempAbs
tempAbsPath
(cardanoNodeEra cTestnetOptions)
testDelegatorVkeyFp
2_000_000
0
testDelegatorRegCertFp

-- Test stake address deleg cert
Expand Down Expand Up @@ -340,6 +344,8 @@ hprop_kes_period_info = integrationRetryWorkspace 2 "kes-period-info" $ \tempAbs
[ "query", "stake-snapshot"
, "--all-stake-pools"
]

-- TODO: Create a check here that confirms there are four stake pools and each has stake!
H.writeFile (work </> "stake-snapshot-2.json") stakeSnapshot2

ledgerStateJson2 <- execCli' execConfig
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-}
{- HLINT ignore "Redundant id" -}

module Cardano.Testnet.Test.Cli.Babbage.LeadershipSchedule
module Cardano.Testnet.Test.Cli.LeadershipSchedule
( hprop_leadershipSchedule
) where

Expand Down Expand Up @@ -56,13 +56,15 @@ import qualified Hedgehog.Extras.Test.TestWatchdog as H
-- | Execute me with:
-- @DISABLE_RETRIES=1 cabal test cardano-testnet-test --test-options '-p "/leadership-schedule/"'@
hprop_leadershipSchedule :: Property
hprop_leadershipSchedule = integrationRetryWorkspace 2 "babbage-leadership-schedule" $ \tempAbsBasePath' -> H.runWithDefaultWatchdog_ $ do
hprop_leadershipSchedule = integrationRetryWorkspace 2 "leadership-schedule" $ \tempAbsBasePath' -> H.runWithDefaultWatchdog_ $ do
H.note_ SYS.os
conf@Conf { tempAbsPath=tempAbsPath@(TmpAbsolutePath work) } <- mkConf tempAbsBasePath'
let tempBaseAbsPath = makeTmpBaseAbsPath tempAbsPath
sbe = shelleyBasedEra @BabbageEra -- TODO: We should only support the latest era and the upcoming era
sbe = shelleyBasedEra @ConwayEra -- TODO: We should only support the latest era and the upcoming era
asbe = AnyShelleyBasedEra sbe
cTestnetOptions = def { cardanoNodeEra = asbe }
sbe = shelleyBasedEra @ConwayEra
eraString = eraToString sbe

tr@TestnetRuntime
{ testnetMagic
Expand All @@ -78,7 +80,7 @@ hprop_leadershipSchedule = integrationRetryWorkspace 2 "babbage-leadership-sched
let utxoAddr = Text.unpack $ paymentKeyInfoAddr wallet0
utxoSKeyFile = signingKeyFp $ paymentKeyInfoPair wallet0
void $ execCli' execConfig
[ "conway", "query", "utxo"
[ eraString, "query", "utxo"
, "--address", utxoAddr
, "--cardano-mode"
, "--out-file", work </> "utxo-1.json"
Expand Down Expand Up @@ -137,7 +139,7 @@ hprop_leadershipSchedule = integrationRetryWorkspace 2 "babbage-leadership-sched
tempAbsPath
(cardanoNodeEra cTestnetOptions)
testDelegatorVkeyFp
2_000_000
0
testDelegatorRegCertFp

-- Test stake address deleg cert
Expand All @@ -164,8 +166,7 @@ hprop_leadershipSchedule = integrationRetryWorkspace 2 "babbage-leadership-sched
UTxO utxo2 <- H.noteShowM $ decodeEraUTxO sbe utxo2Json
txin2 <- H.noteShow =<< H.headM (Map.keys utxo2)

let eraString = eraToString sbe
delegRegTestDelegatorTxBodyFp = work </> "deleg-register-test-delegator.txbody"
let delegRegTestDelegatorTxBodyFp = work </> "deleg-register-test-delegator.txbody"

void $ execCli' execConfig
[ eraString
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,14 @@ import GHC.Exts (IsList (..))
import GHC.Stack (HasCallStack, withFrozenCallStack)
import qualified GHC.Stack as GHC
import Lens.Micro ((^.))
import System.Directory (makeAbsolute)
import System.FilePath ((</>))

import Testnet.Components.Configuration (eraToString)
import Testnet.Components.Query (EpochStateView, checkDRepsNumber, getEpochStateView,
watchEpochStateUpdate)
import qualified Testnet.Defaults as Defaults
import Testnet.Process.Cli.Transaction (TxOutAddress (ReferenceScriptAddress),
mkSimpleSpendOutputsOnlyTx, mkSpendOutputsOnlyTx, retrieveTransactionId, signTx,
import Testnet.Process.Cli.Transaction (
mkSimpleSpendOutputsOnlyTx, retrieveTransactionId, signTx,
submitTx)
import Testnet.Process.Run (execCli', execCliStdoutToJson, mkExecConfig)
import Testnet.Property.Assert (assertErasEqual)
Expand Down Expand Up @@ -161,11 +160,6 @@ hprop_cli_queries = integrationWorkspace "cli-queries" $ \tempAbsBasePath' -> H.
protocolParametersOutFile
"test/cardano-testnet-test/files/golden/queries/protocolParametersFileOut.json"

TestQueryConstitutionHashCmd ->
-- constitution-hash
-- Currently disabled (not accessible from the command line)
pure ()

TestQueryTipCmd ->
-- tip
do
Expand Down Expand Up @@ -334,30 +328,31 @@ hprop_cli_queries = integrationWorkspace "cli-queries" $ \tempAbsBasePath' -> H.
-- This is tested in hprop_querySlotNumber in Cardano.Testnet.Test.Cli.QuerySlotNumber
pure ()

TestQueryRefScriptSizeCmd ->
-- ref-script-size
do
-- Set up files and vars
refScriptSizeWork <- H.createDirectoryIfMissing $ work </> "ref-script-size-test"
plutusV3Script <- File <$> liftIO (makeAbsolute "test/cardano-testnet-test/files/plutus/v3/always-succeeds.plutus")
let transferAmount = Coin 10_000_000
-- Submit a transaction to publish the reference script
txBody <- mkSpendOutputsOnlyTx execConfig epochStateView sbe refScriptSizeWork "tx-body" wallet1
[(ReferenceScriptAddress plutusV3Script, transferAmount)]
signedTx <- signTx execConfig cEra refScriptSizeWork "signed-tx" txBody [SomeKeyPair $ paymentKeyInfoPair wallet1]
submitTx execConfig cEra signedTx
-- Wait until transaction is on chain and obtain transaction identifier
txId <- retrieveTransactionId execConfig signedTx
txIx <- H.evalMaybeM $ watchEpochStateUpdate epochStateView (EpochInterval 2) (getTxIx sbe txId transferAmount)
-- Query the reference script size
let protocolParametersOutFile = refScriptSizeWork </> "ref-script-size-out.json"
H.noteM_ $ execCli' execConfig [ eraName, "query", "ref-script-size"
, "--tx-in", txId ++ "#" ++ show (txIx :: Int)
, "--out-file", protocolParametersOutFile
]
H.diffFileVsGoldenFile
protocolParametersOutFile
"test/cardano-testnet-test/files/golden/queries/refScriptSizeOut.json"

TestQueryRefScriptSizeCmd -> pure () -- TODO: Failing intermittently cardano-node-9.2
-- -- ref-script-size
-- do
-- -- Set up files and vars
-- refScriptSizeWork <- H.createDirectoryIfMissing $ work </> "ref-script-size-test"
-- plutusV3Script <- File <$> liftIO (makeAbsolute "test/cardano-testnet-test/files/plutus/v3/always-succeeds.plutus")
-- let transferAmount = Coin 10_000_000
-- -- Submit a transaction to publish the reference script
-- txBody <- mkSpendOutputsOnlyTx execConfig epochStateView sbe refScriptSizeWork "tx-body" wallet1
-- [(ReferenceScriptAddress plutusV3Script, transferAmount)]
-- signedTx <- signTx execConfig cEra refScriptSizeWork "signed-tx" txBody [SomeKeyPair $ paymentKeyInfoPair wallet1]
-- submitTx execConfig cEra signedTx
-- -- Wait until transaction is on chain and obtain transaction identifier
-- txId <- retrieveTransactionId execConfig signedTx
-- txIx <- H.evalMaybeM $ watchEpochStateUpdate epochStateView (EpochInterval 2) (getTxIx sbe txId transferAmount)
-- -- Query the reference script size
-- let protocolParametersOutFile = refScriptSizeWork </> "ref-script-size-out.json"
-- H.noteM_ $ execCli' execConfig [ eraName, "query", "ref-script-size"
-- , "--tx-in", txId ++ "#" ++ show (txIx :: Int)
-- , "--out-file", protocolParametersOutFile
-- ]
-- H.diffFileVsGoldenFile
-- protocolParametersOutFile
-- "test/cardano-testnet-test/files/golden/queries/refScriptSizeOut.json"

TestQueryConstitutionCmd ->
-- constitution
Expand Down Expand Up @@ -470,8 +465,8 @@ hprop_cli_queries = integrationWorkspace "cli-queries" $ \tempAbsBasePath' -> H.
verificationStakeKeyToStakeAddress testnetMagic delegatorVKey =
makeStakeAddress (fromNetworkMagic $ NetworkMagic $ fromIntegral testnetMagic) (StakeCredentialByKey $ verificationKeyHash delegatorVKey)

getTxIx :: forall m era. HasCallStack => MonadTest m => ShelleyBasedEra era -> String -> Coin -> (AnyNewEpochState, SlotNo, BlockNo) -> m (Maybe Int)
getTxIx sbe txId amount (AnyNewEpochState sbe' newEpochState, _, _) = do
_getTxIx :: forall m era. HasCallStack => MonadTest m => ShelleyBasedEra era -> String -> Coin -> (AnyNewEpochState, SlotNo, BlockNo) -> m (Maybe Int)
_getTxIx sbe txId amount (AnyNewEpochState sbe' newEpochState, _, _) = do
Refl <- H.leftFail $ assertErasEqual sbe sbe'
shelleyBasedEraConstraints sbe' (do
return $ Map.foldlWithKey (\acc (L.TxIn (L.TxId thisTxId) (L.TxIx thisTxIx)) txOut ->
Expand Down Expand Up @@ -519,4 +514,4 @@ redactJsonFields changes v =
Aeson.Array $ Vector.map recurse vector
_ -> v
where
recurse = redactJsonFields changes
recurse = redactJsonFields changes
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE ScopedTypeVariables #-}

module Cardano.Testnet.Test.Cli.Babbage.StakeSnapshot
module Cardano.Testnet.Test.Cli.StakeSnapshot
( hprop_stakeSnapshot
) where

Expand Down Expand Up @@ -31,7 +31,7 @@ import qualified Hedgehog.Extras.Test.Base as H
import qualified Hedgehog.Extras.Test.TestWatchdog as H

hprop_stakeSnapshot :: Property
hprop_stakeSnapshot = integrationRetryWorkspace 2 "babbage-stake-snapshot" $ \tempAbsBasePath' -> H.runWithDefaultWatchdog_ $ do
hprop_stakeSnapshot = integrationRetryWorkspace 2 "stake-snapshot" $ \tempAbsBasePath' -> H.runWithDefaultWatchdog_ $ do
H.note_ SYS.os
conf@Conf { tempAbsPath } <- mkConf tempAbsBasePath'
let tempAbsPath' = unTmpAbsPath tempAbsPath
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}

module Cardano.Testnet.Test.Cli.Babbage.Transaction
module Cardano.Testnet.Test.Cli.Transaction
( hprop_transaction
) where

Expand Down Expand Up @@ -40,15 +40,20 @@ import qualified Hedgehog.Extras.Test.Base as H
import qualified Hedgehog.Extras.Test.File as H
import qualified Hedgehog.Extras.Test.TestWatchdog as H


-- | Execute me with:
-- @DISABLE_RETRIES=1 cabal test cardano-testnet-test --test-options '-p "/simple transaction build/"'@
hprop_transaction :: Property
hprop_transaction = integrationRetryWorkspace 0 "babbage-transaction" $ \tempAbsBasePath' -> H.runWithDefaultWatchdog_ $ do
hprop_transaction = integrationRetryWorkspace 0 "simple transaction build" $ \tempAbsBasePath' -> H.runWithDefaultWatchdog_ $ do
H.note_ SYS.os
conf@Conf { tempAbsPath } <- mkConf tempAbsBasePath'
let tempAbsPath' = unTmpAbsPath tempAbsPath
work <- H.createDirectoryIfMissing $ tempAbsPath' </> "work"

let
sbe = ShelleyBasedEraBabbage -- TODO: We should only support the latest era and the upcoming era
sbe = ShelleyBasedEraConway
txEra = AsConwayEra
era = toCardanoEra sbe
cEra = AnyCardanoEra era
tempBaseAbsPath = makeTmpBaseAbsPath $ TmpAbsolutePath tempAbsPath'
Expand Down Expand Up @@ -94,14 +99,15 @@ hprop_transaction = integrationRetryWorkspace 0 "babbage-transaction" $ \tempAbs
, "--out-file", txbodyFp
]
cddlUnwitnessedTx <- H.readJsonFileOk txbodyFp
apiTx <- H.evalEither $ deserialiseFromTextEnvelope (AsTx AsBabbageEra) cddlUnwitnessedTx
apiTx <- H.evalEither $ deserialiseFromTextEnvelope (AsTx txEra) cddlUnwitnessedTx
let txFee = L.unCoin $ extractTxFee apiTx

-- This is the current calculated fee.
-- It's a sanity check to see if anything has
-- changed regarding fee calculation.
-- 8.10 changed fee from 228 -> 330
330 H.=== txFee
-- 9.2 changed fee from 330 -> 336
336 H.=== txFee

void $ execCli' execConfig
[ anyEraToString cEra, "transaction", "sign"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ import Testnet.Start.Types (ShelleyTestnetOptions(..))
import Hedgehog
import qualified Hedgehog.Extras as H

-- | Execute me with:
-- @DISABLE_RETRIES=1 cabal test cardano-testnet-test --test-options '-p "/Committee Add New/"'@
hprop_constitutional_committee_add_new :: Property
hprop_constitutional_committee_add_new = integrationWorkspace "constitutional-committee-add-new" $ \tempAbsBasePath' -> H.runWithDefaultWatchdog_ $ do
conf@Conf { tempAbsPath } <- mkConf tempAbsBasePath'
Expand Down
Loading