Skip to content

Commit

Permalink
Use sharing
Browse files Browse the repository at this point in the history
  • Loading branch information
smelc committed Nov 19, 2024
1 parent f2b3644 commit 059da05
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
20 changes: 12 additions & 8 deletions cardano-cli/src/Cardano/CLI/EraBased/Run/Genesis.hs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ import Control.Exception (evaluate)
import Control.Monad (forM, forM_, unless, when)
import Data.Aeson hiding (Key)
import qualified Data.Aeson as Aeson
import Data.Aeson.Encode.Pretty (encodePretty)
import qualified Data.Aeson.KeyMap as Aeson
import Data.Bifunctor (Bifunctor (..))
import Data.ByteString (ByteString)
Expand Down Expand Up @@ -275,9 +274,12 @@ runGenesisCreateCmd
[]
template

void $ TN.writeFileGenesis (rootdir </> "genesis.json") $ WritePretty shelleyGenesis
void $ TN.writeFileGenesis (rootdir </> "genesis.alonzo.json") $ WritePretty alonzoGenesis
void $ TN.writeFileGenesis (rootdir </> "genesis.conway.json") $ WritePretty conwayGenesis
forM_
[ ("genesis.json", WritePretty shelleyGenesis)
, ("genesis.alonzo.json", WritePretty alonzoGenesis)
, ("genesis.conway.json", WritePretty conwayGenesis)
]
$ \(filename, genesis) -> TN.writeFileGenesis (rootdir </> filename) genesis
where
-- TODO: rationalise the naming convention on these genesis json files.

Expand Down Expand Up @@ -685,10 +687,12 @@ runGenesisCreateStakedCmd
stuffedUtxoAddrs
template

liftIO $ LBS.writeFile (rootdir </> "genesis.json") $ encodePretty shelleyGenesis

void $ TN.writeFileGenesis (rootdir </> "genesis.alonzo.json") $ WritePretty alonzoGenesis
void $ TN.writeFileGenesis (rootdir </> "genesis.conway.json") $ WritePretty conwayGenesis
forM_
[ ("genesis.json", WritePretty shelleyGenesis)
, ("genesis.alonzo.json", WritePretty alonzoGenesis)
, ("genesis.conway.json", WritePretty conwayGenesis)
]
$ \(filename, genesis) -> TN.writeFileGenesis (rootdir </> filename) genesis
-- TODO: rationalise the naming convention on these genesis json files.

liftIO $
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ import Cardano.Prelude (canonicalEncodePretty)

import Control.DeepSeq (NFData, deepseq)
import Control.Monad (forM, forM_, unless, void, when)
import qualified Data.Aeson as Aeson
import qualified Data.Aeson.Encode.Pretty as Aeson
import Data.Bifunctor (Bifunctor (..))
import Data.ByteString (ByteString)
Expand Down Expand Up @@ -379,9 +378,12 @@ runGenesisCreateTestNetDataCmd
shelleyGenesis

-- Write genesis.json file to output
liftIO $ LBS.writeFile (outputDir </> "conway-genesis.json") $ Aeson.encode conwayGenesis'
liftIO $ LBS.writeFile (outputDir </> "shelley-genesis.json") $ Aeson.encode shelleyGenesis'
liftIO $ LBS.writeFile (outputDir </> "alonzo-genesis.json") $ Aeson.encode alonzoGenesis
forM_
[ ("conway-genesis.json", WritePretty conwayGenesis')
, ("shelley-genesis.json", WritePretty shelleyGenesis')
, ("alonzo-genesis.json", WritePretty alonzoGenesis)
]
$ \(filename, genesis) -> writeFileGenesis (outputDir </> filename) genesis
where
genesisDir = outputDir </> "genesis-keys"
delegateDir = outputDir </> "delegate-keys"
Expand Down

0 comments on commit 059da05

Please sign in to comment.