diff --git a/cardano-testnet/src/Parsers/Cardano.hs b/cardano-testnet/src/Parsers/Cardano.hs index d3d2e1bc409..a042521a1c2 100644 --- a/cardano-testnet/src/Parsers/Cardano.hs +++ b/cardano-testnet/src/Parsers/Cardano.hs @@ -1,5 +1,3 @@ -{-# LANGUAGE NumericUnderscores #-} - module Parsers.Cardano ( cmdCardano ) where @@ -134,6 +132,6 @@ pMaxLovelaceSupply = <> help "Max lovelace supply that your testnet starts with." <> metavar "WORD64" <> showDefault - <> value 10_020_000_000 + <> value (cardanoMaxSupply cardanoDefaultTestnetOptions) ) diff --git a/cardano-testnet/src/Testnet/Components/Configuration.hs b/cardano-testnet/src/Testnet/Components/Configuration.hs index 48be55f3090..195505c2a58 100644 --- a/cardano-testnet/src/Testnet/Components/Configuration.hs +++ b/cardano-testnet/src/Testnet/Components/Configuration.hs @@ -1,6 +1,5 @@ {-# LANGUAGE GADTs #-} {-# LANGUAGE NamedFieldPuns #-} -{-# LANGUAGE NumericUnderscores #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeApplications #-} @@ -52,6 +51,7 @@ import qualified Data.List as List import Data.String import Data.Text (Text) import qualified Data.Text as Text +import Data.Word (Word64) import GHC.Stack (HasCallStack) import qualified GHC.Stack as GHC import Lens.Micro @@ -132,13 +132,14 @@ createSPOGenesisAndFiles :: (MonadTest m, MonadCatch m, MonadIO m, HasCallStack) => NumPools -- ^ The number of pools to make -> NumDReps -- ^ The number of pools to make + -> Word64 -- ^ The maximum supply -> AnyShelleyBasedEra -- ^ The era to use -> ShelleyGenesis StandardCrypto -- ^ The shelley genesis to use. -> AlonzoGenesis -- ^ The alonzo genesis to use, for example 'getDefaultAlonzoGenesis' from this module. -> ConwayGenesis StandardCrypto -- ^ The conway genesis to use, for example 'Defaults.defaultConwayGenesis'. -> TmpAbsolutePath -> m FilePath -- ^ Shelley genesis directory -createSPOGenesisAndFiles (NumPools numPoolNodes) (NumDReps numDelReps) sbe shelleyGenesis +createSPOGenesisAndFiles (NumPools numPoolNodes) (NumDReps numDelReps) maxSupply sbe shelleyGenesis alonzoGenesis conwayGenesis (TmpAbsolutePath tempAbsPath) = GHC.withFrozenCallStack $ do let inputGenesisShelleyFp = tempAbsPath genesisInputFilepath ShelleyEra inputGenesisAlonzoFp = tempAbsPath genesisInputFilepath AlonzoEra @@ -181,8 +182,8 @@ createSPOGenesisAndFiles (NumPools numPoolNodes) (NumDReps numDelReps) sbe shell , "--spec-conway", inputGenesisConwayFp , "--testnet-magic", show testnetMagic , "--pools", show numPoolNodes - , "--total-supply", show @Int 2_000_000_000_000 -- 2 trillions - , "--delegated-supply", show @Int 1_000_000_000_000 -- 1 trillion + , "--total-supply", show maxSupply + , "--delegated-supply", show (maxSupply `div` 2) -- Required until https://github.com/IntersectMBO/cardano-cli/pull/874 is integrated , "--stake-delegators", show numStakeDelegators , "--utxo-keys", show numSeededUTxOKeys , "--drep-keys", show numDelReps diff --git a/cardano-testnet/src/Testnet/Start/Cardano.hs b/cardano-testnet/src/Testnet/Start/Cardano.hs index 2183ae02d94..80ec4b5ca70 100644 --- a/cardano-testnet/src/Testnet/Start/Cardano.hs +++ b/cardano-testnet/src/Testnet/Start/Cardano.hs @@ -192,6 +192,7 @@ cardanoTestnet numPoolNodes = length $ cardanoNodes testnetOptions nPools = numPools testnetOptions nDReps = numDReps testnetOptions + maxSupply = cardanoMaxSupply testnetOptions asbe = cardanoNodeEra testnetOptions AnyShelleyBasedEra sbe <- pure asbe @@ -237,7 +238,7 @@ cardanoTestnet configurationFile <- H.noteShow . File $ tmpAbsPath "configuration.yaml" - _ <- createSPOGenesisAndFiles nPools nDReps asbe shelleyGenesis alonzoGenesis conwayGenesis (TmpAbsolutePath tmpAbsPath) + _ <- createSPOGenesisAndFiles nPools nDReps maxSupply asbe shelleyGenesis alonzoGenesis conwayGenesis (TmpAbsolutePath tmpAbsPath) -- TODO: This should come from the configuration! let poolKeyDir :: Int -> FilePath diff --git a/cardano-testnet/src/Testnet/Start/Types.hs b/cardano-testnet/src/Testnet/Start/Types.hs index b2066526286..173a69ee02b 100644 --- a/cardano-testnet/src/Testnet/Start/Types.hs +++ b/cardano-testnet/src/Testnet/Start/Types.hs @@ -44,7 +44,7 @@ data CardanoTestnetOptions = CardanoTestnetOptions , cardanoSlotLength :: Double -- ^ Slot length, in seconds , cardanoTestnetMagic :: Int , cardanoActiveSlotsCoeff :: Double - , cardanoMaxSupply :: Word64 -- ^ The amount of ADA you are starting your testnet with (forwarded to shelley genesis) + , cardanoMaxSupply :: Word64 -- ^ The amount of Lovelace you are starting your testnet with (forwarded to shelley genesis) , cardanoEnableP2P :: Bool , cardanoNodeLoggingFormat :: NodeLoggingFormat , cardanoNumDReps :: Int -- ^ The number of DReps to generate at creation @@ -59,7 +59,7 @@ cardanoDefaultTestnetOptions = CardanoTestnetOptions , cardanoSlotLength = 0.1 , cardanoTestnetMagic = 42 , cardanoActiveSlotsCoeff = 0.05 - , cardanoMaxSupply = 100_020_000_000 -- 100 billions. This amount should be bigger than the 'byronTotalBalance' in Testnet.Start.Byron + , cardanoMaxSupply = 100_000_020_000_000 -- 100 000 billions Lovelace, so 100 millions ADA. This amount should be bigger than the 'byronTotalBalance' in Testnet.Start.Byron , cardanoEnableP2P = False , cardanoNodeLoggingFormat = NodeLoggingFormatAsJson , cardanoNumDReps = 3 diff --git a/cardano-testnet/test/cardano-testnet-golden/files/golden/help/cardano.cli b/cardano-testnet/test/cardano-testnet-golden/files/golden/help/cardano.cli index 74d2e842fde..98eb490d148 100644 --- a/cardano-testnet/test/cardano-testnet-golden/files/golden/help/cardano.cli +++ b/cardano-testnet/test/cardano-testnet-golden/files/golden/help/cardano.cli @@ -35,7 +35,7 @@ Available options: Active slots co-efficient (default: 5.0e-2) --max-lovelace-supply WORD64 Max lovelace supply that your testnet starts with. - (default: 10020000000) + (default: 100000020000000) --enable-p2p BOOL Enable P2P (default: False) --nodeLoggingFormat LOGGING_FORMAT Node logging format (json|text) diff --git a/cardano-testnet/test/cardano-testnet-test/files/golden/queries/drepStateOut.json b/cardano-testnet/test/cardano-testnet-test/files/golden/queries/drepStateOut.json index 1db53afa055..e020e2b05b5 100644 --- a/cardano-testnet/test/cardano-testnet-test/files/golden/queries/drepStateOut.json +++ b/cardano-testnet/test/cardano-testnet-test/files/golden/queries/drepStateOut.json @@ -7,7 +7,7 @@ "anchor": null, "deposit": 1000000, "expiry": 1002, - "stake": 300000000000 + "stake": 15000003000000 } ], [ @@ -18,7 +18,7 @@ "anchor": null, "deposit": 1000000, "expiry": 1002, - "stake": 300000000000 + "stake": 15000003000000 } ], [ @@ -29,7 +29,7 @@ "anchor": null, "deposit": 1000000, "expiry": 1002, - "stake": 300000000000 + "stake": 15000003000000 } ] ] \ No newline at end of file diff --git a/cardano-testnet/test/cardano-testnet-test/files/golden/tx.failed.response.json.golden b/cardano-testnet/test/cardano-testnet-test/files/golden/tx.failed.response.json.golden index 79c15862593..c9291f5b15f 100644 --- a/cardano-testnet/test/cardano-testnet-test/files/golden/tx.failed.response.json.golden +++ b/cardano-testnet/test/cardano-testnet-test/files/golden/tx.failed.response.json.golden @@ -6,7 +6,7 @@ "error": [ { "contents": { - "contents": "AlonzoInBabbageUtxoPredFailure (ValueNotConservedUTxO (MaryValue (Coin 0) (MultiAsset (fromList []))) (MaryValue (Coin 300000000000) (MultiAsset (fromList []))))", + "contents": "AlonzoInBabbageUtxoPredFailure (ValueNotConservedUTxO (MaryValue (Coin 0) (MultiAsset (fromList []))) (MaryValue (Coin 15000003000000) (MultiAsset (fromList []))))", "tag": "UtxoFailure" }, "tag": "UtxowFailure"