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.