Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

add plu-ts #57

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Conversation

michele-nuzzi
Copy link

@michele-nuzzi michele-nuzzi commented Feb 28, 2025

to build yourself just go in the implementations/plu-ts directory and run

npm install
npm run start

this will generate the implementations/plu-ts/out directory with the compiled scripts in binary form.

scripts are plutus v3

@michele-nuzzi
Copy link
Author

btw the out directory is already generated if you don't want to bother

@SeungheonOh
Copy link

Can you deal with nix as well...? maybe?

@michele-nuzzi
Copy link
Author

every time I tried nix I ended up crying in a corner

sorry not used to it

@SeungheonOh
Copy link

SeungheonOh commented Feb 28, 2025

lol fair enough. @t4ccer do we have enough budget left here do deal with nix?

@t4ccer
Copy link
Member

t4ccer commented Feb 28, 2025

Thank you for contributing, a couple of initial comments:

  • Scripts do not deserialize, all complain with Codec.CBOR: deserialising failed at offset 0 : expected bytes. Make sure to serialize them the same way other implementations are doing that (Haskell function is serialiseCompiledCode from PlutusLedgerApi.V2)
  • Scripts should be using V2 versions of ScriptContext, this is important cause all implementations are passed through the same test suite. I recon this may be difficult though if you do not have V1 and V2 types in plu-ts but we're too low on budget to upgrade all existing implementations to V3. Core issue is not the implementations but our testing framework https://github.com/mlabs-haskell/plutus-test that is a set of testing utils destilled from https://github.com/Liqwid-Labs/liqwid-libs and decoupled from plutarch)
  • Once Nix work is set up we should not store compilation artifacts in ./out in the repo (I can handle that)
  • I'm not sure how implicit data decoding/encoding works in plu-ts but make sure that enums are encoded as integers and structs with only one constructor like a list of fields (no Constr 0), but once you get script serialization fixed the test suite will yell at you
  • At the end decide on TS formatter, but later to not cause merge conflicts now
  • Announce it in readme section

@t4ccer
Copy link
Member

t4ccer commented Feb 28, 2025

OK, I've fixed the serialization and nixified the whole build. Now you can see that tests are failing due to data decoding, once that is fixed and V2 script context is figured out we should be good to merge. You can run tests locally either with cabal test inside ./tests directory, there you can override UPLC_BENCHMARK_BIN_PLU_TS env var to point it somewhere outside nix sandbox or with just nix build .#checks.x86_64-linux.uplc-benchmark to run it like it'll be ran on CI

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants