Last updated 4 months ago
Debugging a smart contract written in Helios currently requires adding print statements to the code. This is a slow process, especially in a production environment.
This is the total amount allocated to Helios debugger plugin for VSCode. 0 out of 3 milestones are completed.
1/3
Helios script runner for VSCode
Cost: ₳ 21,300
Delivery: Month 2 - May 2024
2/3
Stepping debugger
Cost: ₳ 21,300
Delivery: Month 4 - Jul 2024
3/3
Helios debugger service
Cost: ₳ 28,400
Delivery: Month 5 - Aug 2024
NB: Monthly reporting was deprecated from January 2024 and replaced fully by the Milestones Program framework. Learn more here
A conventional stepping debugger plugin for VSCode, that uses code-mapped UPLC scripts, along with knowledge of the input arguments, to step through Helios scripts (and set breakpoints etc.)
No dependencies
This plugin will be part of the existing Helios VSCode IDE plugin, which can be found here: https://github.com/Hyperion-BT/helios-ide-plugins
The license will be BSD-3-Clause
The solution will be adding features to the current Helios VSCode IDE plugin. VSCode plugins are automatically updated, and users will be able to use the debugger immediately upon publication.
This proposal isn't targeting other IDEs because VSCode is the dominant IDE for Javascript/Typescript tech stacks, which is what Helios targets.
Besides developing the plugin this proposal also includes creating a debugger cloud service, which, when hooked into a bundled smart contract generated by the Helios CLI, will display failed transactions in the IDE plugin, thus making it much easier to debug Cardano smart contracts in production.
Developers inevitably make mistakes that aren't caught by typecheckers. With this plugin developers using Helios will be able to iterate much faster: it will take minutes to track down bugs (even exotic ones), instead of currently tens of minutes to hours.
Ideally, developers will be able to quickly create dApps that aren't even upgradeable, because they will be so well inspected and tested before mainnet launch using tools such as this.
The IDE plugin already exists, the debugging functionality would be an addition to that plugin.
The Helios compiler already produces UPLC scripts with code mapping to the original Helios sources.
The UPLC CEK machine in the Helios library is fully asynchronous and already keeps track of the live stack. This can easily be extended to include scope information like current values of variables.
The cloud-based debugging service would be a minimal AWS Lambda+DynamoDB application, a technology I have plenty of experience with.
The challenge lies mostly in familiarizing myself with the VSCode debugger API.
First, familiarize myself with the VSCode debugger API. Investigate if VSCode supports backstepping.
Design and implement a VSCode widget that allows running any Helios entry point script in the current VSCode workspace. The user will be able to enter either JSON or CBOR-hex argument data into input fields.
The result of an evaluation will be printed in the debugger console.
The Helios scripts will be compiled JIT, and the resulting UPLC will be cached in a user-specific location.
Acceptance criteria:
A video showing the ability to launch any entry point script from within VSCode, and then display the UPLC result.
Import the UPLC CEK machine into VSCode dynamically and allow VSCode to hook into it using callbacks upon starting a UPLC evaluation. The plugin will be able to access the code-map sites through these callbacks.
These code-map sites will then be used to detect when breakpoints are hit and display progress when stepping through an evaluation.
Acceptance criteria:
A video showing the ability to launch an entry point script and stop at a breakpoint set in any of the Helios scripts that formed part of the compilation input for a given entry point. Subsequently, show the ability to step manually to the end.
Display live stack/scope info in the relevant VSCode widgets. Be able to interact with the variables in the debugger console.
Acceptance criteria:
Be able to do everything that is currently possible in the Helios playground. Then deprecate the Helios playground and replace it with a preconfigured version of VSCode-web.
Create a cloud service that stores the details of failed transactions in an AWS DynamoDB table. Implement an AWS Lambda function (behind AWS APIGateway) to allow polling the failed transactions table. Implement another AWS Lambda function that pushes failed transactions into the table.
Allow creating authentication tokens via the HyperionBT or Helios (WiP) website, using the wallet Cip-30 connector to authenticate the users initially. These authentication tokens will then be stored in another DynamoDB table.
Modify the Helios CLI to connect the JS contract bundle to this service. Modify the VSCode plugin to auto-detect Helios debugging service authentication tokens, and then poll frequently for failed transactions which are then used to auto-populate the debug launch widget.
Acceptance criteria:
A public video demo of the complete debugging process with a contract running in production.
Christian Schmitz: creator of Helios
https://www.linkedin.com/in/christian-schmitz-ba0a23b9/
I will try to dedicate 0.5 FTE to this, but if I can't find enough time I will reach out to other Cardano developers through the Helios discord.
Required skills for working on the plugin: proficient in Javascript/Typescript, able to use IDE debuggers effectively, familiar with the VSCode API (bonus).
Required skills for working on the debugging cloud service: proficient in using the JS/TS CDK for AWS Cloudformation.
Milestone 1: 10 FTE days
Milestone 2: 10 FTE days
Milestone 3: 10 FTE days
Final milestone: 15 FTE days (10 for cloud service, 5 for replacing Helios playground with VSCode web)
45 FTE days => 360 FTE hours @ 8 hours per day => 27000 USD @ 75 USD/hour => 71000 ADA @ 0.38USD/ADA
Timeline: all milestones run sequentially, I will make sure that 0.5 FTE is available to work on this (myself + hired engineer(s)) => 4.5 months => rounded up to 5 months
Whilst working on PBG token for the last 6 months I've spent about 1 FTE week in total debugging "exotic" transaction failures of the contract in preprod. Assuming that this plugin would've been able to reduce that to 1 FTE day, then the saving per major project using Helios is about 8 FTE days per year. At a rate of 75 USD/hour, we can estimate the productivity loss per team at 4800 USD per year.
If 5 or more teams are building on Cardano using Helios this proposal will pay itself back in a little over 1 year.
I think this is a conservative estimate.