Skip to content
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

Update example-reference-script-usage.sh to also use inline datums #4006

Merged
merged 2 commits into from
Jun 9, 2022

Conversation

Jimbo4350
Copy link
Contributor

@Jimbo4350 Jimbo4350 commented Jun 6, 2022

We introduce --reference-tx-in-inline-datum-present and --tx-in-inline-datum-present to indicate when we are using an inline datum.

@Jimbo4350 Jimbo4350 force-pushed the jordan/inline-datum-integration branch 2 times, most recently from ff26f83 to 9d1ae5e Compare June 7, 2022 17:28
@Jimbo4350 Jimbo4350 marked this pull request as ready for review June 7, 2022 17:28
@Jimbo4350 Jimbo4350 force-pushed the jordan/inline-datum-integration branch 2 times, most recently from c2cd1af to a2234f9 Compare June 7, 2022 17:37
@Jimbo4350 Jimbo4350 mentioned this pull request Jun 7, 2022
38 tasks
+ spending ada at the Plutus script address using the Plutus reference script

In this example we will use the [Required Redeemer](scripts/plutus/scripts/v2/required-redeemer.plutus) Plutus spending script. In order to execute a reference Plutus spending script, we require the following:

- Collateral tx input(s) - these are provided and are forfeited in the event the Plutus script fails to execute.
- A Plutus tx output with accompanying datum hash. This is the tx output that sits at the Plutus script address. It must have a datum hash, otherwise, it is unspendable.
- A Plutus tx output. This is the tx output that sits at the Plutus script address. Note because we are using an inline datum, it is not mandatory that the utxo at the plutus script address has a datum hash.
Copy link
Contributor

@catch-21 catch-21 Jun 7, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is not mandatory

Actually, it strictly cannot have a datum hash because the inline datum we reference cannot witness it. It would then need the datum to be attached to the tx, which means we cannot also reference the inline datum!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should stress this point, how about: "Note because we are using an inline datum, the utxo at the plutus script address must not have a datum hash because datum witnessing requirements cannot be satisfied with reference inputs. Outputs with datum hashes must have datum included in transaction body as witness."

Copy link
Contributor Author

@Jimbo4350 Jimbo4350 Jun 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, it strictly cannot have a datum hash because the inline datum we reference cannot witness it. It would then need the datum to be attached to the tx, which means we cannot also reference the inline datum!

Yep my wording is poor. "it is not mandatory that the utxo at the plutus script address has a datum hash" what I mean to say here is you can use an inline datum instead of a datum hash.

@Jimbo4350 Jimbo4350 force-pushed the jordan/inline-datum-integration branch 3 times, most recently from 4817c30 to 85439b4 Compare June 8, 2022 15:35
@Jimbo4350 Jimbo4350 force-pushed the jordan/inline-datum-integration branch from 85439b4 to 96b6144 Compare June 8, 2022 16:12
@catch-21
Copy link
Contributor

catch-21 commented Jun 8, 2022

Conversely, if the Plutus script failed, the collateral input would have been consumed.

Bit scary. It would only fail local validation so we could say that.

Copy link
Contributor

@JaredCorduan JaredCorduan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me!

Add documentation for inline datum usage
Implement inline-datum-present cli parser to indicate that an inline
datum is present
@Jimbo4350 Jimbo4350 force-pushed the jordan/inline-datum-integration branch from 620705d to be290c5 Compare June 9, 2022 12:22
@Jimbo4350
Copy link
Contributor Author

bors r+

@iohk-bors
Copy link
Contributor

iohk-bors bot commented Jun 9, 2022

Build succeeded:

@iohk-bors iohk-bors bot merged commit 147f78a into master Jun 9, 2022
@iohk-bors iohk-bors bot deleted the jordan/inline-datum-integration branch June 9, 2022 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants