Skip to content

Commit

Permalink
Avoid needing rewrite of maxLovelaceSupply
Browse files Browse the repository at this point in the history
  • Loading branch information
smelc committed Apr 8, 2024
1 parent a1367ca commit a3aaa72
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 9 deletions.
6 changes: 0 additions & 6 deletions cardano-testnet/src/Testnet/Components/Configuration.hs
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,6 @@ createSPOGenesisAndFiles (NumPools numPoolNodes) era shelleyGenesis alonzoGenesi

H.renameFile (tempAbsPath </> "byron-gen-command" </> "genesis.json") (genesisByronDir </> "genesis.json")

-- For some reason when setting "--total-supply 10E16" in create-testnet-data, we're getting negative
-- treasury. TODO: This was supposed to be fixed by https://github.com/IntersectMBO/cardano-cli/pull/644,
-- but no, it's still there.
H.rewriteJsonFile @Value (tempAbsPath </> defaultGenesisFilepath ShelleyEra) $ \o -> o
& L.key "maxLovelaceSupply" . L._Integer .~ 10_000_000_000_000_000

return genesisShelleyDir
where
genesisInputFilepath e = "genesis-input." <> anyEraToString (AnyCardanoEra e) <> ".json"
Expand Down
3 changes: 2 additions & 1 deletion cardano-testnet/src/Testnet/Start/Byron.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
{-# LANGUAGE TypeApplications #-}

{-# OPTIONS_GHC -Wno-unused-local-binds -Wno-unused-matches #-}
{-# LANGUAGE NumericUnderscores #-}

module Testnet.Start.Byron
( createByronGenesis
Expand Down Expand Up @@ -34,7 +35,7 @@ byronDefaultGenesisOptions = ByronGenesisOptions
-- TODO: createByronGenesis should have a check that errors
-- if totalBalance can be evenly split between numBftNodes
-- with no remainder. Having a remainder results in rounding errors.
, byronTotalBalance = 8000000000000001
, byronTotalBalance = 8_000_000_001 -- 8 billions. Should be smaller than 'cardanoMaxSupply' in Testnet.Start.Types
}

-- TODO: We should not abuse the byron testnet options for genesis creation.
Expand Down
4 changes: 2 additions & 2 deletions cardano-testnet/src/Testnet/Start/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,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
, cardanoMaxSupply :: Word64 -- ^ The amount of ADA you are starting your testnet with (forwarded to shelley genesis)
, cardanoEnableP2P :: Bool
, cardanoNodeLoggingFormat :: NodeLoggingFormat
} deriving (Eq, Show)
Expand All @@ -56,7 +56,7 @@ cardanoDefaultTestnetOptions = CardanoTestnetOptions
, cardanoSlotLength = 0.1
, cardanoTestnetMagic = 42
, cardanoActiveSlotsCoeff = 0.05
, cardanoMaxSupply = 10_020_000_000
, cardanoMaxSupply = 100_020_000_000 -- 100 billions. This amount should be bigger than the 'byronTotalBalance' in Testnet.Start.Byron
, cardanoEnableP2P = False
, cardanoNodeLoggingFormat = NodeLoggingFormatAsJson
}
Expand Down

0 comments on commit a3aaa72

Please sign in to comment.