tact-lang / tact

Tact compiler main repository
https://tact-lang.org
MIT License
394 stars 110 forks source link

Getters return a single tuple which does not work properly with standard smart contracts #671

Closed Gusarich closed 3 months ago

Gusarich commented 3 months ago

Internal structs implementation was reworked in #590 to allow structs with more than 15 fields, but it also made getters return struct in a form of one tuple instead of multiple values, which broke standard smart contracts. For example, get_jetton_data now returns a single tuple with all the values which is against the standard and such contracts won't be displayed correctly by explorers and won't work as intended with wallets.

We need getters to work as before.

While trying to fix this I also found out that in case of nested structs, these are returned from getters in a "flatten" format, e.g. (int, int, int) for a struct {int, {int, int}} instead of (int, [int, int]). I think that we should also rework this to return nested structs in form of tuples because it makes more sense and is more predictable & consistent.

anton-trunov commented 3 months ago

While trying to fix this I also found out that in case of nested structs, these are returned from getters in a "flatten" format, e.g. (int, int, int) for a struct {int, {int, int}} instead of (int, [int, int]). I think that we should also rework this to return nested structs in form of tuples because it makes more sense and more predictable & consistent.

Hmmm, If nested structs are not flattened then the top-most (enclosing) struct also should not be, for consistency reasons.

anton-trunov commented 3 months ago

It's either all structs are flattened or there is no flattening at all

Gusarich commented 3 months ago

Hmmm, If nested structs are not flattened then the top-most (enclosing) struct also should not be, for consistency reasons.

Sounds reasonable