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.
Merge pull request #659 from input-output-hk/kll/merge-main-into-next…
…-node-2022-08-11 Merge commits from main into next-node (2022-08-12)
- Loading branch information
Showing
24 changed files
with
629 additions
and
178 deletions.
There are no files selected for viewing
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
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
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,83 @@ | ||
.. _common_pab_api: | ||
|
||
ADR 6: Common Contract API | ||
========================== | ||
|
||
Date: 2022-07-12 | ||
|
||
Authors | ||
------- | ||
|
||
Gergely Szabo <[email protected]> | ||
|
||
koslambrou <[email protected]> | ||
|
||
Status | ||
------ | ||
|
||
Proposed | ||
|
||
Context | ||
------- | ||
|
||
There are multiple implementations of a Plutus Application Backend (PAB) external of IO Global, and also other tools related to Plutus smart contracts. | ||
Some of them are using the same contract interface as the official implementation, but some of them use a different interface. | ||
However, as the ecosystem evolves, it would be beneficial to create a well defined standard, that other off-chain tools can use as a reference, or as an interface to implement. | ||
|
||
Currently, as we are getting close to the Vasil hardfork, testing tools and Plutus Application backend tools are at a hurry to update their dependencies and get to a Vasil compliant/compatible state. | ||
However, tools that are depending on `plutus-apps` are blocked by the PAB development. | ||
This initiative was born out of this context, but could solve other problems as well. | ||
|
||
The Contract API (defined in `plutus-apps/plutus-contract`) is using the `freer-simple` effect system to define all the contract effects. | ||
This already allows us to separate the interface from the implementation, and to have multiple implementations/interpreters for one interface. | ||
Currently, there are two implementations for the Contract API: | ||
|
||
* one for the plutus-apps emulator (inside `plutus-apps/plutus-contract`) | ||
* one for plutus-apps' Plutus Application Backend (inside `plutus-apps/plutus-pab`) | ||
|
||
Therefore, we can leverage this separatation of interface and implementation in order to move the interface out of `plutus-apps`. | ||
|
||
Decision | ||
-------- | ||
|
||
* We will split the `plutus-apps/plutus-contract` package into two parts: the Contract API (`plutus-contract`) and the emulator (`plutus-contract-emulator`). | ||
|
||
* We will create effects for the constraints-based transaction builder library (`plutus-apps/plutus-ledger-constraints`) in the Contract API. | ||
Currently, the interface and the implementation in the transaction builder library are tightly coupled. | ||
Therefore, we need to decouple them. | ||
|
||
* We will create a separate repository with the contract effects and types (the splitted `plutus-contract`). | ||
By moving the Contract API out of the plutus-apps monorepository, any tool could update to newer version to their discretion. | ||
Without many dependencies, many tools could utilize the Contract API without having to depend on the whole plutus-apps monorepo. | ||
|
||
* We (the Plutus Tools at IO Global) will continue to be the main maintainers of this new repository. | ||
However, a new ADR will need to be created if we ever decide to make this a community driven project. | ||
|
||
* TODO: What about governance? How do we decide which interface changes are accepted? ADRs? Who ultimately accepts and rejects them? | ||
|
||
Argument | ||
-------- | ||
|
||
We speed up the development of off-chain tools, by loosening up some of tightly coupled dependencies, so these external projects can move more freely. | ||
This would also mean that the cost of the interface update would be reduced, so we could see more features added to the standard, and the PAB API following the capabilities of Cardano more closely. | ||
As an added benefit, community involvement with the API could also greatly improve. | ||
|
||
A standard API for all Plutus contacts would help keeping the ecosystem on the same track with their implementation. | ||
As more and more off-chain tools implement the same contract interface in the future, it will be relatively easy to switch between different Plutus Application Backend implementations, or to use multiple of these tools at the same time without a need for serious code rewrites. | ||
|
||
The implementation of the Contract API interface would track a specific version of the Contract API interface. | ||
We would then need to regularly update the implementation given any interface changes. | ||
|
||
Implications | ||
------------ | ||
|
||
* We will need to decide if we should make this a community driven project. | ||
If so, we will also need to make a decision about governance. | ||
How do we decide which interface changes are accepted? | ||
Do we use ADRs? | ||
Who ultimately accepts and rejects them? | ||
|
||
Notes | ||
----- | ||
|
||
This ADR has been discussed here: `#586 <https://github.com/input-output-hk/plutus-apps/pull/586>`_. |
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
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
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
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
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
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
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
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
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
Oops, something went wrong.