-
Notifications
You must be signed in to change notification settings - Fork 217
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
Reference scripts impl - publication of a script #4086
Reference scripts impl - publication of a script #4086
Conversation
bbb30a4
to
ba4f707
Compare
ba4f707
to
2ed37b0
Compare
@@ -901,6 +906,8 @@ selectAssets era (ProtocolParameters pp) utxoAssumptions outs redeemers | |||
, txChange = view #skeletonChange skeleton | |||
, txPaymentTemplate = view #template <$> | |||
assumedInputScriptTemplate utxoAssumptions | |||
, txReferenceScript = |
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.
As said in DM: The changes to Write.{Balance, SizeEstimation, UTxOAssumptions}
shouldn't be needed. As long as the new inline-script-containing TxOut
is part of the partial tx given to balanceTx
, then balanceTx
will know of its size and fee-contribution. So it should just work with the changes reverted.
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.
thanks! indeed adjusting estimateTxSize
was not needed!
2ed37b0
to
491776d
Compare
5830774
to
72ec1b3
Compare
72ec1b3
to
7022fd3
Compare
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.
The implementation and test look sensible to me, but it appears to me that the validation checks when parsing a reference script template do not match the specification. 🤔
(In addition, I believe that the specific validation checks here should not be performed — definitely for the validity interval one; less definitely for the checks on the number of cosigners, as there is some correlation to which minting scripts that we allow.)
wrongMintingTemplate script = | ||
isLeft (validateScriptOfTemplate RecommendedValidation script) | ||
|| countCosigners script /= (1 :: Int) | ||
|| existsNonZeroCosigner script |
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 are these conditions checked? According to the specification (swagger.yaml), any script template should be acceptable. 🤔
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.
script template allows more than one cosigner in general. But here we are using script for minting/burning in SHELLEY (not in shared style) so we need to make sure one cosigner is present.
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.
That's alright with me — all I'm asking for is that this fact is highlighted in the specification. 🤓📓 Could you amend the documents mint-burn.md and swagger.yaml to describe the allowed values for reference_policy_script_template
?
(By definition, if the implementation is different from the specification, that's a bug.)
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.
ah, ok. done
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.
Thanks for adding a description of the restriction to mint-burn.md — could you add it to swagger.yaml as well?
a78a6b3
to
5edc807
Compare
718ddae
to
bf1b84a
Compare
specifications/api/mint-burn.md
Outdated
@@ -16,7 +16,7 @@ Specifically: | |||
|
|||
1. Creation of a transaction output that contains a minting script and is suitable for use as reference input. | |||
|
|||
In the `reference_policy_script_template` field, you can optionally add a script template. The HTTP endpoint will map this script template into a script using the wallet's policy public key, and this script will be included in the first transaction output (i.e. at index `0`) of the transaction. | |||
In the `reference_policy_script_template` field, you can optionally add a script template. The HTTP endpoint will map this script template into a script using the wallet's policy public key, and this script will be included in the first transaction output (i.e. at index `0`) of the transaction. It is worth mentioning that for shelley wallets script template needs to include one cosigner only. |
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.
In the `reference_policy_script_template` field, you can optionally add a script template. The HTTP endpoint will map this script template into a script using the wallet's policy public key, and this script will be included in the first transaction output (i.e. at index `0`) of the transaction. It is worth mentioning that for shelley wallets script template needs to include one cosigner only. | |
In the `reference_policy_script_template` field, you can optionally add a script template. The HTTP endpoint will map this script template into a script using the wallet's policy public key, and this script will be included in the first transaction output (i.e. at index `0`) of the transaction. For Shelley-style wallets, the script template must contain a single cosigner only, but it may include time locks. |
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.
done
wrongMintingTemplate script = | ||
isLeft (validateScriptOfTemplate RecommendedValidation script) | ||
|| countCosigners script /= (1 :: Int) | ||
|| existsNonZeroCosigner script |
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.
Thanks for adding a description of the restriction to mint-burn.md — could you add it to swagger.yaml as well?
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.
Thanks! 😊 No major objections anymore. Could you address the remaining comments? — Small change to description in mint-burn.md, and I would like to see a change to swagger.yaml as well.
…etail in a few bullet points the work accomplished in this PR. Before you submit, don't forget to: CODE-OF-CONDUCT.md CONTRIBUTING.md LICENSE MAINTAINERS.md README.md cabal.project default.nix docker-compose.yml docs flake.lock flake.nix floskell.json fourmolu.yaml hie-direnv.yaml justfile lib nix prototypes reports scripts shell.nix specifications test touch.me.CI weeder.dhall Make sure the GitHub PR fields are correct: ✓ Set a good Title for your PR. ✓ Assign yourself to the PR. ✓ Assign one or more reviewer(s). ✓ Link to a Jira issue, and/or other GitHub issues or PRs. ✓ In the PR description delete any empty sections and all text commented in <!--, so that this text does not appear in merge commit messages. CODE-OF-CONDUCT.md CONTRIBUTING.md LICENSE MAINTAINERS.md README.md cabal.project default.nix docker-compose.yml docs flake.lock flake.nix floskell.json fourmolu.yaml hie-direnv.yaml justfile lib nix prototypes reports scripts shell.nix specifications test touch.me.CI weeder.dhall Don't waste reviewers' time: ✓ If it's a draft, select the Create Draft PR option. ✓ Self-review your changes to make sure nothing unexpected slipped through. CODE-OF-CONDUCT.md CONTRIBUTING.md LICENSE MAINTAINERS.md README.md cabal.project default.nix docker-compose.yml docs flake.lock flake.nix floskell.json fourmolu.yaml hie-direnv.yaml justfile lib nix prototypes reports scripts shell.nix specifications test touch.me.CI weeder.dhall Try to make your intent clear: ✓ Write a good Description that explains what this PR is meant to do. ✓ Jira will detect and link to this PR once created, but you can also link this PR in the description of the corresponding Jira ticket. ✓ Highlight what Testing you have done. ✓ Acknowledge any changes required to the Documentation. --> - [x] logic in `constructTransaction` on api and `Cardano.Wallet` level - [x] extension of `TransactionCtx` - [x] use the added field in `mkUnsignedTx` - [x] fix `toCardanoTxOut` - [x] adjust fee when reference script is present - [x] integration test showing reference script publication ### Comments PR tackles publication of reference script to be used in later transactions by using reference inputs when minting/burning. Script is propagated in blockchain in the first of TxOut of a given transaction. It is shown in integration tests that construction/signing/submitting of such a transaction works, plus when decoding transaction a script is present in witness count as expected. <!-- Additional comments, links, or screenshots to attach, if any. --> ### Issue Number https://cardanofoundation.atlassian.net/browse/ADP-3090 <!-- Reference the Jira/GitHub issue that this PR relates to, and which requirements it tackles. Note: Jira issues of the form ADP- will be auto-linked. --> Source commit: d6ef2b1
<!-- Detail in a few bullet points the work accomplished in this PR. Before you submit, don't forget to: * Make sure the GitHub PR fields are correct: ✓ Set a good Title for your PR. ✓ Assign yourself to the PR. ✓ Assign one or more reviewer(s). ✓ Link to a Jira issue, and/or other GitHub issues or PRs. ✓ In the PR description delete any empty sections and all text commented in <!--, so that this text does not appear in merge commit messages. * Don't waste reviewers' time: ✓ If it's a draft, select the Create Draft PR option. ✓ Self-review your changes to make sure nothing unexpected slipped through. * Try to make your intent clear: ✓ Write a good Description that explains what this PR is meant to do. ✓ Jira will detect and link to this PR once created, but you can also link this PR in the description of the corresponding Jira ticket. ✓ Highlight what Testing you have done. ✓ Acknowledge any changes required to the Documentation. --> - [x] update `ApiMinBurnFromInput` to accommodate policy id - [x] update swagger and spec - [x] regenerate golden and make sure unit tests pass - [x] incorporate new `ApiMinBurnData` inside `constructTransaction` - [x] introduce ScriptSource - [x] handle from input case to `mkUnsignedTx` - [x] adjust `mkUnsignedTx` - [x] show the case in integration testing` ### Comments builds on top of #4086 <!-- Additional comments, links, or screenshots to attach, if any. --> ### Issue Number adp-3090 <!-- Reference the Jira/GitHub issue that this PR relates to, and which requirements it tackles. Note: Jira issues of the form ADP- will be auto-linked. -->
…the work accomplished in this PR. Before you submit, don't forget to: CODE-OF-CONDUCT.md CONTRIBUTING.md LICENSE MAINTAINERS.md README.md cabal.project default.nix docker-compose.yml docs flake.lock flake.nix floskell.json fourmolu.yaml hie-direnv.yaml justfile lib nix prototypes reports scripts shell.nix specifications test touch.me.CI weeder.dhall Make sure the GitHub PR fields are correct: ✓ Set a good Title for your PR. ✓ Assign yourself to the PR. ✓ Assign one or more reviewer(s). ✓ Link to a Jira issue, and/or other GitHub issues or PRs. ✓ In the PR description delete any empty sections and all text commented in <!--, so that this text does not appear in merge commit messages. CODE-OF-CONDUCT.md CONTRIBUTING.md LICENSE MAINTAINERS.md README.md cabal.project default.nix docker-compose.yml docs flake.lock flake.nix floskell.json fourmolu.yaml hie-direnv.yaml justfile lib nix prototypes reports scripts shell.nix specifications test touch.me.CI weeder.dhall Don't waste reviewers' time: ✓ If it's a draft, select the Create Draft PR option. ✓ Self-review your changes to make sure nothing unexpected slipped through. CODE-OF-CONDUCT.md CONTRIBUTING.md LICENSE MAINTAINERS.md README.md cabal.project default.nix docker-compose.yml docs flake.lock flake.nix floskell.json fourmolu.yaml hie-direnv.yaml justfile lib nix prototypes reports scripts shell.nix specifications test touch.me.CI weeder.dhall Try to make your intent clear: ✓ Write a good Description that explains what this PR is meant to do. ✓ Jira will detect and link to this PR once created, but you can also link this PR in the description of the corresponding Jira ticket. ✓ Highlight what Testing you have done. ✓ Acknowledge any changes required to the Documentation. --> - [x] update `ApiMinBurnFromInput` to accommodate policy id - [x] update swagger and spec - [x] regenerate golden and make sure unit tests pass - [x] incorporate new `ApiMinBurnData` inside `constructTransaction` - [x] introduce ScriptSource - [x] handle from input case to `mkUnsignedTx` - [x] adjust `mkUnsignedTx` - [x] show the case in integration testing` ### Comments builds on top of #4086 <!-- Additional comments, links, or screenshots to attach, if any. --> ### Issue Number adp-3090 <!-- Reference the Jira/GitHub issue that this PR relates to, and which requirements it tackles. Note: Jira issues of the form ADP- will be auto-linked. --> Source commit: 6157932
constructTransaction
on api andCardano.Wallet
levelTransactionCtx
mkUnsignedTx
toCardanoTxOut
Comments
PR tackles publication of reference script to be used in later transactions by using reference inputs when minting/burning.
Script is propagated in blockchain in the first of TxOut of a given transaction. It is shown in integration tests that construction/signing/submitting of such a transaction works, plus when decoding transaction a script is present in witness count as expected.
Issue Number
https://cardanofoundation.atlassian.net/browse/ADP-3090