sway icon indicating copy to clipboard operation
sway copied to clipboard

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

Open bitzoic opened this issue 1 year ago • 3 comments

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 avatar May 16 '24 10:05 bitzoic

I will look into this.

xunilrj avatar May 21 '24 06:05 xunilrj

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 avatar May 21 '24 07:05 bitzoic

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

bitzoic avatar May 21 '24 07:05 bitzoic