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

[FR] - Capability to add additional data in a body content #600

Closed
mmontin opened this issue Jul 29, 2024 · 5 comments
Closed

[FR] - Capability to add additional data in a body content #600

mmontin opened this issue Jul 29, 2024 · 5 comments

Comments

@mmontin
Copy link

mmontin commented Jul 29, 2024

Internal/External
External

Area
Plutus

Describe the feature you'd like

At the moment, it does not seem possible to pass additional data in the form of a correspondance between a datum hash and a datum in a transaction body, in addition to the one collected from the script witnesses in inputs, and the outputs of the body.

However, when referencing a utxo which happens to have a hashed datum, this is needed.

Indeed, in function mkShelleyTransactionBody we can see that the HashableScriptData are derived from the body itself, from the two locations mentioned above, as follows:

    scriptdata :: [HashableScriptData]
    scriptdata =
      [d | TxOut _ _ (TxOutDatumInTx _ d) _ <- txOuts]
        ++ [ d
           | ( _
              , AnyScriptWitness
                  ( PlutusScriptWitness
                      _
                      _
                      _
                      (ScriptDatumForTxIn (Just d))
                      _
                      _
                    )
              ) <-
              witnesses
           ]

Then, the verification hash of the body is computed from these data using convPParamsToScriptIntegrityHash, and is wrapped as well in the Shelley transaction body. As a consequence, there seem to be no builtin way to have additional data in the resulting Shelley transaction body.

My feature request is to have such a way of including additional data in the transaction body.

This could take several forms, such as:

  • an additional field in the TxBodyContent structure
  • an additional parameter in the mkShelleyTransactionBody function

Describe alternatives you've considered

For now, I have used the following work-around:

  • generating the transaction body using mkShelleyTransactionBody
  • deconstructing the generated transaction body
  • manually adding the necessary data in the respective field of the transaction
  • manually re-generating the script integrity hash using the new data map with convPParamsToScriptIntegrityHash
  • wrapping back those changed elements into a new Shelley transaction body.

This does allow the ledger to generate the proper script context but it does not feel like the proper way to achieve this result.

@mmontin mmontin changed the title [FR] - [FR] - Capability to add additional data in a body content Jul 29, 2024
@smelc
Copy link
Contributor

smelc commented Aug 5, 2024

cc @Jimbo4350 @carbolymer

Copy link

github-actions bot commented Sep 5, 2024

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 120 days.

@github-actions github-actions bot added the Stale label Sep 5, 2024
@smelc smelc removed the Stale label Sep 5, 2024
@mmontin
Copy link
Author

mmontin commented Sep 10, 2024

Following a discussion I had on Discord, it was confirmed that this feature is not currently present. I will work on a contribution to integrate it.

@mmontin
Copy link
Author

mmontin commented Sep 13, 2024

Just realized that the issue is most likely the same when consuming inputs from pkh with a hashed datum. All indicate that there would currently be no way to provide the associated datum in the body.

@smelc
Copy link
Contributor

smelc commented Oct 11, 2024

Closed by #640

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

No branches or pull requests

3 participants