This repository has been archived by the owner on Dec 2, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 214
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PLT-682 ADR for the constraint interface change in order to support r…
…eference inputs (#654)
- Loading branch information
1 parent
52b0a47
commit dc37b7d
Showing
2 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
doc/adr/0007-support-reference-inputs-in-constraint-library.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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>`_. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters