completed

Plutus-extra: Plutus helper library

$75,000.00 Received
$75,000.00 Requested
Ideascale logo View on ideascale
Community Review Results (1 reviewers)
Addresses Challenge
Feasibility
Auditability
Solución

Plutus/PAB utility functions & data structures for Plutus scripts; Open source (Apache 2.0) & in use on mainnet by projects like SundaeSwap.

Problem:

Plutus developers don't have a standard open source contract tooling required to quickly build, test and simulate their smart contracts.

Yes Votes:
₳ 135,013,217
No Votes:
₳ 2,137,219
Votes Cast:
357

This proposal was approved and funded by the Cardano Community via Project F8: Open Source Development Ecosystem Catalyst funding round.

  • download
  • download

[IMPACT]

Plutus-extra Overview

<u>Data structures</u>

The package introduces PlutusTx.Set of unique values (running in linear time), PlutusTx.Map of key-value pairs, PlutusTx.Bimap of pairs, and PlutusTx.NonEmpty list which always has at least one element.

<u>Plutus Application Backend (PAB) utility functions</u>

Modules in Plutus.PAB directory introduces utility functions to be used with the PAB:

  • Plutus.PAB.CurrencyForge exports initCurrency, for minting new currency and giving it to a specific wallet
  • Plutus.PAB.OutputBus is a wrapper around the channel transferring information between Contract and real world
  • Plutus.PAB.PrettyLogger introduces useful functions for prettying the logs

<u>Type classes</u>

PlutusTx.Bifunctor behaves like a Functor over both of it's type arguments (see attached example diagram below)

<u>Extra functions</u>

The package extends Plutus.V1.Ledger and PlutusTx with useful library functions placed inside modules ending with Extra suffix.

E.g., PlutusTx.Either.Extra introduces function maybeToEither (see attached example diagram below)

The full collection of helper libraries and data structures that compose Plutus-extra and its sub-libraries include:

-plutus-extra: extended functions and data structures for Plutus scripts.

-plutus-numeric: a range of extensions to Plutus' numerical hierarchy.

-plutus-pretty: a collection of helpers for pretty-printing Plutus types.

-tasty-plutus: a testing framework for Plutus scripts.

-plutus-collection: list utility functions that are not present in the Plutus standard library, including functions involving lengths that work with the Natural number type in plutus-numeric, as well as functions related to sorting.

-plutus-context-builder: a utility library for creating ScriptContext with Spending or Minting ScriptPurpose. This provides a builder abstraction for assembling ScriptContext.

-plutus-deriving: a helper for deriving lawful instances of Plutus type classes.

-plutus-golden: a framework for testing serialized representation stability using golden testing. This focuses on type classes used for serialization for Plutus projects.

-plutus-laws: a helper library for checking type class laws, similar in spirit to quickcheck-classes.

-plutus-size-check: a tasty-based utility for checking the on-chain sizes of anything the Plutus compiler can compile.

-quickcheck-plutus-instances: a collection of instances for Plutus types to support general use of QuickCheck.

How does a Plutus helper library support Cardano developers during smart contract development?

In many programming languages helper libraries and utility functions serve as the tooling new developers need to efficiently build and test modular applications. Plutus smart contract development is no different; with an emphasis on property-based testing, performance modeling and script size/resources checks the plutus-extra helper lib becomes a critical piece of infrastructure for the Plutus developer experience.

