TezosTaqueria / taqueria

*BETA* Taqueria provides a seamless development workflow to easily build, test and deploy your Tezos applications.
https://taqueria.io
Apache License 2.0
64 stars 20 forks source link

๐Ÿ› Bug โžพ taqueria does not support LIGO Option.value, Option.is_none and maybe other functions #1868

Closed ztepler closed 1 year ago

ztepler commented 1 year ago

๐Ÿšฅ Status (Internal Taqueria Team Use Only)

๐Ÿ†˜ What happened?

Assuming that I have the following contract written in JsLIGO, named setter.jsligo in the contracts directory:

type parameter =
    | ["Set", option<nat>]
    | ["Reset", unit];

const main = (action: parameter, _s: nat) : [list<operation>, nat] => [
    list([]),
    match(action, {
        Set: (amount: nat) => Option.value((42 as nat), amount),
        Reset: () => (0 as nat)
    })
];

When I try to compile contract by running command

taq compile setter.jsligo

I am getting the following error:

=== Error messages for setter.jsligo ===
File "contracts/setter.jsligo", line 8, characters 30-42:
  7 |     match(action, {
  8 |         Set: (amount: nat) => Option.value((42 as nat), amount),
  9 |         Reset: () => (0 as nat)

Variable "value" not found. 

===
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Contract      โ”‚ Artifact     โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ setter.jsligo โ”‚ Not compiled โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ†˜ Steps to Reproduce?

1)

taq init taq-option-bug-reproduce --workflow ligo
cd taq-option-bug-reproduce

2) create file contracts/setter.jsligo with following content:

type parameter =
    | ["Set", option<nat>]
    | ["Reset", unit];

const main = (action: parameter, _s: nat) : [list<operation>, nat] => [
    list([]),
    match(action, {
        Set: (amount: nat) => Option.value((42 as nat), amount),
        Reset: () => (0 as nat)
    })
];

3)

taq compile setter.jsligo

๐Ÿชต Relevant log output

No response

๐Ÿ˜ How impactful is this bug?

๐Ÿค” Notable but managable

โฑ๏ธ Prevalance

reproduces every time I run compile

๐Ÿ’ป Operating System

Linux

๐Ÿ•ธ๏ธ System Architecture

x64

๐ŸŒฎ Taqueria Version

v0.28.5-rc

๐ŸŒฟ Node.js Version

v16.20.0

โ˜Ž๏ธ Contact Details

No response

Code of Conduct

ztepler commented 1 year ago

Additional info: I am able to compile contract manually using ligo 0.63.2 with following command:

ligo compile contract contracts/setter.jsligo

To get the following Michelson code:

{ parameter (or (unit %reset) (option %set nat)) ;
  storage nat ;
  code { CAR ;
         IF_LEFT { DROP ; PUSH nat 0 } { IF_NONE { PUSH nat 42 } {} } ;
         NIL operation ;
         PAIR } }
ztepler commented 1 year ago

I was able to compile the contract by setting TAQ_LIGO_IMAGE environment variable to the ligolang/ligo:0.63.2:

export TAQ_LIGO_IMAGE="ligolang/ligo:0.63.2"

It works fine and compiles both Option.value and Option.is_none. The problem appears to be related with the LIGO image used in Taqueria v0.28.5-rc by default. I am not sure, should I close this issue then?

mweichert commented 1 year ago

Thanks for the additional information. Please leave this open for now and we will close it when we update the image. Thanks!

On Fri, Apr 21, 2023, 7:15 a.m. ztepler @.***> wrote:

I was able to compile the contract by setting TAQ_LIGO_IMAGE environment variable to the ligolang/ligo:0.63.2:

export TAQ_LIGO_IMAGE="ligolang/ligo:0.63.2"

It works fine and compiles both Option.value and Option.is_none. The problem appears to be related with the LIGO image used in Taqueria v0.28.5-rc. I am not sure, should I close this issue then?

โ€” Reply to this email directly, view it on GitHub https://github.com/ecadlabs/taqueria/issues/1868#issuecomment-1517671022, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAC3LC7RFEYXTJEDKIFDFN3XCJT4NANCNFSM6AAAAAAXC4X5SA . You are receiving this because you are subscribed to this thread.Message ID: @.***>

mweichert commented 1 year ago

Taqueria 0.28.6 now uses ligolang/ligo:0.63.2 will we can close this issue.