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

InitSpace panic with const array size Option #2556

Closed
donkeizluv opened this issue Jul 4, 2023 · 2 comments
Closed

InitSpace panic with const array size Option #2556

donkeizluv opened this issue Jul 4, 2023 · 2 comments
Labels
bug Something isn't working idl related to the IDL, either program or client side lang

Comments

@donkeizluv
Copy link

donkeizluv commented Jul 4, 2023

InitSpace account panics if there is an Option array field with const size

following snippet will panic on build:

const META_HASH_LEN: usize = 32;

#[account]
#[derive(InitSpace)]
pub struct Config {
    pub bump: u8,
    pub meta_hash: Option<[u8; META_HASH_LEN]>,
}
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: ParseIntError { kind: InvalidDigit }', lang/syn/src/idl/mod.rs:219:76
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
@Aursen
Copy link
Contributor

Aursen commented Jul 4, 2023

Thanks for the issue, I will fix it. I'm waiting this merge: #2555

Edit: It is not an issue of the InitSpace macro but it is from the idl parsing

@acheroncrypto acheroncrypto added bug Something isn't working lang idl related to the IDL, either program or client side labels Jul 5, 2023
@acheroncrypto
Copy link
Collaborator

Fixed in #2555.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working idl related to the IDL, either program or client side lang
Projects
None yet
Development

No branches or pull requests

3 participants