Skip to content

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

Closed
@nielstron

Description

@nielstron

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions