Skip to content

Commit

Permalink
Delegate from legacy transaction run commands to era-based transactio…
Browse files Browse the repository at this point in the history
…n run commands
  • Loading branch information
newhoggy committed Aug 26, 2023
1 parent c35d534 commit e1ef783
Show file tree
Hide file tree
Showing 3 changed files with 127 additions and 1,164 deletions.
14 changes: 7 additions & 7 deletions cardano-cli/src/Cardano/CLI/EraBased/Run/Transaction.hs
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,8 @@ runTxBuildCmd
-- Conway related
votes <-
featureInEra
(pure TxVotesNone)
(\w -> firstExceptT ShelleyTxCmdVoteError $ ExceptT (readTxVotes w conwayVotes))
(pure emptyVotingProcedures)
(\w -> firstExceptT ShelleyTxCmdVoteError $ ExceptT (readVotingProceduresFiles w conwayVotes))
era

proposals <- newExceptT $ first ShelleyTxCmdConstitutionError
Expand All @@ -207,7 +207,7 @@ runTxBuildCmd
-- the same collateral input can be used for several plutus scripts
let filteredTxinsc = Set.toList $ Set.fromList txinsc

-- We need to construct the txBodycontent outside of runTxBuild
-- We need to construct the txBodycontent outside of runLegacyTxBuild
BalancedTxBody txBodycontent balancedTxBody _ _ <-
runTxBuild
era socketPath consensusModeParams nid mScriptValidity inputsAndMaybeScriptWits readOnlyRefIns filteredTxinsc
Expand Down Expand Up @@ -360,7 +360,6 @@ runTxBuildRawCmd
lift (getIsCardanoEraConstraint era $ writeTxFileTextEnvelopeCddl out noWitTx)
& onLeft (left . ShelleyTxCmdWriteFileError)


runTxBuildRaw :: ()
=> CardanoEra era
-> Maybe ScriptValidity
Expand Down Expand Up @@ -492,7 +491,7 @@ runTxBuild :: ()
-> TxMetadataInEra era
-> Maybe UpdateProposal
-> Maybe Word
-> TxVotes era
-> VotingProcedures era
-> TxGovernanceActions era
-> TxBuildOutputOptions
-> ExceptT ShelleyTxCmdError IO (BalancedTxBody era)
Expand Down Expand Up @@ -564,6 +563,7 @@ runTxBuild

validatedPParams <- hoistEither $ first ShelleyTxCmdProtocolParametersValidationError
$ validateProtocolParameters era (Just pparams)

let validatedTxGovernanceActions = proposals
validatedTxVotes = votes
txBodyContent = TxBodyContent
Expand All @@ -585,15 +585,15 @@ runTxBuild
validatedMintValue
validatedTxScriptValidity
validatedTxGovernanceActions
validatedTxVotes
(inEraFeature era TxVotesNone (`votingProceduresToTxVotes` validatedTxVotes)) -- TODO Conway this should probably error if era not supported

firstExceptT ShelleyTxCmdTxInsDoNotExist
. hoistEither $ txInsExistInUTxO allTxInputs nodeEraUTxO
firstExceptT ShelleyTxCmdQueryNotScriptLocked
. hoistEither $ notScriptLockedTxIns txinsc nodeEraUTxO

cAddr <- pure (anyAddressInEra era changeAddr)
& onLeft (error $ "runTxBuild: Byron address used: " <> show changeAddr) -- should this throw instead?
& onLeft (error $ "runLegacyTxBuild: Byron address used: " <> show changeAddr) -- should this throw instead?

-- Why do we cast the era? 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
Loading

0 comments on commit e1ef783

Please sign in to comment.