-
Notifications
You must be signed in to change notification settings - Fork 16
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
Introduce new cardano-cli latest transaction build-estimate
command
#728
Conversation
cardano-cli latest transaction build-estimate
Usage: cardano-cli latest transaction build-estimate
[ --script-valid
| --script-invalid
]
--shelley-key-witnesses INT
[--byron-key-witnesses Int]
--protocol-params-file FILE
--total-utxo-value VALUE
(--tx-in TX-IN
[ --spending-tx-in-reference TX-IN
( --spending-plutus-script-v2
| --spending-plutus-script-v3
)
( --spending-reference-tx-in-datum-cbor-file CBOR FILE
| --spending-reference-tx-in-datum-file JSON FILE
| --spending-reference-tx-in-datum-value JSON VALUE
| --spending-reference-tx-in-inline-datum-present
)
( --spending-reference-tx-in-redeemer-cbor-file CBOR FILE
| --spending-reference-tx-in-redeemer-file JSON FILE
| --spending-reference-tx-in-redeemer-value JSON VALUE
)
--spending-reference-tx-in-execution-units (INT, INT)
| --simple-script-tx-in-reference TX-IN
| --tx-in-script-file FILE
[
( --tx-in-datum-cbor-file CBOR FILE
| --tx-in-datum-file JSON FILE
| --tx-in-datum-value JSON VALUE
| --tx-in-inline-datum-present
)
( --tx-in-redeemer-cbor-file CBOR FILE
| --tx-in-redeemer-file JSON FILE
| --tx-in-redeemer-value JSON VALUE
)
--tx-in-execution-units (INT, INT)]
])
[--read-only-tx-in-reference TX-IN]
[ --required-signer FILE
| --required-signer-hash HASH
]
[--tx-in-collateral TX-IN]
[--tx-out-return-collateral ADDRESS VALUE]
[--tx-out ADDRESS VALUE
[ --tx-out-datum-hash HASH
| --tx-out-datum-hash-cbor-file CBOR FILE
| --tx-out-datum-hash-file JSON FILE
| --tx-out-datum-hash-value JSON VALUE
| --tx-out-datum-embed-cbor-file CBOR FILE
| --tx-out-datum-embed-file JSON FILE
| --tx-out-datum-embed-value JSON VALUE
| --tx-out-inline-datum-cbor-file CBOR FILE
| --tx-out-inline-datum-file JSON FILE
| --tx-out-inline-datum-value JSON VALUE
]
[--tx-out-reference-script-file FILE]]
--change-address ADDRESS
[--mint VALUE
( --mint-script-file FILE
[
( --mint-redeemer-cbor-file CBOR FILE
| --mint-redeemer-file JSON FILE
| --mint-redeemer-value JSON VALUE
)
--mint-execution-units (INT, INT)]
| --simple-minting-script-tx-in-reference TX-IN
--policy-id HASH
| --mint-tx-in-reference TX-IN
( --mint-plutus-script-v2
| --mint-plutus-script-v3
)
( --mint-reference-tx-in-redeemer-cbor-file CBOR FILE
| --mint-reference-tx-in-redeemer-file JSON FILE
| --mint-reference-tx-in-redeemer-value JSON VALUE
)
--mint-reference-tx-in-execution-units (INT, INT)
--policy-id HASH
)]
[--invalid-before SLOT]
[--invalid-hereafter SLOT]
[--certificate-file FILE
[ --certificate-script-file FILE
[
( --certificate-redeemer-cbor-file CBOR FILE
| --certificate-redeemer-file JSON FILE
| --certificate-redeemer-value JSON VALUE
)
--certificate-execution-units (INT, INT)]
| --certificate-tx-in-reference TX-IN
( --certificate-plutus-script-v2
| --certificate-plutus-script-v3
)
( --certificate-reference-tx-in-redeemer-cbor-file CBOR FILE
| --certificate-reference-tx-in-redeemer-file JSON FILE
| --certificate-reference-tx-in-redeemer-value JSON VALUE
)
--certificate-reference-tx-in-execution-units (INT, INT)
]]
[--withdrawal WITHDRAWAL
[ --withdrawal-script-file FILE
[
( --withdrawal-redeemer-cbor-file CBOR FILE
| --withdrawal-redeemer-file JSON FILE
| --withdrawal-redeemer-value JSON VALUE
)
--withdrawal-execution-units (INT, INT)]
| --withdrawal-tx-in-reference TX-IN
( --withdrawal-plutus-script-v2
| --withdrawal-plutus-script-v3
)
( --withdrawal-reference-tx-in-redeemer-cbor-file CBOR FILE
| --withdrawal-reference-tx-in-redeemer-file JSON FILE
| --withdrawal-reference-tx-in-redeemer-value JSON VALUE
)
--withdrawal-reference-tx-in-execution-units (INT, INT)
]]
[--tx-total-collateral INTEGER]
[--reference-script-size NATURAL]
[ --json-metadata-no-schema
| --json-metadata-detailed-schema
]
[--auxiliary-script-file FILE]
[ --metadata-json-file FILE
| --metadata-cbor-file FILE
]
[--update-proposal-file FILE]
--out-file FILE
Build a balanced transaction without access to a live node (automatically estimates fees) |
c399f5f
to
bcd5053
Compare
|
||
{-# OPTIONS_GHC -Wno-unrecognised-pragmas #-} | ||
{-# OPTIONS_GHC -fwarn-incomplete-patterns #-} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this needed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It shouldn't be. I was trying to understand why GHC did not complain about: https://github.com/IntersectMBO/cardano-cli/pull/728/files#diff-a38343c1825e6e334224d0a8a1ba78a458652970f00c54f5fb0d040be28f822eR787
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🥲
┃ │ ━━━━ stderr ━━━━
┃ │
┃ │ cardano-cli: user error (Pattern match failure in 'do' block at src/Cardano/CLI/EraBased/Run/Transaction.hs:787:3-26)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But there's no pattern matching in that fragment:
validatedTxCerts
<- hoistEither
. first TxCmdTxCertificatesValidationError
$ validateTxCertificates era certsAndMaybeScriptWits
strange
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated it.
cardano-cli/test/cardano-cli-golden/files/golden/help/conway_transaction.cli
Show resolved
Hide resolved
085c1e5
to
7c3e048
Compare
certificates in the transaction
7c3e048
to
b43bdbe
Compare
poolsToDeregister = Set.fromList $ catMaybes [getPoolDeregistrationInfo cert | (cert,_) <- certsAndMaybeScriptWits] | ||
totCol = fromMaybe 0 plutusCollateral | ||
pScriptExecUnits = Map.fromList [ (sWitIndex, execUnits) | ||
| (sWitIndex, (AnyScriptWitness (PlutusScriptWitness _ _ _ _ _ execUnits))) <- collectTxBodyScriptWitnesses sbe txBodyContent |
Check notice
Code scanning / HLint
Redundant bracket Note
Found:
(sWitIndex,
(AnyScriptWitness (PlutusScriptWitness _ _ _ _ _ execUnits)))
Perhaps:
(sWitIndex,
AnyScriptWitness (PlutusScriptWitness _ _ _ _ _ execUnits))
estimateBalancedTxBody eon txBodyContent (unLedgerProtocolParameters ledgerPParams) poolsToDeregister | ||
stakeCredentialsToDeregisterMap drepsToDeregisterMap | ||
pScriptExecUnits totCol shelleyWitnesses (fromMaybe 0 mByronWitnesses) | ||
(fromMaybe 0 (unReferenceScriptSize <$> totalReferenceScriptSize)) (anyAddressInShelleyBasedEra sbe changeAddr) |
Check warning
Code scanning / HLint
Use maybe Warning
Found:
fromMaybe 0 (unReferenceScriptSize <$> totalReferenceScriptSize)
Perhaps:
maybe 0 unReferenceScriptSize totalReferenceScriptSize
Changelog
Context
Additional context for the PR goes here. If the PR fixes a particular issue please provide a link to the issue.
How to trust this PR
Highlight important bits of the PR that will make the review faster. If there are commands the reviewer can run to observe the new behavior, describe them.
Checklist