anchor
anchor copied to clipboard
lang: Add `space` attribute to the InitSpace macro
Problem
#2765
Summary of changes
- Add attribute
space
to InitSpace macro
@Aursen is attempting to deploy a commit to the coral-xyz Team on Vercel.
A member of the Team first needs to authorize it.
Thanks. What happens when the space is not enough?
#[space(2)] pub data: Vec<u64>,
It will not check if the length is valid. This attribute is designed to give the user freedom
Freedom to run into a guaranteed error in runtime? It feels like we have enough information to make this a compile error — what do you think?
Freedom to run into a guaranteed error in runtime? It feels like we have enough information to make this a compile error — what do you think?
The only issue with this, when a user uses const or other thing like this for the value of space we can't verify the space
Yeah, I don't think it needs to be perfect, just the easy parts we can easily handle. It's also not required to merge this, but it would be an improvement over the current impl.