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

More than 64 characters in str array in configurable block crashes the compiler #6022

Open
bitzoic opened this issue May 16, 2024 · 3 comments
Assignees
Labels
bug Something isn't working compiler General compiler. Should eventually become more specific as the issue is triaged

Comments

@bitzoic
Copy link
Member

bitzoic commented May 16, 2024

If you have a str array in a configurable block with more than 64 characters, the compiler will crash with internal error: entered unreachable code: non encoded configurable inside encoding v1. This is used in the SRC-11 Information Security Standard

Minimal Repo:

contract;

configurable {
    MY_CONFIG: str[65] = __to_str_array("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF"),
}

abi MyContract {
    fn test_function() -> bool;
}

impl MyContract for Contract {
    fn test_function() -> bool {
        true
    }
}
Screenshot 2024-05-16 at 11 22 41 AM
@bitzoic bitzoic added bug Something isn't working compiler General compiler. Should eventually become more specific as the issue is triaged labels May 16, 2024
@xunilrj
Copy link
Contributor

xunilrj commented May 21, 2024

I will look into this.

@xunilrj xunilrj self-assigned this May 21, 2024
@bitzoic
Copy link
Member Author

bitzoic commented May 21, 2024

I will look into this.

It looks like it's hardcoded to 64 here. This will be a problem as the SRC-11 example uses 741 characters.

@bitzoic
Copy link
Member Author

bitzoic commented May 21, 2024

Using forc v0.59.0 the compiler no longer crashes but outputs these errors instead
Screenshot 2024-05-21 at 3 12 19 PM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working compiler General compiler. Should eventually become more specific as the issue is triaged
Projects
None yet
Development

No branches or pull requests

2 participants