funded
MLabs – Enhancing and Evolving the Plutus Simple Model (PSM) Test Library
Current Project Status
In Progress
Amount
Received
₳292,874
Amount
Requested
₳352,860
Percentage
Received
83.00%
Solution

We propose enhancing Plutus testing by advancing PSM’s features and refactoring its codebase. This will result in a more effective simulation of the Cardano ledger and its most advanced capabilities.

Problem

PSM provides a mock model blockchain for straightforward unit testing. However, it could more closely track the state of the main chain. Refactoring and an extended feature set will accomplish this.

Feasibility
Value for money
Impact / Alignment

MLabs

1 member

MLabs – Enhancing and Evolving the Plutus Simple Model (PSM) Test Library

Please describe your proposed solution.

Overview

The plutus-simple-model (PSM) is a unit test library for Plutus with an estimation of resource usage. The library defines a simple mock model of the Cardano blockchain to unit test Plutus contracts and estimates the usage of resources. PSM has several strengths:

  • Easy to use and easy to reason about
  • Minimal dependency set depending only on plutus and cardano-ledger (e.g., no plutus-apps, cardano-node, or ouroboros)
  • Works for both Plutus V1 and Plutus V2
  • Blazing fast, pure
  • Estimates the usage of resources with real functions used by the Cardano node.
  • It's suitable for both unit testing on-chain code and property-based testing.

Problem

The Plutus Simple Model (PSM) test library is already a highly regarded tool in the Cardano ecosystem due to its robust capabilities in simulating the execution of smart contracts. Its strengths lie in its accurate representation of the UTXO model, its emulation of time and slot numbers, and the possibility of creating various transaction scenarios.

PSM came to life early in the Alonzo era, yet Cardano – and the related developer experience – has evolved drastically since. For instance, PSM often leverages PlutusTx for on-chain interactions, while developers have largely turned to libraries such as Plutarch, Aiken, etc in its place. PSM already supports external libraries such as Plutarch, but this integration could be enhanced and interoperability with other tools generally improved.

And this speaks little to other possible features that would benefit from the ease of use testing offered by PSM. Currently, PSM supports Plutus V1 as well as V2 features – inline datums, reference scripts, etc. However, the library has yet to have been updated to fully reflect the developments surrounding the Conway era and CIP-1694. Other cutting-edge features like transaction chaining could also be added.

Solution

PSM has been in maintenance mode throughout 2023. Yet, MLabs and other teams building in the space still use the library heavily owing to its ease of use and reliability. We propose updating PSM to reflect the current state of the Cardano ledger while also adding better support for external platforms and languages. Finally, basic quality-of-life improvements and some refactoring will ensure PSM remains ergonomic and popular among builders.

More specifically, intended improvements include:

  • Enhanced UTXO TX support – Ensuring more accurate transaction fees and resource estimations, and enforcing minimum ADA requirements.
  • Improved Plutarch support.
  • Addressing CBOR and script bloating issues.
  • Beginning to integrate Conway era/CIP1694 features and other modern functionalities.
  • Developing stronger validator abstraction.
  • Implementing quality-of-life improvements – enhancing type clarity, squashing minor bugs, refactoring, and removing technical debt, among other improvements.
  • Updated and improved documentation.

Market

Smart contract auditors, developers and teams building Cardano DApps and tooling.

How does your proposed solution address the challenge and what benefits will this bring to the Cardano ecosystem?

Intended Challenge – OSDE: Open Source Dev Ecosystem

Challenge Question – "Can we build a community-owned Open-Source Ecosystem that’s commercially viable to drive growth, increase opportunities, and increase project visibility for the whole Cardano Community?"

How does updating PSM help developers?

Updating PSM will lead to a more streamlined and efficient development process, which is essential as Cardano's ledger and its interaction continue to evolve. This update not only augments PSM's compatibility with emerging external platforms and languages but also addresses discrepancies between our mock model and the main chain's behaviour. By enhancing PSM, we further enable developers to leverage its simple yet robust unit testing, facilitating confident and efficient smart contract deployment on Cardano.

How do you intend to measure the success of your project?

We will consider the following as we measure our proposal’s success:

  • Effective implementation of the proposed enhancements and features.
  • Increased usage of PSM by developers.
  • Improvement in the efficiency and reliability of unit testing.
  • Positive feedback from the developer community on the upgrade
  • Meaningful deployment and integration of PSM with other ecosystem tools.

Please describe your plans to share the outputs and results of your project?

In the spirit of complete transparency with the Cardano community, the outputs of our proposal will be widely available. Foremost, as an open-source project, the GitHub repo will be the obvious resource for updates, documentation, and educational resources. This repo will be updated as the project progresses - a primary deliverable of this proposal.

MLabs has a noteworthy social media presence. We'll make active use of these channels to share regular updates with less technical community members. Finally, we'll actively share progress reports through the typical, publicly-available Catalyst channels. MLabs has a strong compliance record, and this will not change throughout the progress of this proposal.

What is your capability to deliver your project with high levels of trust and accountability?

MLabs, a leading consultancy in the Cardano ecosystem, has a proven track record and significant experience. Our team consists of seasoned engineers, each holding expertise in their respective fields. Moreover, we have consistently demonstrated our ability to deliver complicated projects with a high degree of trust and accountability. We have an extensive portfolio of satisfied client projects as well as several popular Catalyst projects. We're committed to upholding these standards for our PSM enhancement proposal. Moreover, we are committed to working in an open-source and transparent manner.

What are the main goals for the project and how will you validate if your approach is feasible?

