-
-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix plutus script deserialization #293
Fix plutus script deserialization #293
Conversation
…to bugfix/extended-cip8
Bugfix/bytestring
Codecov ReportAttention:
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #293 +/- ##
==========================================
- Coverage 84.63% 84.61% -0.02%
==========================================
Files 26 26
Lines 3071 3075 +4
Branches 752 754 +2
==========================================
+ Hits 2599 2602 +3
- Misses 353 354 +1
Partials 119 119 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me! Thank you for this fix!
When either a
PlutusV1Script
or aPlutusV2Script
is added as a script input and serialized to cbor, any attempt to deserialize throws a deserialization error. This is because there is no explicit catch in_restore_typed_primitive
forbytes
data to parse into the appropriate data type except forByteString
.This PR takes a conservative approach to resolving this issue, by only looking for classes named
PlutusVxScript
with a bytes values and casts them to the appropriate script type.A more general approach would be to detect if the parsing object is a class and the value is
bytes
and using the abstracted parsing object to wrap the bytes object, and do this for allbytes
values. However, that was not implemented here because it wasn't clear if this could have bad side effects.I was able to develop a minimal test example that failed before the fix and passed after the fix was implemented.
fixes #251