Skip to content

Commit

Permalink
inital attempt
Browse files Browse the repository at this point in the history
  • Loading branch information
carbolymer committed Jul 2, 2024
1 parent 2006e3b commit 91b34dc
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 14 deletions.
4 changes: 2 additions & 2 deletions cardano-cli/src/Cardano/CLI/EraBased/Options/Transaction.hs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ pTransactionBuildCmd era envCli = do
Nothing
"Filepath of auxiliary script(s)")
<*> many pMetadataFile
<*> pFeatured (shelleyBasedToCardanoEra sbe) (optional pUpdateProposalFile)
<*> pFeatured (toCardanoEra sbe) (optional pUpdateProposalFile)
<*> pVoteFiles sbe AutoBalance
<*> pProposalFiles sbe AutoBalance
<*> pTreasuryDonation sbe
Expand Down Expand Up @@ -235,7 +235,7 @@ pTransactionBuildEstimateCmd era _envCli = do
Nothing
"Filepath of auxiliary script(s)")
<*> many pMetadataFile
<*> pFeatured (shelleyBasedToCardanoEra sbe) (optional pUpdateProposalFile)
<*> pFeatured (toCardanoEra sbe) (optional pUpdateProposalFile)
<*> pVoteFiles sbe ManualBalance
<*> pProposalFiles sbe ManualBalance
<*> pCurrentTreasuryValue sbe
Expand Down
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
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
10 changes: 5 additions & 5 deletions cardano-cli/src/Cardano/CLI/EraBased/Run/Query.hs
Original file line number Diff line number Diff line change
Expand Up @@ -170,11 +170,11 @@ runQueryProtocolParametersCmd
, Cmd.mOutFile
} = do
let localNodeConnInfo = LocalNodeConnectInfo consensusModeParams networkId nodeSocketPath
AnyCardanoEra era <- firstExceptT QueryCmdAcquireFailure $ newExceptT $ determineEra localNodeConnInfo
AnyCardanoEra era <- firstExceptT QueryCmdAcquireFailure $ determineEra localNodeConnInfo
sbe <- forEraInEon @ShelleyBasedEra era (left QueryCmdByronEra) pure
let qInMode = QueryInEra $ QueryInShelleyBasedEra sbe Api.QueryProtocolParameters
pp <- firstExceptT QueryCmdConvenienceError
. newExceptT $ executeQueryAnyMode localNodeConnInfo qInMode
pp <- modifyError QueryCmdConvenienceError $
executeQueryAnyMode localNodeConnInfo qInMode
writeProtocolParameters sbe mOutFile pp
where
writeProtocolParameters
Expand Down Expand Up @@ -654,8 +654,8 @@ runQueryTxMempoolCmd

localQuery <- case query of
TxMempoolQueryTxExists tx -> do
AnyCardanoEra era <- lift (determineEra localNodeConnInfo)
& onLeft (left . QueryCmdAcquireFailure)
AnyCardanoEra era <- determineEra localNodeConnInfo
& modifyError QueryCmdAcquireFailure
pure $ LocalTxMonitoringQueryTx $ TxIdInMode era tx
TxMempoolQueryNextTx -> pure LocalTxMonitoringSendNextTx
TxMempoolQueryInfo -> pure LocalTxMonitoringMempoolInformation
Expand Down
8 changes: 4 additions & 4 deletions cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ runTransactionBuildCmd
, treasuryDonation
, buildOutputOptions
} = shelleyBasedEraConstraints eon $ do
let era = shelleyBasedToCardanoEra eon
let era = toCardanoEra eon

-- The user can specify an era prior to the era that the node is currently in.
-- We cannot use the user specified era to construct a query against a node because it may differ
Expand Down Expand Up @@ -766,7 +766,7 @@ runTxBuild

-- TODO: All functions should be parameterized by ShelleyBasedEra
-- as it's not possible to call this function with ByronEra
let era = shelleyBasedToCardanoEra sbe
let era = toCardanoEra sbe
inputsThatRequireWitnessing = [input | (input,_) <- inputsAndMaybeScriptWits]

let allReferenceInputs = getAllReferenceInputs
Expand Down Expand Up @@ -1078,7 +1078,7 @@ toTxAlonzoDatum supp cliDatum =
sData <- firstExceptT TxCmdScriptDataError $ readScriptDataOrFile sDataOrFile
pure (TxOutDatumInTx supp sData)
TxOutInlineDatumByValue sDataOrFile -> do
let cEra = alonzoEraOnwardsToCardanoEra supp
let cEra = toCardanoEra supp
forEraInEon cEra (txFeatureMismatch cEra TxFeatureInlineDatums) $ \babbageOnwards -> do
sData <- firstExceptT TxCmdScriptDataError $ readScriptDataOrFile sDataOrFile
pure $ TxOutDatumInline babbageOnwards sData
Expand Down Expand Up @@ -1521,7 +1521,7 @@ runTransactionSignWitnessCmd
lift (readFileTxKeyWitness file) & onLeft (left . TxCmdCddlWitnessError)

case testEquality era era' of
Nothing -> left $ TxCmdWitnessEraMismatch (AnyCardanoEra $ shelleyBasedToCardanoEra era) (AnyCardanoEra $ shelleyBasedToCardanoEra era') witnessFile
Nothing -> left $ TxCmdWitnessEraMismatch (AnyCardanoEra $ toCardanoEra era) (AnyCardanoEra $ toCardanoEra era') witnessFile
Just Refl -> return witness
| witnessFile@(WitnessFile file) <- witnessFiles ]

Expand Down
2 changes: 1 addition & 1 deletion cardano-cli/src/Cardano/CLI/Legacy/Run/Transaction.hs
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ runLegacyTransactionBuildCmd
outputOptions = do

mUpdateProposalFile <-
validateUpdateProposalFile (shelleyBasedToCardanoEra sbe) mUpdateProposal
validateUpdateProposalFile (toCardanoEra sbe) mUpdateProposal
& hoistEither
& firstExceptT TxCmdNotSupportedInEraValidationError

Expand Down
1 change: 1 addition & 0 deletions cardano-cli/src/Cardano/CLI/Run/Debug/LogEpochState.hs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ runLogEpochStateCmd
LBS.appendFile outputFilePath ""

result <- runExceptT $ foldEpochState
AlonzoEraOnwardsConway -- FIXME: get this from somewhere, prolly query the node beforehand for an era
configurationFile
nodeSocketPath
Api.QuickValidation
Expand Down

0 comments on commit 91b34dc

Please sign in to comment.