-
Notifications
You must be signed in to change notification settings - Fork 23
Remove requirement of "current treasury value" for transactions #1322
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
15a01f7
c1a4e6a
24d7d28
33cc26c
edcde6f
e252165
27ed710
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,6 +24,7 @@ import Cardano.CLI.EraBased.Script.Type | |
| import Cardano.CLI.EraBased.Script.Type qualified as PlutusSpend | ||
| import Cardano.CLI.EraBased.Script.Vote.Type qualified as Voting | ||
| import Cardano.CLI.EraBased.Script.Withdrawal.Type qualified as Withdrawal | ||
| import Cardano.CLI.EraBased.Transaction.Command (IncludeCurrentTreasuryValue (..)) | ||
| import Cardano.CLI.Option.Flag | ||
| import Cardano.CLI.Option.Flag.Type qualified as Z | ||
| import Cardano.CLI.Orphan () | ||
|
|
@@ -1190,21 +1191,28 @@ pProposalReferencePlutusScriptWitness prefix autoBalanceExecUnits = | |
| ManualBalance -> pExecutionUnits $ appendedPrefix ++ "reference-tx-in" | ||
| ) | ||
|
|
||
| pCurrentTreasuryValueAndDonation | ||
| :: Parser (Maybe (TxCurrentTreasuryValue, TxTreasuryDonation)) | ||
| pCurrentTreasuryValueAndDonation = | ||
| optional ((,) <$> pCurrentTreasuryValue' <*> pTreasuryDonation') | ||
| pCurrentTreasuryValue :: Parser (Maybe TxCurrentTreasuryValue) | ||
| pCurrentTreasuryValue = | ||
| optional $ | ||
| TxCurrentTreasuryValue | ||
| <$> ( Opt.option (readerFromParsecParser parseLovelace) $ | ||
| mconcat | ||
| [ Opt.long "current-treasury-value" | ||
| , Opt.metavar "LOVELACE" | ||
| , Opt.help "The current treasury value." | ||
| ] | ||
| ) | ||
|
|
||
| pCurrentTreasuryValue' :: Parser TxCurrentTreasuryValue | ||
| pCurrentTreasuryValue' = | ||
| TxCurrentTreasuryValue | ||
| <$> ( Opt.option (readerFromParsecParser parseLovelace) $ | ||
| mconcat | ||
| [ Opt.long "current-treasury-value" | ||
| , Opt.metavar "LOVELACE" | ||
| , Opt.help "The current treasury value." | ||
| ] | ||
| ) | ||
| pIncludeCurrentTreasuryValue :: Parser IncludeCurrentTreasuryValue | ||
| pIncludeCurrentTreasuryValue = | ||
| asum | ||
| [ Opt.flag' IncludeCurrentTreasuryValue $ | ||
| mconcat | ||
| [ Opt.long "include-current-treasury-value" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why deviate from the name that
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The reason I used a different name for the flag is that this one obtains the value from the node, while |
||
| , Opt.help "Include the current treasury value in the transaction." | ||
| ] | ||
| , pure ExcludeCurrentTreasuryValue | ||
| ] | ||
|
|
||
| pTreasuryDonation :: Parser (Maybe TxTreasuryDonation) | ||
| pTreasuryDonation = | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,6 +24,7 @@ module Cardano.CLI.EraBased.Transaction.Command | |
| , TransactionViewCmdArgs (..) | ||
| , TransactionWitnessCmdArgs (..) | ||
| , TxCborFormat (..) | ||
| , IncludeCurrentTreasuryValue (..) | ||
| , renderTransactionCmds | ||
| ) | ||
| where | ||
|
|
@@ -92,7 +93,8 @@ data TransactionBuildRawCmdArgs era = TransactionBuildRawCmdArgs | |
| , mUpdateProprosalFile :: !(Maybe (Featured ShelleyToBabbageEra era (Maybe UpdateProposalFile))) | ||
| , voteFiles :: ![(VoteFile In, Maybe (ScriptRequirements Exp.VoterItem))] | ||
| , proposalFiles :: ![(ProposalFile In, Maybe (ScriptRequirements Exp.ProposalItem))] | ||
| , currentTreasuryValueAndDonation :: !(Maybe (TxCurrentTreasuryValue, TxTreasuryDonation)) | ||
| , mCurrentTreasuryValue :: !(Maybe TxCurrentTreasuryValue) | ||
| , mTreasuryDonation :: !(Maybe TxTreasuryDonation) | ||
| , isCborOutCanonical :: !TxCborFormat | ||
| , txBodyOutFile :: !(TxBodyFile Out) | ||
| } | ||
|
|
@@ -107,6 +109,22 @@ data TxCborFormat | |
| | TxCborNotCanonical | ||
| deriving (Eq, Show) | ||
|
|
||
| -- | Whether to include the current treasury value in the transaction body. | ||
palas marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| -- | ||
| -- If included, the current treasury value will be obtained from the node. | ||
| -- | ||
| -- The current treasury value serves as a precondition to executing Plutus | ||
| -- scripts that access the value of the treasury. | ||
| -- | ||
| -- See: https://intersectmbo.github.io/formal-ledger-specifications/site/Ledger.Conway.Specification.Transaction.html#sec:transactions | ||
| -- | ||
| -- If a transaction contains any votes, proposals, a treasury donation or | ||
| -- asserts the treasury amount, it is only allowed to contain Plutus V3 scripts. | ||
| -- | ||
| -- See: https://intersectmbo.github.io/formal-ledger-specifications/site/Ledger.Conway.Specification.Utxow.html#sec:witnessing-functions | ||
| data IncludeCurrentTreasuryValue = IncludeCurrentTreasuryValue | ExcludeCurrentTreasuryValue | ||
palas marked this conversation as resolved.
Show resolved
Hide resolved
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are you introducing this sum type? It's not necessary. What is wrong with
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is different because that command takes the value from the node, not from the command line, so it would be equivalent to And the reason I don't use |
||
| deriving (Eq, Show) | ||
|
|
||
| -- | Like 'TransactionBuildRaw' but without the fee, and with a change output. | ||
| data TransactionBuildCmdArgs era = TransactionBuildCmdArgs | ||
| { currentEra :: !(Exp.Era era) | ||
|
|
@@ -148,7 +166,8 @@ data TransactionBuildCmdArgs era = TransactionBuildCmdArgs | |
| , mUpdateProposalFile :: !(Maybe (Featured ShelleyToBabbageEra era (Maybe UpdateProposalFile))) | ||
| , voteFiles :: ![(VoteFile In, Maybe (ScriptRequirements Exp.VoterItem))] | ||
| , proposalFiles :: ![(ProposalFile In, Maybe (ScriptRequirements Exp.ProposalItem))] | ||
| , treasuryDonation :: !(Maybe TxTreasuryDonation) | ||
| , includeCurrentTreasuryValue :: !IncludeCurrentTreasuryValue | ||
| , mTreasuryDonation :: !(Maybe TxTreasuryDonation) | ||
| , isCborOutCanonical :: !TxCborFormat | ||
| , buildOutputOptions :: !TxBuildOutputOptions | ||
| } | ||
|
|
@@ -198,7 +217,8 @@ data TransactionBuildEstimateCmdArgs era = TransactionBuildEstimateCmdArgs | |
| , metadataFiles :: ![MetadataFile] | ||
| , voteFiles :: ![(VoteFile In, Maybe (ScriptRequirements Exp.VoterItem))] | ||
| , proposalFiles :: ![(ProposalFile In, Maybe (ScriptRequirements Exp.ProposalItem))] | ||
| , currentTreasuryValueAndDonation :: !(Maybe (TxCurrentTreasuryValue, TxTreasuryDonation)) | ||
| , currentTreasuryValue :: !(Maybe TxCurrentTreasuryValue) | ||
| , treasuryDonation :: !(Maybe TxTreasuryDonation) | ||
| , isCborOutCanonical :: !TxCborFormat | ||
| , txBodyOutFile :: !(TxBodyFile Out) | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.