2

Lecture 2 of plutus-pioneer-program, introduces unstableMakeIsData

In the lecture it is advised to use the Stable version in production.

Lars explains that the Unstable version does not make any guarantee that different constructor numbers will be preserved for future versions of Plutus. He further adds that:

A newer version of plutus does it in a different way it would be incompatible and you would have round trip problems (??)

I understand the incompatibility issue, sure, but what exactly is a round trip problem in this context?

1 Answer 1

3

The round trip problem in programming is when you have 2 conversions functions (for example toJSON and fromJSON) that should be each others inverse but aren't. So you start with a value, then convert it but when you convert it back you don't get the value again.

So in this case: say you have created this datatype:

data MyType = Yes | No

unstableMakeIsData ''MyType

Then you convert the value Yes to a value of type Data using toBuiltinData:

yesAsData :: Data
yesAsData = toBuiltinData Yes

Later with a future version of Plutus you convert yesAsData back to a value of type MyType with fromBuiltinData yesAsData and you might get back No instead!

1
  • Well explained, thank you very much!
    – LexTRX
    Jan 26, 2022 at 9:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.