Skip to content
This repository has been archived by the owner on Dec 2, 2024. It is now read-only.

Commit

Permalink
PLT-682 ADR for the constraint interface change in order to support r…
Browse files Browse the repository at this point in the history
…eference inputs (#654)
  • Loading branch information
koslambrou authored Aug 11, 2022
1 parent 52b0a47 commit dc37b7d
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
47 changes: 47 additions & 0 deletions doc/adr/0007-support-reference-inputs-in-constraint-library.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
.. _support_reference_inputs_in_constraint_library:

ADR 7: Support reference inputs in constraint library
=====================================================

Date: 2022-08-09

Authors
-------

koslambrou <[email protected]>

Status
------

Proposed

Context
-------

After the Vasil HF, the Cardano blockchain will support `reference` inputs by adding a new field in the transaction data type.
With reference inputs, transactions can take a look at UTXOs without actually spending them.

Thus, we need to adapt our transaction constraint data type (`TxConstraints`) to support referencing UTXOs.

Decision
--------

* We will add the data constuctor `MustReferenceOutput TxOutRef` to the `TxConstraints` data type.

* The PlutusV1 on-chain implementation of this new constraint will simply return `False`.
However, `cardano-ledger` throws a phase-1 validation error if transactions that use the some of the new features (reference inputs, inline datums and reference scripts) try to execute PlutusV1 scripts.
See the `Babbage era ledger specification <https://hydra.iohk.io/job/Cardano/cardano-ledger/specs.babbage-ledger/latest/download-by-type/doc-pdf/babbage-changes>`_.
Therefore, the only way to get a phase-2 validation error would be to use this constraint on-chain in a PlutusV1 script, without using any of the new Babbage era features off-chain.

* The PlutusV2 on-chain implementation of this new constraint will check that the provided `TxOutRef` is part of the `ScriptContext`'s reference inputs.

Argument
--------

At first glance, we might think that we need two data constructors for reference inputs such as `MustReferencePubKeyOutput` and `MustReferenceScriptOutput` in contrast to the existing `MustSpendPubKeyOutput` and `MustSpendScriptOutput` constraints.
However, we do not need to make the distinction between public key outputs and script outputs because we're not spending the output, therefore, we don't need to provide a redeemer nor the actual script as a witness to the transaction input.

Notes
-----

This ADR has been partially addressed on PR `#640 <https://github.com/input-output-hk/plutus-apps/pull/640>`_.
1 change: 1 addition & 0 deletions doc/adr/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,4 @@ The general process for creating an ADR is:
0004-marconi-initiative
0005-pab-indexing-solution-integration
0006-common-contract-api
0007-support-reference-inputs-in-constraint-library

0 comments on commit dc37b7d

Please sign in to comment.