The main goals of our project are:

  • Enhance the functionality of PSM to reflect the current state of the Cardano blockchain.
  • Expand compatibility with external platforms and languages, primarily Plutarch.
  • Quality-of-life improvements enhancing the user experience.
  • Updated documentation for improved accessibility.

To validate our approach, we will:

  • Utilize our expertise in Plutus and our experience building PSM to guide development.
  • Build and assess prototypes of planned features.
  • Regularly test upgraded PSM against diverse use cases.
  • Actively seek developer feedback, internal and external.
  • Backtest updated PSM outputs with prior outputs.

Please provide a detailed breakdown of your project’s milestones and each of the main tasks or activities to reach the milestone plus the expected timeline for the delivery.

Milestone 1: Project Planning and Expanded Interoperability (Months 1-3)

  • Designing project roadmap and resource planning
  • Continue and finalize Plutarch integration
  • Support of validators produced by Aiken
  • Regular testing and feedback collection

Milestone 2: Implement quality-of-life improvements (Months 4-5)

  • Streamlining user experience with clearer types, bug squashing, refactors
  • Adding support for stronger validator abstractions
  • Implementing features like better UTXO TX support, addressing CBOR and script bloating issues

Milestone 3: Extended functionality to reflect the current ledger and modern features (Months 6-7)

  • Updating the PSM to reflect the current ledger
  • Conway-era feature support and initial integration of governance features
  • Regular testing and validation

Milestone 4: Documentation and Wrap-up (Month 8)

  • Updating documentation
  • Comprehensive review and testing
  • Marketing and promotion, proposal closeout

Please describe the deliverables, outputs and intended outcomes of each milestone.

Milestone 1: Project Planning and Expanded Interoperability

  • Outputs: Detailed project roadmap and resource allocation plan, expanded support for Plutarch and Aiken-produced validators.
  • Outcomes: Published roadmap and enhanced compatibility with external platforms and languages.

Milestone 2: Implement Quality-of-Life Improvements

  • Outputs: Streamlined user experience, strengthened validator abstractions, enhanced UTXO TX support and resolution of several minor bugs and under-performing features.
  • Outcomes: Increased usability and reliability of PSM.

Milestone 3: Extended Functionality to Reflect Current Ledger

  • Outputs: Reflecting the current ledger functionality, initial integration of some Conway era and CIP1694 governance features.
  • Outcomes: Improved testing of Voltaire features.

Milestone 4: Documentation and Wrap-up

  • Outputs: Up-to-date documentation, closeout documentation and project promotion.
  • Outcomes: PSM is accessible to developers of varying abilities and improved adoption of PSM.

Please provide a detailed budget breakdown of the proposed work and resources.

Milestone 1 – 140 hours

  • Project roadmap and resource planning: 15
  • Finalizing Plutarch integration: 75
  • Support for Aiken-produced validators: 50

Milestone 2 – 175 hours

  • User experience streamlining and bug squashing: 60
  • Stronger validator abstractions: 40
  • Implementing better UTXO TX support, addressing minor bugs and issues: 75

Milestone 3 – 250 hours

  • Updating PSM to reflect current state of ledger: 90
  • Basic Conway-era feature support and initial CIP1694 integration: 100
  • Refactoring, regular testing and validation: 60

Milestone 4 – 85 hours

  • Documentation updates, promotion and closeout: 50
  • Comprehensive review and testing: 35

Total: 650 hours

Plus 20% change budget: 780 hours

Subtotal: 780 hours @$95/hour = $74,100 USD

Total (@ rate $0.21 USD / ADA): 352860 ADA

**In the interest of full transparency, please note we have applied a conservative USD/ADA exchange rate in pricing this proposal. This is to ensure our operations remain stable regardless of market conditions. Although we firmly believe the future of Cardano is bright, we recognize the price of ADA and all cryptocurrencies is inherently volatile. Our financial obligations are denominated in fiat. Most importantly, this includes the salary of our engineers whose hard work makes projects like this possible.

In the unlikely scenario of severe negative price movement beyond our forecasted rate, it is possible that MLabs may need to temporarily suspend work on this proposal until the market recovers. Rest assured, this decision would be made solely to protect our business's long-term viability and never taken lightly.

We appreciate your understanding and support, and we are excited to see what we can achieve together.

Who is in the project team and what are their roles?

MLabs

MLabs is a premier development firm in the Cardano Ecosystem. We are an IOG Plutus Partner and work regularly to develop the Cardano blockchain and ecosystem. Our team is composed of talented developers who have helped build community projects such as:

  • Liqwid
  • SundaeSwap
  • Minswap
  • Optim

And several others. Through our work with early-stage projects, we have one of the largest groups of Haskell/Plutus developers in the Cardano community.

Website: <u>https://mlabs.city/</u>

Core Team

Vladimir Kalnitsky

Vladimir is a key maintainer for MLabs open source projects including CTL and Plutip. His involvement will include guiding high-level implementation details, dependency monitoring (especially for Chang hardfork-related upgrades), and ensuring the project meets our high standards for quality.

Borja Bonet Seguí

Borja is a key Delivery Manager at MLabs, in addition to being on our Auditing team lead. As PSM and related tools help us lower the cost of the audits we provide, and since our auditing team is often the first consumers for open source testing projects at MLabs, Borja will be involved at both the user testing and delivery assurance level.

How does the cost of the project represent value for money for the Cardano ecosystem?

The budget for this project is a cost-effective investment for the Catalyst community. Enhancing the Plutus Simple Model (PSM) will greatly benefit developers by making unit testing more efficient, simple to perform, and reliable. The quality-of-life improvements, better support for other platforms, and expanded functionalities are all aimed to ease the developers' work and improve the output of their efforts. As PSM is open source, it can be used, forked, and further improved by others in the future.

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