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

StateInit struct has incorrect fields types #1824

Open
Shvandre opened this issue Feb 13, 2025 · 1 comment
Open

StateInit struct has incorrect fields types #1824

Shvandre opened this issue Feb 13, 2025 · 1 comment
Labels
kind: bug Something isn't working or isn't right scope: stdlib The Tact standard library (src/stdlib)

Comments

@Shvandre
Copy link
Contributor

Shvandre commented Feb 13, 2025

What we currently have is

struct StateInit {
    code: Cell;
    data: Cell;
}

Which is incorrect, as it should be

struct StateInit {
    code: Cell?;
    data: Cell?;
}

as code and data may be null.

(doing the code null do not have any sense in my mind, but having a null data is quite usual thing)

@novusnota
Copy link
Member

novusnota commented Feb 13, 2025

(doing the code null do not have any sense in my mind, but having a null data is quite usual thing)

Agreed, so the resulting signature will probably be:

struct StateInit {
    code: Cell; // making this an optional is actually harmful
    data: Cell?;
}

Alternatively, to preserve backwards-compatibility, we might just introduce a StateInitOpt:

struct StateInitOpt {
    code: Cell;
    data: Cell?;
}

@novusnota novusnota added kind: bug Something isn't working or isn't right scope: stdlib The Tact standard library (src/stdlib) labels Feb 13, 2025
@anton-trunov anton-trunov changed the title StateInit struct have incorrect fields type StateInit struct has incorrect fields types Feb 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind: bug Something isn't working or isn't right scope: stdlib The Tact standard library (src/stdlib)
Projects
None yet
Development

No branches or pull requests

2 participants