Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hey,
we were not able to provide the emulator test suite in time. Therefore we only provide the WIP branch - you may find it of use, but be noted that it is in quite WIP and uncommented state of things.
So maybe of bigger value would be if I describe what needs to be done to test in the emulator.
But first, why that'd be great to do is that it improves the developer experience a lot. The tests run quicker and TxOutRef needs to be set in code and no scripts need to be regenerated with every additional test run. All test runs can mint their own NFT thread token so tests become reproducible. Also you could run these tests in CI. I recommend it a lot to put a bit of time into this improvement, it'll pay of.
To test in lucid emulator:
NftParams
,TokenName
etc.) dynamically, that is from the lucid offchain testing code, not in the haskell onchain.The pr here did 1. but then 2. needs some debuggin work to be done. The script paramaters are not properly serialized to be provided to the scripts for application.
The step 2. is the harder one. Great care needs to be taken to properly serialize the data to be passed to the scripts. Also the scripts are changed in how they parse the parameters. In other words - this is a big change that needs to be properly tested and influences the scripts. After the change all scripts should be applied in the same way from lucid offchain, to avoid errors when haskell onchain produces different scripts than lucid offchain. Consider the choice here as: significant amount of work could bring significant improvement.
As a added benefit, you already define the offchain infrastructure that would be needed either way - if you are to use multiple instances of the protocol, spawned automatically from offchain code.
(*): Comment needs to be made here, because there is a simpler, though a bit hacky way to define emulator tests. Namely: because the UTXOs defined in the emulator have predictable TxoutRef's - this means that the step 2. is not needed if the tests are run with scripts using such TxoutRef that will be present in the lucid emulator. In this way the scripts can be defined in the same as now, from haskell code by hardcoding the TxOutRef - one TxOutRef for real use, another for emulator tests.
This would be the much simpler and safer aproach - and would still bring most of the testing benefits!