Skip to content

Commit

Permalink
more fix
Browse files Browse the repository at this point in the history
  • Loading branch information
carbolymer committed Jul 15, 2024
1 parent 25fc2ff commit 470c77e
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 21 deletions.
7 changes: 4 additions & 3 deletions cardano-cli/src/Cardano/CLI/EraBased/Commands/Genesis.hs
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import Data.Text (Text)

data GenesisCmds era
= GenesisCreate !(GenesisCreateCmdArgs era)
| GenesisCreateCardano !GenesisCreateCardanoCmdArgs
| GenesisCreateCardano !(GenesisCreateCardanoCmdArgs era)
| GenesisCreateStaked !(GenesisCreateStakedCmdArgs era)
| GenesisCreateTestNetData !(GenesisCreateTestNetDataCmdArgs era)
| GenesisKeyGenGenesis !GenesisKeyGenGenesisCmdArgs
Expand All @@ -51,8 +51,9 @@ data GenesisCreateCmdArgs era = GenesisCreateCmdArgs
, network :: !NetworkId
} deriving Show

data GenesisCreateCardanoCmdArgs = GenesisCreateCardanoCmdArgs
{ genesisDir :: !GenesisDir
data GenesisCreateCardanoCmdArgs era = GenesisCreateCardanoCmdArgs
{ eon :: !(ShelleyBasedEra era)
, genesisDir :: !GenesisDir
, numGenesisKeys :: !Word
, numUTxOKeys :: !Word
, mSystemStart :: !(Maybe SystemStart)
Expand Down
18 changes: 9 additions & 9 deletions cardano-cli/src/Cardano/CLI/EraBased/Options/Genesis.hs
Original file line number Diff line number Diff line change
Expand Up @@ -62,31 +62,31 @@ pGenesisCmds era envCli =
$ subParser "initial-txin"
$ Opt.info (pGenesisTxIn envCli)
$ Opt.progDesc "Get the TxIn for an initial UTxO based on the verification key"
, Just
$ subParser "create-cardano"
$ Opt.info (pGenesisCreateCardano envCli)
, forEraInEonMaybe era $ \sbe ->
subParser "create-cardano"
$ Opt.info (pGenesisCreateCardano sbe envCli)
$ Opt.progDesc
$ mconcat
[ "Create a Byron and Shelley genesis file from a genesis "
, "template and genesis/delegation/spending keys."
]
, forEraInEonMaybe era $ \sbe -> do
, forEraInEonMaybe era $ \sbe ->
subParser "create"
$ Opt.info (pGenesisCreate sbe envCli)
$ Opt.progDesc
$ mconcat
[ "Create a Shelley genesis file from a genesis "
, "template and genesis/delegation/spending keys."
]
, forEraInEonMaybe era $ \sbe -> do
, forEraInEonMaybe era $ \sbe ->
subParser "create-staked"
$ Opt.info (pGenesisCreateStaked sbe envCli)
$ Opt.progDesc
$ mconcat
[ "Create a staked Shelley genesis file from a genesis "
, "template and genesis/delegation/spending keys."
]
, forEraInEonMaybe era $ \sbe -> do
, forEraInEonMaybe era $ \sbe ->
subParser "create-testnet-data"
$ Opt.info (pGenesisCreateTestNetData sbe envCli)
$ Opt.progDesc
Expand Down Expand Up @@ -143,9 +143,9 @@ pGenesisTxIn envCli =
<*> pNetworkId envCli
<*> pMaybeOutputFile

pGenesisCreateCardano :: EnvCli -> Parser (GenesisCmds era)
pGenesisCreateCardano envCli =
fmap GenesisCreateCardano $ GenesisCreateCardanoCmdArgs
pGenesisCreateCardano :: ShelleyBasedEra era -> EnvCli -> Parser (GenesisCmds era)
pGenesisCreateCardano sbe envCli =
fmap GenesisCreateCardano $ GenesisCreateCardanoCmdArgs sbe
<$> pGenesisDir
<*> pGenesisNumGenesisKeys
<*> pGenesisNumUTxOKeys
Expand Down
8 changes: 5 additions & 3 deletions cardano-cli/src/Cardano/CLI/EraBased/Run/Genesis.hs
Original file line number Diff line number Diff line change
Expand Up @@ -348,11 +348,12 @@ generateShelleyNodeSecrets shelleyDelegateKeys shelleyGenesisvkeys = do
--

runGenesisCreateCardanoCmd
:: GenesisCreateCardanoCmdArgs
:: GenesisCreateCardanoCmdArgs era
-> ExceptT GenesisCmdError IO ()
runGenesisCreateCardanoCmd
Cmd.GenesisCreateCardanoCmdArgs
{ Cmd.genesisDir
{ Cmd.eon
, Cmd.genesisDir
, Cmd.numGenesisKeys
, Cmd.numUTxOKeys
, Cmd.mSystemStart
Expand Down Expand Up @@ -392,6 +393,7 @@ runGenesisCreateCardanoCmd
utxoKeys = gsPoorSecrets byronSecrets
byronUtxoKeys = map (ByronSigningKey . Genesis.poorSecretToKey) utxoKeys
shelleyUtxoKeys = map (convertPoor . Genesis.poorSecretToKey) utxoKeys
era = toCardanoEra eon

dlgCerts <- convertToShelleyError $ mapM (findDelegateCert byronGenesis) byronDelegateKeys
let
Expand All @@ -407,7 +409,7 @@ runGenesisCreateCardanoCmd
, sgSlotLength = L.secondsToNominalDiffTimeMicro $ MkFixed (fromIntegral slotLength) * 1_000
}
shelleyGenesisTemplate' <- overrideShelleyGenesis <$> decodeShelleyGenesisFile shelleyGenesisTemplate
alonzoGenesis <- decodeAlonzoGenesisFile undefined alonzoGenesisTemplate -- FIXME!!!
alonzoGenesis <- decodeAlonzoGenesisFile (Just era) alonzoGenesisTemplate -- FIXME!!!
conwayGenesis <- decodeConwayGenesisFile conwayGenesisTemplate
(delegateMap, vrfKeys, kesKeys, opCerts) <- liftIO $ generateShelleyNodeSecrets shelleyDelegateKeys shelleyGenesisvkeys
let
Expand Down
1 change: 1 addition & 0 deletions cardano-cli/src/Cardano/CLI/Legacy/Commands/Genesis.hs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ data LegacyGenesisCmds
(Maybe Coin)
NetworkId
| GenesisCreateCardano
(EraInEon ShelleyBasedEra)
GenesisDir
Word
Word
Expand Down
3 changes: 2 additions & 1 deletion cardano-cli/src/Cardano/CLI/Legacy/Options.hs
Original file line number Diff line number Diff line change
Expand Up @@ -994,7 +994,8 @@ pGenesisCmds envCli =
pGenesisCreateCardano :: Parser LegacyGenesisCmds
pGenesisCreateCardano =
GenesisCreateCardano
<$> pGenesisDir
<$> pAnyShelleyBasedEra envCli
<*> pGenesisDir
<*> pGenesisNumGenesisKeys
<*> pGenesisNumUTxOKeys
<*> pMaybeSystemStart
Expand Down
12 changes: 7 additions & 5 deletions cardano-cli/src/Cardano/CLI/Legacy/Run/Genesis.hs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ runLegacyGenesisCmds = \case
runLegacyGenesisAddrCmd vk nw mOutFile
GenesisCreate eSbe fmt gd gn un ms am nw ->
runLegacyGenesisCreateCmd eSbe fmt gd gn un ms am nw
GenesisCreateCardano gd gn un ms am k slotLength sc nw bg sg ag cg mNodeCfg ->
runLegacyGenesisCreateCardanoCmd gd gn un ms am k slotLength sc nw bg sg ag cg mNodeCfg
GenesisCreateCardano eSbe gd gn un ms am k slotLength sc nw bg sg ag cg mNodeCfg ->
runLegacyGenesisCreateCardanoCmd eSbe gd gn un ms am k slotLength sc nw bg sg ag cg mNodeCfg
GenesisCreateStaked fmt gd gn gp gl un ms am ds nw bf bp su relayJsonFp ->
runLegacyGenesisCreateStakedCmd fmt gd gn gp gl un ms am ds nw bf bp su relayJsonFp
GenesisHashFile gf ->
Expand Down Expand Up @@ -141,7 +141,8 @@ runLegacyGenesisCreateCmd (EraInEon asbe) fmt genDir nGenKeys nUTxOKeys mStart m
}

runLegacyGenesisCreateCardanoCmd :: ()
=> GenesisDir
=> EraInEon ShelleyBasedEra
-> GenesisDir
-> Word -- ^ num genesis & delegate keys to make
-> Word -- ^ num utxo keys to make
-> Maybe SystemStart
Expand All @@ -157,11 +158,12 @@ runLegacyGenesisCreateCardanoCmd :: ()
-> Maybe FilePath
-> ExceptT GenesisCmdError IO ()
runLegacyGenesisCreateCardanoCmd
genDir nGenKeys nUTxOKeys mStart mSupply security slotLength slotCoeff
(EraInEon sbe) genDir nGenKeys nUTxOKeys mStart mSupply security slotLength slotCoeff
network byronGenesis shelleyGenesis alonzoGenesis conwayGenesis mNodeCfg
= runGenesisCreateCardanoCmd
Cmd.GenesisCreateCardanoCmdArgs
{ Cmd.genesisDir = genDir
{ Cmd.eon = sbe
, Cmd.genesisDir = genDir
, Cmd.numGenesisKeys = nGenKeys
, Cmd.numUTxOKeys = nUTxOKeys
, Cmd.mSystemStart = mStart
Expand Down

0 comments on commit 470c77e

Please sign in to comment.