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

Newlines in str array in configurable block crash compiler #6021

Closed
bitzoic opened this issue May 16, 2024 · 2 comments
Closed

Newlines in str array in configurable block crash compiler #6021

bitzoic opened this issue May 16, 2024 · 2 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

With the new configurable encoding, if including a new line in a str array the compiler will crash. This is used in the SRC-11; Security Information Standard example which hardcodes data into the configurable block. This resulting in the Entered unreachable code: non encoded configurable inside encoding v1 error.

Minimal Repo:

contract;

configurable {
    MY_CONFIG: str[3] = __to_str_array("a
    b"),
}

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

impl MyContract for Contract {
    fn test_function() -> bool {
        true
    }
}
Screenshot 2024-05-16 at 11 11 17 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
@bitzoic bitzoic changed the title Newlines in string array in configurable block crash compiler Newlines in str array in configurable block crash compiler May 16, 2024
@xunilrj xunilrj self-assigned this May 21, 2024
@xunilrj
Copy link
Contributor

xunilrj commented May 21, 2024

I will look into this.

@xunilrj
Copy link
Contributor

xunilrj commented May 21, 2024

I think this is a problem with the error message on your compiler version. master version correctly points out that the string slice actually has 7 chars (all the identation tabs). Removing them, it worked for me.

image

image

@IGI-111 IGI-111 closed this as not planned Won't fix, can't repro, duplicate, stale May 21, 2024
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

3 participants