diff --git a/.changes/20261015_022558_cardano-cli_palas_check_node_configuration_cardano_config.yml b/.changes/20261015_022558_cardano-cli_palas_check_node_configuration_cardano_config.yml new file mode 100644 index 0000000000..632e76aedf --- /dev/null +++ b/.changes/20261015_022558_cardano-cli_palas_check_node_configuration_cardano_config.yml @@ -0,0 +1,12 @@ +project: cardano-cli +pr: 1475 +kind: +- breaking +description: | + `debug check-node-configuration` now reads the configuration with cardano-config. It accepts both the old flat format and the new cardano-config format. + Genesis hashes are now required. Before, a configuration without them was accepted, and only the hashes it gave were checked. + Every genesis file is now decoded, not only hashed. + With `ExperimentalHardForksEnabled`, the configuration must also name a `DijkstraGenesisFile` and its `DijkstraGenesisHash`, and that file is checked too. + The initial data in the Shelley and Conway genesis files, such as `initialFunds`, is now checked too: it is rejected on mainnet, when it is given both at the top level and under `extraConfig`, or when a file it names is missing. + The success message now goes to stderr instead of stdout. + `DebugNodeConfigWrongGenesisHashCmdError` is replaced by `DebugNodeConfigReadCmdError`, which carries the configuration file path and cardano-api's `NodeConfigError`. diff --git a/.gitattributes b/.gitattributes index 891dbb3826..d11bb60c12 100644 --- a/.gitattributes +++ b/.gitattributes @@ -5,4 +5,5 @@ cardano-cli/test/cardano-cli-test/files/input/example_anchor_data2.txt -text cardano-cli/test/cardano-cli-test/files/input/check-node-configuration/genesis.alonzo.spec.json -text cardano-cli/test/cardano-cli-test/files/input/check-node-configuration/genesis.byron.spec.json -text cardano-cli/test/cardano-cli-test/files/input/check-node-configuration/genesis.conway.spec.json -text +cardano-cli/test/cardano-cli-test/files/input/check-node-configuration/genesis.dijkstra.spec.json -text cardano-cli/test/cardano-cli-test/files/input/check-node-configuration/genesis.shelley.spec.json -text diff --git a/cabal.project b/cabal.project index cc4ec9ab5f..66320a8a59 100644 --- a/cabal.project +++ b/cabal.project @@ -14,7 +14,7 @@ repository cardano-haskell-packages -- you need to run if you change them index-state: , hackage.haskell.org 2026-09-02T14:05:07Z - , cardano-haskell-packages 2026-10-13T14:57:01Z + , cardano-haskell-packages 2026-10-21T13:12:35Z packages: cardano-cli diff --git a/cardano-cli/cardano-cli.cabal b/cardano-cli/cardano-cli.cabal index 8fdc9294f6..13c23d2161 100644 --- a/cardano-cli/cardano-cli.cabal +++ b/cardano-cli/cardano-cli.cabal @@ -250,8 +250,9 @@ library binary, bytestring, canonical-json, - cardano-api ^>=11.9, + cardano-api ^>=11.10, cardano-binary, + cardano-config ^>=2.2.2, cardano-crypto, cardano-crypto-class ^>=2.6, cardano-crypto-wrapper ^>=1.8, diff --git a/cardano-cli/src/Cardano/CLI/EraIndependent/Debug/CheckNodeConfiguration/Run.hs b/cardano-cli/src/Cardano/CLI/EraIndependent/Debug/CheckNodeConfiguration/Run.hs index fc2466caf6..d747ddebfb 100644 --- a/cardano-cli/src/Cardano/CLI/EraIndependent/Debug/CheckNodeConfiguration/Run.hs +++ b/cardano-cli/src/Cardano/CLI/EraIndependent/Debug/CheckNodeConfiguration/Run.hs @@ -5,68 +5,23 @@ module Cardano.CLI.EraIndependent.Debug.CheckNodeConfiguration.Run (runCheckNodeConfig) where import Cardano.Api -import Cardano.Api.Byron qualified as Byron import Cardano.CLI.Compatible.Exception import Cardano.CLI.EraIndependent.Debug.CheckNodeConfiguration.Command -import Cardano.CLI.Read qualified as Read import Cardano.CLI.Type.Error.DebugCmdError -import Cardano.Crypto.Hash qualified as Crypto -import Control.Monad -import Data.Foldable (for_) -import Data.Text qualified as Text -import Data.Yaml qualified as Yaml -import System.FilePath +import System.IO qualified as IO +-- | Check a node configuration file by reading it the way 'readNodeConfig' +-- does: every genesis file it names must exist, decode, and match the hash the +-- configuration gives for it. runCheckNodeConfig :: CheckNodeConfigCmdArgs -> CIO e () runCheckNodeConfig (CheckNodeConfigCmdArgs configFile) = do - nodeConfig :: NodeConfig <- liftIO $ Yaml.decodeFileThrow configFilePath - checkNodeGenesisConfiguration configFile nodeConfig - liftIO $ putStrLn $ "Successfully checked node configuration file: " <> configFilePath + _ <- + fromExceptTCli . modifyError (DebugNodeConfigReadCmdError configFilePath) $ + readNodeConfig configFile + liftIO $ + IO.hPutStrLn IO.stderr $ + "Successfully checked node configuration file: " <> configFilePath where configFilePath = unFile configFile - -checkNodeGenesisConfiguration - :: NodeConfigFile 'In - -- ^ The node configuration file path. It's not read by this function, but used for producing error messages. - -> NodeConfig - -- ^ The parsed node configuration file - -> CIO e () -checkNodeGenesisConfiguration configFile nodeConfig = do - let byronGenFile = adjustFilepath $ ncByronGenesisFile nodeConfig - alonzoGenFile = adjustFilepath $ ncAlonzoGenesisFile nodeConfig - shelleyGenFile = adjustFilepath $ ncShelleyGenesisFile nodeConfig - conwayGenFile = adjustFilepath $ ncConwayGenesisFile nodeConfig - - liftIO $ putStrLn $ "Checking byron genesis file: " <> byronGenFile - - let mExpectedByronHash = unGenesisHashByron <$> ncByronGenesisHash nodeConfig - mExpectedAlonzoHash = Crypto.hashToTextAsHex . unGenesisHashAlonzo <$> ncAlonzoGenesisHash nodeConfig - mExpectedShelleyHash = Crypto.hashToTextAsHex . unGenesisHashShelley <$> ncShelleyGenesisHash nodeConfig - mExpectedConwayHash = Crypto.hashToTextAsHex . unGenesisHashConway <$> ncConwayGenesisHash nodeConfig - - (_, Byron.GenesisHash byronHash) <- fromExceptTCli $ Byron.readGenesisData byronGenFile - let actualByronHash = Text.pack $ show byronHash - actualAlonzoHash <- Crypto.hashToTextAsHex <$> Read.readShelleyOnwardsGenesisAndHash alonzoGenFile - actualShelleyHash <- Crypto.hashToTextAsHex <$> Read.readShelleyOnwardsGenesisAndHash shelleyGenFile - actualConwayHash <- Crypto.hashToTextAsHex <$> Read.readShelleyOnwardsGenesisAndHash conwayGenFile - - -- check only hashes which were specified for the genesis - for_ - [ (mExpectedByronHash, actualByronHash, byronGenFile) - , (mExpectedShelleyHash, actualShelleyHash, shelleyGenFile) - , (mExpectedAlonzoHash, actualAlonzoHash, alonzoGenFile) - , (mExpectedConwayHash, actualConwayHash, conwayGenFile) - ] - $ \(mExpected, actual, genFile) -> - for_ mExpected $ \expected -> - when (actual /= expected) $ - throwCliError $ - DebugNodeConfigWrongGenesisHashCmdError configFilePath genFile actual expected - where - configFilePath = unFile configFile - -- We make the genesis filepath relative to the node configuration file, like the node does: - -- https://github.com/IntersectMBO/cardano-node/blob/9671e7b6a1b91f5a530722937949b86deafaad43/cardano-node/src/Cardano/Node/Configuration/POM.hs#L668 - -- Note that, if the genesis filepath is absolute, the node configuration file's directory is ignored (by property of ) - adjustFilepath (File f) = takeDirectory configFilePath f diff --git a/cardano-cli/src/Cardano/CLI/Type/Error/DebugCmdError.hs b/cardano-cli/src/Cardano/CLI/Type/Error/DebugCmdError.hs index 974a58682a..b1e0c02e1c 100644 --- a/cardano-cli/src/Cardano/CLI/Type/Error/DebugCmdError.hs +++ b/cardano-cli/src/Cardano/CLI/Type/Error/DebugCmdError.hs @@ -7,9 +7,13 @@ where import Cardano.Api import Cardano.Api.Byron qualified as Byron +import Cardano.Api.Ledger qualified as L import Cardano.CLI.Type.Error.TxCmdError +import Cardano.Configuration qualified as Cfg +import Data.Aeson.Key qualified as Aeson +import Data.Aeson.Types qualified as Aeson import Data.Text.Lazy.Builder qualified as Text import Formatting.Buildable (build) @@ -18,17 +22,13 @@ data DebugCmdError | -- | @DebugNodeConfigGenesisDataCmdError filepath error@ represents an error when -- reading the node configuration at @filepath@ DebugNodeConfigGenesisDataCmdError !FilePath !Byron.GenesisDataError - | -- | @DebugNodeConfigWrongGenesisHashCmdError filepath eraGenesisPath actualHash expectedHash@ represents a user error - -- that the hash of @eraGenesisPath@ in @filepath@ is @actualHash@, whereas it should be @expectedHash@ - DebugNodeConfigWrongGenesisHashCmdError + | -- | @DebugNodeConfigReadCmdError filepath error@ represents an error when + -- reading the node configuration at @filepath@, or the genesis files it names + DebugNodeConfigReadCmdError !FilePath -- ^ The file path of the node configuration file - !FilePath - -- ^ The file path of the era configuration file whose hash is wrong - !Text - -- ^ The actual hash (the hash found by hashing the genesis file) - !Text - -- ^ The expected hash (the hash mentioned in the configuration file) + !NodeConfigError + -- ^ The error from reading the node configuration or a genesis file it names | DebugTxCmdError !TxCmdError deriving Show @@ -40,13 +40,26 @@ instance Error DebugCmdError where <> pretty fp <> ": " <> pretty (Text.toLazyText $ build err) - DebugNodeConfigWrongGenesisHashCmdError nodeFp genesisFp actualHash expectedHash -> - "Wrong genesis hash for " - <> pretty genesisFp - <> " in " - <> pretty nodeFp - <> ": when computing the hash, got: " - <> pretty actualHash - <> ", but the node configuration files states that this hash is expected: " - <> pretty expectedHash + DebugNodeConfigReadCmdError fp err -> case err of + -- cardano-config says which genesis file is at fault, and which key names it + NodeConfigParsingError + Cfg.ConfigurationParsingError + { Cfg.errFile = L.SJust genesisFp + , Cfg.errPath = [Aeson.Key key] + , Cfg.errMessage = message + } + | genesisFp /= fp -> + "Error reading the genesis file " + <> pretty genesisFp + <> " (" + <> pretty (Aeson.toText key) + <> " in " + <> pretty fp + <> "): " + <> pretty message + _ -> + "Error reading node configuration at: " + <> pretty fp + <> ": " + <> prettyError err DebugTxCmdError err -> renderTxCmdError err diff --git a/cardano-cli/test/cardano-cli-test/Test/Cli/CheckNodeConfiguration.hs b/cardano-cli/test/cardano-cli-test/Test/Cli/CheckNodeConfiguration.hs index a9d9a714da..be8ad235fe 100644 --- a/cardano-cli/test/cardano-cli-test/Test/Cli/CheckNodeConfiguration.hs +++ b/cardano-cli/test/cardano-cli-test/Test/Cli/CheckNodeConfiguration.hs @@ -6,6 +6,7 @@ module Test.Cli.CheckNodeConfiguration where import Cardano.Api import Control.Monad (forM_) +import Control.Monad.Catch (MonadCatch) import Data.Aeson qualified as Aeson import Data.Aeson.Encode.Pretty qualified as Aeson import Data.Aeson.Key qualified as Aeson @@ -15,30 +16,42 @@ import Data.List (isInfixOf) import Data.Text qualified as Text import Data.Yaml qualified as Yaml import GHC.IO.Exception (ExitCode (..)) +import GHC.Stack (HasCallStack) import System.FilePath (()) import Test.Cardano.CLI.Util (execCardanoCLI, execDetailCardanoCLI, watchdogProp) -import Hedgehog (Property) +import Hedgehog (MonadTest, Property) import Hedgehog qualified as H import Hedgehog.Extras (propertyOnce) import Hedgehog.Extras qualified as H -nodeConfigFile :: FilePath -nodeConfigFile = "test/cardano-cli-test/files/input/check-node-configuration/node-config.json" +-- | The directory with the node configurations and genesis files of these tests. +inputDir :: FilePath +inputDir = "test/cardano-cli-test/files/input/check-node-configuration" + +-- | The hash of @genesis.alonzo.spec.json@. +alonzoGenesisHash :: Text.Text +alonzoGenesisHash = "2418fe881f57d2f5851a018214634aa6d1b7f10f130c3bdf8c13210c0ed2fd02" + +-- | The hash of @genesis.dijkstra.spec.json@. +dijkstraGenesisHash :: Text.Text +dijkstraGenesisHash = "448c52809fdd686b4085adb78668b3708ba5b83846933f7f8f38ac1aa12ebcf6" -- Execute this test with: -- @cabal test cardano-cli-test --test-options '-p "/check node configuration success/"'@ hprop_check_node_configuration_success :: Property hprop_check_node_configuration_success = watchdogProp . propertyOnce $ do - H.noteM_ $ - execCardanoCLI - [ "debug" - , "check-node-configuration" - , "--node-configuration-file" - , nodeConfigFile - ] + -- node-config-envelope.json uses the same genesis files, in the new cardano-config format + forM_ ["node-config.json", "node-config.yaml", "node-config-envelope.json"] $ \nodeConfigFile -> + H.noteM_ $ + execCardanoCLI + [ "debug" + , "check-node-configuration" + , "--node-configuration-file" + , inputDir nodeConfigFile + ] data FiddleKind = FiddleByron @@ -52,63 +65,153 @@ hprop_check_node_configuration_failure = do let supplyValues :: [(FilePath, FiddleKind)] = [ (path, fiddleKind) | path <- - [ "test/cardano-cli-test/files/input/check-node-configuration/node-config.json" - , "test/cardano-cli-test/files/input/check-node-configuration/node-config.yaml" + [ inputDir "node-config.json" + , inputDir "node-config.yaml" ] , fiddleKind <- [minBound .. maxBound] ] watchdogProp . propertyOnce $ forM_ supplyValues $ \(nodeConfigPath, fiddleKind) -> H.moduleWorkspace "tmp" $ \tempDir -> do - let finalInputConfig = tempDir "node-config-changed.json" - -- TODO why is that writing to "AlonzoGenesisHash" writes one more 0 than specified here? (and hence the need for this hack) - wrongHash = Text.pack $ replicate (case fiddleKind of FiddleByron -> 65; FiddleNonByron -> 64) '0' - - -- Install the genesis files in the sandbox - forM_ - [AnyCardanoEra ByronEra, AnyCardanoEra AlonzoEra, AnyCardanoEra ConwayEra, AnyCardanoEra ShelleyEra] - $ \(AnyCardanoEra era) -> do - let filename = Text.unpack $ "genesis." <> Text.toLower (eraToStringKey era) <> ".spec.json" - genesisFile = "test/cardano-cli-test/files/input/check-node-configuration" filename - H.copyFile genesisFile (tempDir filename) - - -- We make a hash value incorrect, and check that - -- check-node-configuration fails. - - nodeConfigValue :: Aeson.Value <- Yaml.decodeFileThrow nodeConfigPath - nodeConfigObject :: Aeson.Object <- - case nodeConfigValue of - Aeson.Object obj -> pure obj - _ -> - do - H.note_ "Expected an Object, but got something else" - H.failure + -- TODO why is that writing to "AlonzoGenesisHash" writes one more 0 than specified here? (and hence the need for this hack) + let wrongHash = Text.pack $ replicate (case fiddleKind of FiddleByron -> 65; FiddleNonByron -> 64) '0' + fiddledEraKey = + Aeson.fromText $ eraToGenesisHashKey $ case fiddleKind of + FiddleByron -> AnyCardanoEra ByronEra + FiddleNonByron -> AnyCardanoEra AlonzoEra -- We make a hash value incorrect, and check that -- check-node-configuration finds the mistake. + finalInputConfig <- + writeChangedNodeConfig tempDir nodeConfigPath $ + Aeson.insert fiddledEraKey (Aeson.String wrongHash) + + stderr <- checkNodeConfigurationFails finalInputConfig + -- The 65-character Byron hash is not a hash at all, so the configuration is + -- at fault. The Alonzo hash is a well-formed hash of something else, so the + -- Alonzo genesis file is. + forM_ + ( case fiddleKind of + FiddleByron -> ["Error reading node configuration", "ByronGenesisHash"] + FiddleNonByron -> + [ "Error reading the genesis file" + , "genesis.alonzo.spec.json" + , "AlonzoGenesisFile" + , Text.unpack alonzoGenesisHash + , Text.unpack wrongHash + ] + ) + $ \expected -> H.assertWith stderr (expected `isInfixOf`) - -- Prepare file with incorrect hash +-- Execute this test with: +-- @cabal test cardano-cli-test --test-options '-p "/check node configuration missing hash/"'@ +hprop_check_node_configuration_missing_hash :: Property +hprop_check_node_configuration_missing_hash = + watchdogProp . propertyOnce $ do + let eras = + [AnyCardanoEra ByronEra, AnyCardanoEra ShelleyEra, AnyCardanoEra AlonzoEra, AnyCardanoEra ConwayEra] + forM_ eras $ \era -> H.moduleWorkspace "tmp" $ \tempDir -> do + let hashKey = eraToGenesisHashKey era - let fiddledEraKey = - Aeson.fromText $ eraToGenesisHashKey $ case fiddleKind of - FiddleByron -> AnyCardanoEra ByronEra - FiddleNonByron -> AnyCardanoEra AlonzoEra - finalConfigObject = - Aeson.Object $ Aeson.insert fiddledEraKey (Aeson.String wrongHash) nodeConfigObject + -- We remove the hash of one genesis file + finalInputConfig <- + writeChangedNodeConfig tempDir (inputDir "node-config.json") $ + Aeson.delete (Aeson.fromText hashKey) - -- Write file with incorrect hash - liftIO $ LBS.writeFile finalInputConfig $ Aeson.encodePretty finalConfigObject + stderr <- checkNodeConfigurationFails finalInputConfig + H.assertWith stderr (Text.unpack hashKey `isInfixOf`) - (exitCode, _stdout, stderr) <- - H.noteShowM $ - execDetailCardanoCLI +-- Execute this test with: +-- @cabal test cardano-cli-test --test-options '-p "/check node configuration dijkstra/"'@ +hprop_check_node_configuration_dijkstra :: Property +hprop_check_node_configuration_dijkstra = + watchdogProp . propertyOnce $ do + -- With ExperimentalHardForksEnabled, the Dijkstra genesis is read too + let enableDijkstra = + Aeson.insert "ExperimentalHardForksEnabled" (Aeson.Bool True) + withDijkstraGenesis hash = + Aeson.insert "DijkstraGenesisFile" "genesis.dijkstra.spec.json" + . Aeson.insert "DijkstraGenesisHash" (Aeson.String hash) + wrongHash = Text.pack $ replicate 64 '0' + + -- The right hash + H.moduleWorkspace "tmp" $ \tempDir -> do + finalInputConfig <- + writeChangedNodeConfig tempDir (inputDir "node-config.json") $ + enableDijkstra . withDijkstraGenesis dijkstraGenesisHash + H.noteM_ $ + execCardanoCLI [ "debug" , "check-node-configuration" , "--node-configuration-file" , finalInputConfig ] - -- H.success -- Temporarily disabled. - H.assertWith exitCode (ExitSuccess /=) - H.assertWith stderr ("Wrong genesis hash" `isInfixOf`) + + -- A wrong hash + H.moduleWorkspace "tmp" $ \tempDir -> do + finalInputConfig <- + writeChangedNodeConfig tempDir (inputDir "node-config.json") $ + enableDijkstra . withDijkstraGenesis wrongHash + stderr <- checkNodeConfigurationFails finalInputConfig + forM_ ["genesis.dijkstra.spec.json", dijkstraGenesisHash, wrongHash] $ \expected -> + H.assertWith stderr (Text.unpack expected `isInfixOf`) + + -- No Dijkstra genesis + H.moduleWorkspace "tmp" $ \tempDir -> do + finalInputConfig <- + writeChangedNodeConfig tempDir (inputDir "node-config.json") enableDijkstra + stderr <- checkNodeConfigurationFails finalInputConfig + H.assertWith stderr ("DijkstraGenesisFile" `isInfixOf`) + +-- | Copy the genesis files to the given directory, and write there the given +-- node configuration, changed by the given function. Returns the path of the +-- changed node configuration. +writeChangedNodeConfig + :: (HasCallStack, MonadIO m, MonadTest m) + => FilePath + -- ^ The directory to write to + -> FilePath + -- ^ The node configuration to change (JSON or YAML) + -> (Aeson.Object -> Aeson.Object) + -- ^ The change + -> m FilePath +writeChangedNodeConfig tempDir nodeConfigPath change = do + let finalInputConfig = tempDir "node-config-changed.json" + + -- Install the genesis files in the sandbox + forM_ ["byron", "shelley", "alonzo", "conway", "dijkstra"] $ \era -> do + let filename = "genesis." <> era <> ".spec.json" + H.copyFile (inputDir filename) (tempDir filename) + + nodeConfigValue :: Aeson.Value <- Yaml.decodeFileThrow nodeConfigPath + nodeConfigObject :: Aeson.Object <- + case nodeConfigValue of + Aeson.Object obj -> pure obj + _ -> + do + H.note_ "Expected an Object, but got something else" + H.failure + + let finalConfigObject = Aeson.Object $ change nodeConfigObject + liftIO $ LBS.writeFile finalInputConfig $ Aeson.encodePretty finalConfigObject + pure finalInputConfig + +-- | Run check-node-configuration on the given node configuration, check that it +-- fails, and return its stderr. +checkNodeConfigurationFails + :: (HasCallStack, MonadIO m, MonadTest m, MonadCatch m) + => FilePath + -> m String +checkNodeConfigurationFails nodeConfigFile = do + (exitCode, _stdout, stderr) <- + H.noteShowM $ + execDetailCardanoCLI + [ "debug" + , "check-node-configuration" + , "--node-configuration-file" + , nodeConfigFile + ] + H.assertWith exitCode (ExitSuccess /=) + pure stderr -- | The JSON key of the genesis hash for the given era. eraToGenesisHashKey :: AnyCardanoEra -> Text.Text diff --git a/cardano-cli/test/cardano-cli-test/files/input/check-node-configuration/genesis.conway.spec.json b/cardano-cli/test/cardano-cli-test/files/input/check-node-configuration/genesis.conway.spec.json index cb36a9387f..760995a34d 100644 --- a/cardano-cli/test/cardano-cli-test/files/input/check-node-configuration/genesis.conway.spec.json +++ b/cardano-cli/test/cardano-cli-test/files/input/check-node-configuration/genesis.conway.spec.json @@ -1,42 +1,303 @@ { "poolVotingThresholds": { - "committeeNormal": 0, - "committeeNoConfidence": 0, - "hardForkInitiation": 0, - "motionNoConfidence": 0, - "ppSecurityGroup": 0 + "committeeNormal": 0.51, + "committeeNoConfidence": 0.51, + "hardForkInitiation": 0.51, + "motionNoConfidence": 0.51, + "ppSecurityGroup": 0.51 }, "dRepVotingThresholds": { - "motionNoConfidence": 0, - "committeeNormal": 0, - "committeeNoConfidence": 0, - "updateToConstitution": 0, - "hardForkInitiation": 0, - "ppNetworkGroup": 0, - "ppEconomicGroup": 0, - "ppTechnicalGroup": 0, - "ppGovGroup": 0, - "treasuryWithdrawal": 0 + "motionNoConfidence": 0.67, + "committeeNormal": 0.67, + "committeeNoConfidence": 0.6, + "updateToConstitution": 0.75, + "hardForkInitiation": 0.6, + "ppNetworkGroup": 0.67, + "ppEconomicGroup": 0.67, + "ppTechnicalGroup": 0.67, + "ppGovGroup": 0.75, + "treasuryWithdrawal": 0.67 }, - "committeeMinSize": 0, - "committeeMaxTermLength": 0, - "govActionLifetime": 0, - "govActionDeposit": 0, - "dRepDeposit": 0, - "dRepActivity": 0, - "minFeeRefScriptCostPerByte": 0, - "plutusV3CostModel": [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0], + "committeeMinSize": 7, + "committeeMaxTermLength": 146, + "govActionLifetime": 6, + "govActionDeposit": 100000000000, + "dRepDeposit": 500000000, + "dRepActivity": 20, + "minFeeRefScriptCostPerByte": 15, + "plutusV3CostModel": [ + 100788, + 420, + 1, + 1, + 1000, + 173, + 0, + 1, + 1000, + 59957, + 4, + 1, + 11183, + 32, + 201305, + 8356, + 4, + 16000, + 100, + 16000, + 100, + 16000, + 100, + 16000, + 100, + 16000, + 100, + 16000, + 100, + 100, + 100, + 16000, + 100, + 94375, + 32, + 132994, + 32, + 61462, + 4, + 72010, + 178, + 0, + 1, + 22151, + 32, + 91189, + 769, + 4, + 2, + 85848, + 123203, + 7305, + -900, + 1716, + 549, + 57, + 85848, + 0, + 1, + 1, + 1000, + 42921, + 4, + 2, + 24548, + 29498, + 38, + 1, + 898148, + 27279, + 1, + 51775, + 558, + 1, + 39184, + 1000, + 60594, + 1, + 141895, + 32, + 83150, + 32, + 15299, + 32, + 76049, + 1, + 13169, + 4, + 22100, + 10, + 28999, + 74, + 1, + 28999, + 74, + 1, + 43285, + 552, + 1, + 44749, + 541, + 1, + 33852, + 32, + 68246, + 32, + 72362, + 32, + 7243, + 32, + 7391, + 32, + 11546, + 32, + 85848, + 123203, + 7305, + -900, + 1716, + 549, + 57, + 85848, + 0, + 1, + 90434, + 519, + 0, + 1, + 74433, + 32, + 85848, + 123203, + 7305, + -900, + 1716, + 549, + 57, + 85848, + 0, + 1, + 1, + 85848, + 123203, + 7305, + -900, + 1716, + 549, + 57, + 85848, + 0, + 1, + 955506, + 213312, + 0, + 2, + 270652, + 22588, + 4, + 1457325, + 64566, + 4, + 20467, + 1, + 4, + 0, + 141992, + 32, + 100788, + 420, + 1, + 1, + 81663, + 32, + 59498, + 32, + 20142, + 32, + 24588, + 32, + 20744, + 32, + 25933, + 32, + 24623, + 32, + 43053543, + 10, + 53384111, + 14333, + 10, + 43574283, + 26308, + 10, + 16000, + 100, + 16000, + 100, + 962335, + 18, + 2780678, + 6, + 442008, + 1, + 52538055, + 3756, + 18, + 267929, + 18, + 76433006, + 8868, + 18, + 52948122, + 18, + 1995836, + 36, + 3227919, + 12, + 901022, + 1, + 166917843, + 4307, + 36, + 284546, + 36, + 158221314, + 26549, + 36, + 74698472, + 36, + 333849714, + 1, + 254006273, + 72, + 2174038, + 72, + 2261318, + 64571, + 4, + 207616, + 8310, + 4, + 1293828, + 28716, + 63, + 0, + 1, + 1006041, + 43623, + 251, + 0, + 1 + ], "constitution": { - "anchor": { - "url": "", - "dataHash": "0000000000000000000000000000000000000000000000000000000000000000" - } + "anchor": { + "dataHash": "ca41a91f399259bcefe57f9858e91f6d00e1a38d6d9c63d4052914ea7bd70cb2", + "url": "ipfs://bafkreifnwj6zpu3ixa4siz2lndqybyc5wnnt3jkwyutci4e2tmbnj3xrdm" + }, + "script": "fa24fb305126805cf2164c161d852a0e7330cf988f1fe558cf7d4a64" }, "committee": { "members": { - "keyHash-4e88cc2d27c364aaf90648a87dfb95f8ee103ba67fa1f12f5e86c42a": 1, - "scriptHash-4e88cc2d27c364aaf90648a87dfb95f8ee103ba67fa1f12f5e86c42a": 2 + "scriptHash-df0e83bde65416dade5b1f97e7f115cc1ff999550ad968850783fe50": 580, + "scriptHash-b6012034ba0a7e4afbbf2c7a1432f8824aee5299a48e38e41a952686": 580, + "scriptHash-ce8b37a72b178a37bbd3236daa7b2c158c9d3604e7aa667e6c6004b7": 580, + "scriptHash-f0dc2c00d92a45521267be2d5de1c485f6f9d14466d7e16062897cf7": 580, + "scriptHash-349e55f83e9af24813e6cb368df6a80d38951b2a334dfcdf26815558": 580, + "scriptHash-84aebcfd3e00d0f87af918fc4b5e00135f407e379893df7e7d392c6a": 580, + "scriptHash-e8165b3328027ee0d74b1f07298cb092fd99aa7697a1436f5997f625": 580 }, - "threshold": 0.5 + "threshold": { + "numerator": 2, + "denominator": 3 + } } } diff --git a/cardano-cli/test/cardano-cli-test/files/input/check-node-configuration/genesis.dijkstra.spec.json b/cardano-cli/test/cardano-cli-test/files/input/check-node-configuration/genesis.dijkstra.spec.json new file mode 100644 index 0000000000..3361a7f960 --- /dev/null +++ b/cardano-cli/test/cardano-cli-test/files/input/check-node-configuration/genesis.dijkstra.spec.json @@ -0,0 +1,26 @@ +{ + "maxRefScriptSizePerBlock": 2097152, + "maxRefScriptSizePerTx": 250000, + "refScriptCostStride": 30000, + "refScriptCostMultiplier": 1.5, + "maxPledgeLeverage": 20, + "minPoolMargin": 0.025, + "plutusV4CostModel": [100789, 420, 1, 1, 1000, 173, 0, 1, 1000, 59957, 4, 1, 11183, 32, 201305, 8356, 4, 16000, 100, 16000, 100, 16000, 100, 16000, 100, 16000, 100, 16000, 100, 100, 100, 16000, 100, 94375, 32, 132994, 32, 61462, 4, 72010, 178, 0, 1, 22151, 32, 91189, 769, 4, 2, 85848, 123203, 7305, -900, 1716, 960, 57, 85848, 0, 1, 1, 1000, 42921, 4, 2, 30623, 28755, 75, 1, 898148, 27279, 1, 51775, 558, 1, 39184, 1000, 60594, 1, 141895, 32, 83150, 32, 15299, 32, 76049, 1, 13169, 4, 22100, 10, 28999, 74, 1, 28999, 74, 1, 43285, 552, 1, 44749, 548, 1, 33852, 32, 68246, 32, 72362, 32, 7243, 32, 7391, 32, 11546, 32, 85848, 123203, 7305, -900, 1716, 960, 57, 85848, 0, 1, 90434, 519, 0, 1, 74433, 32, 85848, 123203, 7305, -900, 1716, 960, 57, 85848, 0, 1, 1, 85848, 123203, 7305, -900, 1716, 960, 57, 85848, 0, 1, 955506, 213312, 0, 2, 270652, 22588, 4, 1457325, 64566, 4, 20467, 1, 4, 0, 141992, 32, 100788, 420, 1, 1, 81663, 32, 59498, 32, 20142, 32, 24588, 32, 20744, 32, 25933, 32, 24623, 32, 43053543, 10, 53384111, 14333, 10, 43574283, 26308, 10, 16000, 100, 16000, 100, 962335, 18, 2780678, 6, 442008, 1, 52538055, 3756, 18, 267929, 18, 76433006, 8868, 18, 52948122, 18, 1995836, 36, 3227919, 12, 901022, 1, 166917843, 4307, 36, 284546, 36, 158221314, 26549, 36, 74698472, 36, 333849714, 1, 254006273, 72, 2174038, 72, 2261318, 64571, 4, 207616, 8310, 4, 1293828, 28716, 63, 0, 1, 1006041, 43623, 251, 0, 4], + "leiosAnnouncementPeriodLength": 1100, + "leiosVotePeriodLength": 4400, + "leiosDiffusionPeriodLength": 7700, + "leiosCommitteeSize": 777, + "leiosQuorumStakeThreshold": 0.8, + "maxEndorserBlockReferencesSize": 600000, + "maxEndorserBlockTxsSize": 10000000, + "maxEndorserBlockExecutionUnits": {"memory": 6000000000, "steps": 1500000000000}, + "maxRefScriptSizePerEndorserBlock": 10000000, + "perasMinCandidateBlockAge": 100, + "perasHealingFactor": 0.6, + "perasCertBoost": 9, + "perasTargetCommitteeSize": 700, + "perasBootstrapRound": 1, + "perasQuorumThresholdSafetyMargin": 0.07, + "refInputsCostPerMultiAssetPolicy": 5, + "refInputsCostPerDatumByte": 3 +} diff --git a/cardano-cli/test/cardano-cli-test/files/input/check-node-configuration/node-config-envelope.json b/cardano-cli/test/cardano-cli-test/files/input/check-node-configuration/node-config-envelope.json new file mode 100644 index 0000000000..c1ae647022 --- /dev/null +++ b/cardano-cli/test/cardano-cli-test/files/input/check-node-configuration/node-config-envelope.json @@ -0,0 +1,17 @@ +{ + "$schema": "https://raw.githubusercontent.com/IntersectMBO/cardano-config/v2/schemas/config.schema.json", + "Configuration": { + "Protocol": { + "AlonzoGenesisFile": "genesis.alonzo.spec.json", + "AlonzoGenesisHash": "2418fe881f57d2f5851a018214634aa6d1b7f10f130c3bdf8c13210c0ed2fd02", + "ByronGenesisFile": "genesis.byron.spec.json", + "ByronGenesisHash": "b91cb9a87b244fbb6f8d60a809475705594b6aa9a9aa5dcb6be8020549def9f5", + "ConwayGenesisFile": "genesis.conway.spec.json", + "ConwayGenesisHash": "15a199f895e461ec0ffc6dd4e4028af28a492ab4e806d39cb674c88f7643ef62", + "RequiresNetworkMagic": "RequiresMagic", + "ShelleyGenesisFile": "genesis.shelley.spec.json", + "ShelleyGenesisHash": "9ae14531b6f0a3cd958b050310fd9fca9474b94c85fc9a2f79f9353f4ed0cf7f" + } + }, + "Version": 2 +} diff --git a/cardano-cli/test/cardano-cli-test/files/input/check-node-configuration/node-config.json b/cardano-cli/test/cardano-cli-test/files/input/check-node-configuration/node-config.json index 355d0d8be1..6a81cbc9ee 100644 --- a/cardano-cli/test/cardano-cli-test/files/input/check-node-configuration/node-config.json +++ b/cardano-cli/test/cardano-cli-test/files/input/check-node-configuration/node-config.json @@ -4,11 +4,10 @@ "ByronGenesisFile": "genesis.byron.spec.json", "ByronGenesisHash": "b91cb9a87b244fbb6f8d60a809475705594b6aa9a9aa5dcb6be8020549def9f5", "ConwayGenesisFile": "genesis.conway.spec.json", - "ConwayGenesisHash": "65d481eec0b24ef90f7bbeaf6933fdf9629ce89afe88238e5da4ec79977a28d1", + "ConwayGenesisHash": "15a199f895e461ec0ffc6dd4e4028af28a492ab4e806d39cb674c88f7643ef62", "EnableLogMetrics": false, "EnableLogging": true, "EnableP2P": false, - "ExperimentalHardForksEnabled": true, "ExperimentalProtocolsEnabled": true, "LastKnownBlockVersion-Alt": 0, "LastKnownBlockVersion-Major": 2, diff --git a/cardano-cli/test/cardano-cli-test/files/input/check-node-configuration/node-config.yaml b/cardano-cli/test/cardano-cli-test/files/input/check-node-configuration/node-config.yaml index 48542dcfcb..55b871ccf1 100644 --- a/cardano-cli/test/cardano-cli-test/files/input/check-node-configuration/node-config.yaml +++ b/cardano-cli/test/cardano-cli-test/files/input/check-node-configuration/node-config.yaml @@ -8,7 +8,7 @@ AlonzoGenesisHash: 2418fe881f57d2f5851a018214634aa6d1b7f10f130c3bdf8c13210c0ed2f ByronGenesisFile: genesis.byron.spec.json ByronGenesisHash: b91cb9a87b244fbb6f8d60a809475705594b6aa9a9aa5dcb6be8020549def9f5 ConwayGenesisFile: genesis.conway.spec.json -ConwayGenesisHash: 65d481eec0b24ef90f7bbeaf6933fdf9629ce89afe88238e5da4ec79977a28d1 +ConwayGenesisHash: 15a199f895e461ec0ffc6dd4e4028af28a492ab4e806d39cb674c88f7643ef62 ShelleyGenesisFile: genesis.shelley.spec.json ShelleyGenesisHash: 9ae14531b6f0a3cd958b050310fd9fca9474b94c85fc9a2f79f9353f4ed0cf7f diff --git a/flake.lock b/flake.lock index 395fe6e3ae..ae02678df1 100644 --- a/flake.lock +++ b/flake.lock @@ -3,11 +3,11 @@ "CHaP": { "flake": false, "locked": { - "lastModified": 1791917061, - "narHash": "sha256-lSMHtX/jzGBocXaJ6rv5oP3Hwppdyn1wfAjsCCl/mvo=", + "lastModified": 1792605117, + "narHash": "sha256-GykQ/H7LgwcByC+ge8KJ8kExfYcWJeUjQQAHk4DEMYQ=", "owner": "intersectmbo", "repo": "cardano-haskell-packages", - "rev": "32245bbb4131b82b3eddb67dca61970d37ae733a", + "rev": "cca1f601a21713d52c5e48aeefe3a69606ba076c", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index f6bad90c03..7990777cb0 100644 --- a/flake.nix +++ b/flake.nix @@ -298,6 +298,21 @@ --replace-fail 'void scalar_add_no_overflow(' 'static void scalar_add_no_overflow(' ''; } + ({ + lib, + pkgs, + ... + }: + lib.mkIf pkgs.stdenv.hostPlatform.isWindows { + # unix-compat, which cardano-config brings in through trace-dispatcher, + # asks for msvcrt on Windows, but the toolchain links ucrt: the two C + # runtimes define the same symbols (__getmainargs, _onexit, tzset, ...), + # so no executable links. cardano-node (nix/haskell.nix) and cardano-api + # carry the same fix. Remove once unix-compat stops asking for msvcrt + packages.unix-compat.postPatch = '' + sed -i 's/msvcrt//g' unix-compat.cabal + ''; + }) # On Darwin link statically against selected 3rd party crypto libs (as in haskell-nix-example cardano-tools) ({ pkgs,