Similar smart contract utility functions and testing tools on other blockchains have significantly boosted smart contract deployments and developer traction. Ethereum developers use inbuilt functions in Truffle Suite (https://trufflesuite.com/truffle/) to quickly build/test/deploy their contracts.

As early Plutus developers we understand the importance of simple to use tooling for new Cardano smart contract developers, and we are glad to see plutus-extra already in use in some of the ecosystems largest projects. Using this funding to include additional functions requested by Plutus devs interacting with the library, revamp documentation and scale up plutus-extra into an open source product maintained by Cardano ecosystem developers.

Adding the full-time engineering resources needed to develop plutus-extra into a more comprehensive helper library has been the largest challenge to date. Liqwid Labs and MLabs engineers built this library from the combined experience gained developing the Liqwid protocol.

[FEASIBILITY]

We aim to complete the development of additional helper sub-libraries, data structures and utility functions 3 months after receiving funding. This mostly involves building the high-priority feature requests from Plutus developers currently using the library (this library is already in use in several MLabs DeFi projects, Liqwid and LiqwidX).

Developers will be able to use our library to:

  • easy access to quickcheck automated property-based testing features
  • quickly build and test composable Plutus smart contracts
  • efficiently deploy and manage multi-phased contract deployment for more complex protocols (e.g. DeFi, NFT protocols)
  • simulate contract execution using mainnet conditions for cost and performance testing

Budget breakdown:

Engineering hours: 925

Total budget request: $75,000

Feature Total Time

Feature updates and developing enhanced Plutus testing tools …………………………………..200

Building out Plutarch helper functions …………………………………………………100

Added functions for property based testing………………………………..100

Integrate deployment tooling library………………….100

Added functionality to create/manage Stake Validators ……………………………………………175

Technical documentation and developer content………………………………………………………50

General Testing………………………………………………………………………………………..75

Security Audit………………………………………………………………………………………………..75

Technical Specification………………………………………………………………………………………………………..50

Total Time………………………………………………………………………………………………..925 engineering hours

Total Budget request $75,000

Haskell / Plutus engineers at Liqwid Labs and MLabs are committed to maintaining the plutus-extra library's current functionality and extending it with additional utility functions, property-based testing tools and helpful data structures.

Liqwid Labs CTO Emily Martins; Senior Haskell developer who built the Agora Plutus governance module (includes treasury, delegated voting, proposals, staking, rewards distribution), the liqwid-sdk and is an active contributor to Plutarch and plutus-extra repos, (5+ years building production Haskell applications).

MLabs Haskell engineers have worked closely with the IOG Plutus engineers to build extended on/off-chain functionality as Plutus Partners since March 2021. MLabs engineers have an advanced understanding of Plutus and Plutus related infrastructure; they are the only development shop operating at their scale and successfully shipping secure Plutus applications for multiple DeFi projects, working with IOG to build extensions to Plutus functionality and building open source Plutus infrastructure to lower the barrier to entry for new Plutus developers.

[AUDITABILITY]

The number of commits, contributions and forks/stars is the main KPI we are currently using internally to measure the utility of plutus-extra.

In addition to these metrics tracking new sub-libraries as an important metric to gauge the growth of overall utility the library covers.

What does success look like?

3 months: 1. additional tooling focused on helping developers manage the contract deployment process, 2. CDA members adopting plutus-extra (and contributing where resources allow) 3. 30-50% growth (increase in # of commits, contributors, forks/stars).

6 months: structured process to extend the libraries with requested features from the Plutus developer ecosystem.

This is an entirely new proposal.

Reseñas de CAs (1)

Comments

Monthly Reports

Plutus-extra has seen continued development for critical components, as many MLabs built projects have navigated to Plutarch development we have also built up open source testing tools/helpers and utility functions for Plutarch.

Plutus-extra is gaining support for square root and other numeric utility functions (normalized value types).

Plutarch-extra has several related open source libraries. Multiple Cardano DeFi Alliance are now using these.

Disbursed to Date
$75,000
Status
Launched
Completion Target
9/1/2022
Attachment(s)
Comments 0

Login or Register to leave a comment!

The team is maintaining Plutus-extra with relevant features as required (e.g. sqrt, Vasil functionality) and also building helper/utility functions for plutarch as part of plutarch-extra: https://github.com/Liqwid-Labs/liqwid-plutarch-extra

Plutus-extra: https://github.com/Liqwid-Labs/plutus-extra/issues?q=is%3Aopen+is%3Aissue

Disbursed to Date
$75,000
Status
Launched
Completion Target
9/1/2022
Attachment(s)
Comments 0

Login or Register to leave a comment!

Disbursed to Date
$75,000
Status
Launched
Completion Target
1. In the next month
Attachment(s)
Comments 0

Login or Register to leave a comment!

Liqwid plutarch extra has seen a lot of development activity with the shift of many Cardano smart contract protocols moving from PlutusTx to Plutarch (untyped plutus core) . We have no sunsetted plutus-extra library and will continue updating the plutarch extra lib.

Disbursed to Date
$75,000
Status
Complete
Completion Target
1. In the next month
Comments 0

Login or Register to leave a comment!

The plutus-extra devs continued to build out support for the plutarch version of the plutus-extra repo (liqwid-plutarch-extra). The optimizations completed allow devs to build with Plutarch more efficiently and provide stronger testing guarantees (plutarch-quickcheck)

Disbursed to Date
$75,000
Status
Complete
Completion Target
1. In the next month
Comments 0

Login or Register to leave a comment!

increased dev resources and external contributions for liqwid-plutarch-extra (LPE is the Plutarch equivalent to plutus-extra) has been a huge positive for us this week. In addition to LPE this month has also seen strong contributions to liqwid-script-export, plutarch-quickcheck, plutarch-units, and plutarch-context-builder (all Liqwid Labs maintained libs).

Disbursed to Date
$75,000
Status
Complete
Completion Target
1. In the next month
Comments 0

Login or Register to leave a comment!

This proposal has evolved as Plutarch has grown in developer popularity. We speak to multiple security auditors who say they now have increasingly more Plutarch codebases to audit (as opposed to PlutusTx). As a result of this we have supported a number of plutarch libraries, most notably: liqwid-plutarch-extra (https://github.com/Liqwid-Labs/liqwid-plutarch-extra)

In November we focused on completed all of the required updates to the portions of liqwid-plutarch-extra reviewed by security auditors as part of the Agora audit.

In addition to liqwid-plutarch-extra the following libraries are maintained thanks to this proposal's funding: plutarch-unit, plutarch-context-builder, plutarch-quickcheck, plutarch-numeric and liqwid-script-export.

Disbursed to Date
$75,000
Status
Complete
Completion Target
1. In the next month
Comments 0

Login or Register to leave a comment!

close

Playlist

  • EP2: epoch_length

    Authored by: Darlington Kofa

    3m 24s
    Darlington Kofa
  • EP1: 'd' parameter

    Authored by: Darlington Kofa

    4m 3s
    Darlington Kofa
  • EP3: key_deposit

    Authored by: Darlington Kofa

    3m 48s
    Darlington Kofa
  • EP4: epoch_no

    Authored by: Darlington Kofa

    2m 16s
    Darlington Kofa
  • EP5: max_block_size

    Authored by: Darlington Kofa

    3m 14s
    Darlington Kofa
  • EP6: pool_deposit

    Authored by: Darlington Kofa

    3m 19s
    Darlington Kofa
  • EP7: max_tx_size

    Authored by: Darlington Kofa

    4m 59s
    Darlington Kofa
0:00
/
~0:00