Skip to content

Commit

Permalink
inital attempt
Browse files Browse the repository at this point in the history
  • Loading branch information
carbolymer committed Jul 8, 2024
1 parent 772537c commit 175fa47
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ runGenesisCreateTestNetDataCmd Cmd.GenesisCreateTestNetDataCmdArgs
, numUtxoKeys
, totalSupply
, delegatedSupply
, relays
, relays
, systemStart
, outputDir
} = do
Expand Down Expand Up @@ -692,6 +692,7 @@ readAndDecodeGenesisFile fpath = runExceptT $ do
lbs <- handleIOExceptT (GenesisCmdGenesisFileReadError . FileIOError fpath) $ LBS.readFile fpath
firstExceptT (GenesisCmdGenesisFileDecodeError fpath . Text.pack)
. hoistEither $ Aeson.eitherDecode' lbs
-- FIXME!!!

-- @readRelays fp@ reads the relays specification from a file
readRelays :: ()
Expand Down
2 changes: 1 addition & 1 deletion cardano-cli/src/Cardano/CLI/EraBased/Run/Genesis.hs
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ runGenesisCreateCardanoCmd
overrideShelleyGenesis t = t
{ sgNetworkMagic = unNetworkMagic (toNetworkMagic network)
, sgNetworkId = toShelleyNetwork network
, sgActiveSlotsCoeff = fromMaybe (error $ "Could not convert from Rational: " ++ show slotCoeff) $ L.boundRational slotCoeff
, sgActiveSlotsCoeff = unsafeBoundedRational slotCoeff
, sgSecurityParam = unBlockCount security
, sgUpdateQuorum = fromIntegral $ ((numGenesisKeys `div` 3) * 2) + 1
, sgEpochLength = EpochSize $ floor $ (fromIntegral (unBlockCount security) * 10) / slotCoeff
Expand Down
7 changes: 2 additions & 5 deletions cardano-cli/src/Cardano/CLI/EraBased/Run/Governance/DRep.hs
Original file line number Diff line number Diff line change
Expand Up @@ -163,11 +163,8 @@ runGovernanceDRepMetadataHashCmd
{ metadataFile
, mOutFile
} = do
metadataBytes <- firstExceptT ReadFileError $ newExceptT (readByteStringFile metadataFile)
(_metadata, metadataHash) <-
firstExceptT GovernanceCmdDRepMetadataValidationError
. hoistEither
$ validateAndHashDRepMetadata metadataBytes
metadataBytes <- firstExceptT ReadFileError . newExceptT $ readByteStringFile metadataFile
let (_metadata, metadataHash) = hashDRepMetadata metadataBytes
firstExceptT WriteFileError
. newExceptT
. writeByteStringOutput mOutFile
Expand Down
7 changes: 4 additions & 3 deletions cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,8 @@ runQueryProtocolParametersCmd
AnyCardanoEra era <- firstExceptT QueryCmdAcquireFailure $ determineEra localNodeConnInfo
sbe <- forEraInEon @ShelleyBasedEra era (left QueryCmdByronEra) pure
let qInMode = QueryInEra $ QueryInShelleyBasedEra sbe Api.QueryProtocolParameters
pp <- firstExceptT QueryCmdConvenienceError
$ executeQueryAnyMode localNodeConnInfo qInMode
pp <- executeQueryAnyMode localNodeConnInfo qInMode
& modifyError QueryCmdConvenienceError
writeProtocolParameters sbe mOutFile pp
where
writeProtocolParameters
Expand Down Expand Up @@ -654,7 +654,8 @@ runQueryTxMempoolCmd

localQuery <- case query of
TxMempoolQueryTxExists tx -> do
AnyCardanoEra era <- modifyError QueryCmdAcquireFailure (determineEra localNodeConnInfo)
AnyCardanoEra era <- determineEra localNodeConnInfo
& modifyError QueryCmdAcquireFailure
pure $ LocalTxMonitoringQueryTx $ TxIdInMode era tx
TxMempoolQueryNextTx -> pure LocalTxMonitoringSendNextTx
TxMempoolQueryInfo -> pure LocalTxMonitoringMempoolInformation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ data GovernanceCmdError
| GovernanceCmdDecoderError !DecoderError
| GovernanceCmdVerifyPollError !GovernancePollError
| GovernanceCmdWriteFileError !(FileError ())
| GovernanceCmdDRepMetadataValidationError !DRepMetadataValidationError
-- Legacy - remove me after cardano-cli transitions to new era based structure
| GovernanceCmdMIRCertNotSupportedInConway
| GovernanceCmdGenesisDelegationNotSupportedInConway
Expand Down Expand Up @@ -108,8 +107,6 @@ instance Error GovernanceCmdError where
pretty $ renderGovernancePollError pollError
GovernanceCmdWriteFileError fileError ->
"Cannot write file: " <> prettyError fileError
GovernanceCmdDRepMetadataValidationError e ->
"DRep metadata validation error: " <> prettyError e
GovernanceCmdMIRCertNotSupportedInConway ->
"MIR certificates are not supported in Conway era onwards."
GovernanceCmdGenesisDelegationNotSupportedInConway ->
Expand Down

0 comments on commit 175fa47

Please sign in to comment.