5

How can I have a fixed size array in my ink smart contract storage?

E.g.


    // Contract storage
    #[ink(storage)]
    pub struct MyContract {
        myArray: [u8; 64]
    }

I get "the trait StorageLayout is not implemented for [u8; 64]" as the error during compilation.

I don't want to use a Vec<u8> as I would have to do size checks all over the place to ensure it's consistently 64 elements long.

1 Answer 1

0

Resolved via an issue raised on the (ink github)[https://github.com/paritytech/ink/pull/1787]. This will be available in releases post ink v4.2.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.