Skip to content

Commit

Permalink
Added info about PlutusV3 to the Read-the-docs page about Plutus lang…
Browse files Browse the repository at this point in the history
…uage changes (#5844)

* added info for PlutusV3

* incorporating minor review comments
  • Loading branch information
joseph-fajen authored Mar 19, 2024
1 parent 5879f8e commit 973e03b
Showing 1 changed file with 46 additions and 4 deletions.
50 changes: 46 additions & 4 deletions doc/read-the-docs-site/reference/cardano/language-changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ Language versions

See the documentation on :ref:`language versions <what_are_plutus_language_versions>` for an explanation of what they are.

Plutus V1
PlutusV1
~~~~~~~~~~

``PlutusV1`` was the initial version of Plutus, introduced in the Alonzo hard fork.

Plutus V2
PlutusV2
~~~~~~~~~~

``PlutusV2`` was introduced in the Vasil hard fork.
Expand All @@ -29,7 +29,7 @@ The ``ScriptContext`` was extended to include the following information:
Examples
------------

- `Plutus V2 functionalities <https://github.com/IntersectMBO/cardano-node/blob/master/doc/reference/plutus/babbage-script-example.md>`_
- `PlutusV2 functionalities <https://github.com/input-output-hk/cardano-node-wiki/blob/main/docs/reference/plutus/babbage-script-example.md>`_
- `How to use reference inputs <https://github.com/perturbing/vasil-tests/blob/main/reference-inputs-cip-31.md>`_
- `How to use inline datums <https://github.com/perturbing/vasil-tests/blob/main/inline-datums-cip-32.md>`_
- `How to reference scripts <https://github.com/perturbing/vasil-tests/blob/main/referencing-scripts-cip-33.md>`_
Expand All @@ -53,6 +53,48 @@ Vasil

All of the built-in types and functions from ``PlutusV1`` were added to ``PlutusV2``.

The following built-in function was added to ``PlutusV2`` only (i.e., it is not available in ``PlutusV1``).
The following built-in function was added to ``PlutusV2`` only (ie, it is not available in ``PlutusV1``).

- ``serializeData`` (proposed in `CIP-42 <https://cips.cardano.org/cips/cip42/>`_)

PlutusV3
~~~~~~~~~

Plutus and cryptography teams at IOG, in collaboration with `MLabs <https://mlabs.city/>`_, continue to develop Plutus capabilities. Starting with the release of `Cardano node v.8.8.0-pre <https://github.com/IntersectMBO/cardano-node/releases/tag/8.8.0-pre>`_, ``PlutusV3`` is available on `SanchoNet <https://sancho.network/>`_, introducing the Cardano community to governance features from `CIP-1694 <https://cips.cardano.org/cip/CIP-1694#goal>`_ in a controlled testnet environment.

``PlutusV3`` is the new ledger language that enhances Plutus Core's cryptographic capabilities, offering the following benefits for the smart contract developer community:

- Providing an updated script context that will let users see `CIP-1694 <https://cips.cardano.org/cip/CIP-1694#goal>`_ governance-related entities and voting features
- Interoperability between blockchains
- Advanced Plutus primitives
- Well-known and optimal cryptographic algorithms
- Support for porting of smart contracts from Ethereum
- Creating sidechain bridges
- Improving performance by adding a sums of products (SOPs) feature to support the direct encoding of differrent data types.

Sums of products
~~~~~~~~~~~~~~~~

``PlutusV3`` introduces sums of products - a way of encoding data types that leads to smaller and cheaper scripts compared with `Scott encoding <https://en.wikipedia.org/wiki/Mogensen%E2%80%93Scott_encoding>`_, a common way of encoding data types in Plutus Core.

The sums of products approach aims to boost script efficiency and improve code generation for Plutus Core compilers. The changes involve new term constructors for packing fields into constructor values and efficient tag inspection for case branches, potentially running programs 30% faster. For an in-depth discussion, see `CIP-85 <https://cips.cardano.org/cip/CIP-0085>`_.

New cryptographic primitives
~~~~~~~~~~~~~~~~~~~~~~~~~~~~

``PlutusV3`` provides new built-in primitives that expand the language's capabilities.

- **BLS12-381**: A curve pairing that includes 17 primitives that support cryptographic curves. This is a benefit to sidechain specification implementation and `Mithril <https://iohk.io/en/blog/posts/2023/07/20/mithril-nears-mainnet-release/>`_ integration.
- **Blake2b-224**: A cryptographic hash function for on-chain computation of public-key hashes for the validation of transaction signatures. Supports community projects and contributes to Cardano's versatility.
- **Keccak-256**: A cryptographic hash function that produces a 256-bit (32-byte) hash value, commonly used for secure data verification. Supports Ethereum signature verification within scripts and cross-chain solutions.

Bitwise primitives
~~~~~~~~~~~~~~~~~~~

PlutusV3 initially brings several new bitwise primitives (with more to come at later stages). The introduction of `CIP-58 <https://cips.cardano.org/cip/CIP-0058>`_ bitwise primitives will enable the following features:

- Very low-level bit manipulations within Plutus, supporting the ability to execute high-performance data manipulation operations.
- Supporting the implementation of secure and robust cryptographic algorithms within Plutus.
- Facilitating standard, high-performance implementations for conversions between integers and bytestrings.

``PlutusV3`` adds two bitwise primitives: ``integerToByteString`` and ``byteStringToInteger``. The remaining primitives will be added to ``PlutusV3`` gradually and will not require a new ledger language.

1 comment on commit 973e03b

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'Plutus Benchmarks'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 1.05.

Benchmark suite Current: 973e03b Previous: 5879f8e Ratio
nofib-clausify/formula1 4500 μs 3937 μs 1.14
nofib-clausify/formula2 5908 μs 5170 μs 1.14
nofib-clausify/formula3 16059.999999999998 μs 14030 μs 1.14
nofib-clausify/formula4 32930 μs 28700 μs 1.15
nofib-clausify/formula5 77710 μs 67770 μs 1.15
nofib-knights/4x4 20970 μs 18040 μs 1.16
nofib-knights/6x6 56980 μs 47820 μs 1.19
nofib-knights/8x8 100600 μs 83910 μs 1.20
nofib-primetest/05digits 10450 μs 9036 μs 1.16
nofib-primetest/08digits 16840 μs 14550 μs 1.16
nofib-primetest/10digits 20120 μs 17400 μs 1.16
nofib-primetest/20digits 39530 μs 34530 μs 1.14
nofib-primetest/30digits 61130 μs 53130 μs 1.15
nofib-primetest/40digits 82050 μs 72160 μs 1.14
nofib-primetest/50digits 100200 μs 88180 μs 1.14
nofib-queens4x4/bt 6498 μs 5675 μs 1.15
nofib-queens4x4/bm 8505 μs 7364 μs 1.15
nofib-queens4x4/bjbt1 8032 μs 6983 μs 1.15
nofib-queens4x4/bjbt2 7441 μs 6473 μs 1.15
nofib-queens4x4/fc 17790 μs 15110 μs 1.18
nofib-queens5x5/bt 86800 μs 75610 μs 1.15
nofib-queens5x5/bm 95380 μs 82290 μs 1.16
nofib-queens5x5/bjbt1 102500 μs 89090 μs 1.15
nofib-queens5x5/bjbt2 98880 μs 85950 μs 1.15
nofib-queens5x5/fc 225800 μs 190800 μs 1.18

This comment was automatically generated by workflow using github-action-benchmark.

CC: @input-output-hk/plutus-core

Please sign in to comment.