Skip to content
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

Pair missing from plutus.json definition #970

Closed
1 task done
SebastienGllmt opened this issue Jul 2, 2024 · 1 comment
Closed
1 task done

Pair missing from plutus.json definition #970

SebastienGllmt opened this issue Jul 2, 2024 · 1 comment
Labels
waiting on response Waiting on author to respond to comments

Comments

@SebastienGllmt
Copy link

What Git revision are you using?

aiken v1.0.29-alpha+16fb02e

What operating system are you using, and which version?

  • Linux / Ubuntu

Describe what the problem is?

Given the following Aiken code

pub type PairTest =
  Pair<Int, ByteArray>

pub type Action {
  PairTest { val: PairTest }
}

the following definition in plutus.json gets created

{
"my_project/validation/MintActions": {
  "title": "Action",
  "anyOf": [
    {
      "title": "PairTest",
      "dataType": "constructor",
      "index": 0,
      "fields": [
        {
          "title": "val",
          "$ref": "#/definitions/Pair$Int_ByteArray"
        }
      ]
    }
  ]
}

However, there is no definition entry for #/definitions/Pair$Int_ByteArray created

Note that this bug doesn't exist for List types or Tuple types. A proper List entry gets created. This issue seems to only affect Pair, and is probably because Pair is not mentioned in CIP57

What should be the expected behavior?

Either generate an entry for Pair, or change the schema to something else

@github-project-automation github-project-automation bot moved this to 🪣 Backlog in Project Tracking Jul 2, 2024
@KtorZ KtorZ moved this from 🪣 Backlog to 🔨 Todo in Project Tracking Jul 2, 2024
@KtorZ KtorZ added the bug label Jul 2, 2024
@KtorZ
Copy link
Member

KtorZ commented Jul 16, 2024

I am unable to reproduce this @SebastienGllmt?

With the following code:

pub type PairTest =
  Pair<Int, ByteArray>

pub type Action {
  PairTest { val: PairTest }
}

validator {
  fn foo(redeemer: Action, ctx: Data) {
    True
  }
}

I end up with the following blueprint, which does contain a definition for Pair$Int_ByteArray as expected:

{
  "preamble": {
    "title": "aiken-lang/scratchpad",
    "description": "Aiken contracts for project 'aiken-lang/scratchpad'",
    "version": "0.0.0",
    "plutusVersion": "v2",
    "compiler": {
      "name": "Aiken",
      "version": "v1.0.29-alpha+c52ba9c"
    },
    "license": "Apache-2.0"
  },
  "validators": [
    {
      "title": "scratchpad.foo",
      "redeemer": {
        "title": "redeemer",
        "schema": {
          "$ref": "#/definitions/scratchpad~1Action"
        }
      },
      "compiledCode": "<redacted>",
      "hash": "57689de1175e1f5de429ef7075211b7002a08c66034de7db5500ffb7"
    }
  ],
  "definitions": {
    "ByteArray": {
      "dataType": "bytes"
    },
    "Int": {
      "dataType": "integer"
    },
    "Pair$Int_ByteArray": {
      "title": "Pair",
      "dataType": "#pair",
      "left": {
        "$ref": "#/definitions/Int"
      },
      "right": {
        "$ref": "#/definitions/ByteArray"
      }
    },
    "scratchpad/Action": {
      "title": "Action",
      "anyOf": [
        {
          "title": "PairTest",
          "dataType": "constructor",
          "index": 0,
          "fields": [
            {
              "title": "val",
              "$ref": "#/definitions/Pair$Int_ByteArray"
            }
          ]
        }
      ]
    }
  }
}

@KtorZ KtorZ added waiting on response Waiting on author to respond to comments and removed bug labels Jul 16, 2024
@KtorZ KtorZ moved this from 🔨 Todo to 🫡 In Progress in Project Tracking Jul 16, 2024
@KtorZ KtorZ closed this as completed Oct 1, 2024
@github-project-automation github-project-automation bot moved this from 🫡 In Progress to ✅ In Next Release in Project Tracking Oct 1, 2024
@rvcas rvcas moved this from ✅ In Next Release to 🚀 Released in Project Tracking Feb 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting on response Waiting on author to respond to comments
Projects
Status: 🚀 Released
Development

No branches or pull requests

2 participants