Skip to content

Unique constructor id can not be independently implemented in foreign languages #271

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

Closed
nielstron opened this issue Oct 3, 2023 · 1 comment · Fixed by #272
Closed

Comments

@nielstron
Copy link
Contributor

The computation of the unique constructor id is currently dependent on the stringified representation of the type of PlutusData attributes. This makes much sense for primitives and container types. However, the type may also be another Plutus Data class - this may lead to the problem that the stringified representation of such a class is very difficult to predict from the perspective of another language. The implementation should stay agnostic to the actual Python implementation though.

There are two ways to mitigate this: instead of the stringification of the type, we use

  • the stringification of the type structure (recursively resolved to primitive types)
  • the constructor id of the type

The constructor id however may not be unique in all cases so I would vouch for the first approach.

References:
https://github.com/Python-Cardano/pycardano/blob/0a95536e9e3779dcfc90eda7fcfa23e389a79c3f/pycardano/plutus.py#L484C43-L484C47

I am willing to work on a reference solution to fix this

@nielstron
Copy link
Contributor Author

Note: this issue already inhibits the implementation of OpShin/opshin#269

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

Successfully merging a pull request may close this issue.

1 participant