Open dhruvja opened 1 month ago
I agree that space shouldn't be checked if the account exists, but it's also a bit ambigious to specify the space
constraint, and not check it. I think it's fine though, just noting a slight concern.
well i think u could make it something like init::space = <space>
like how we have for realloc but i guess that can be a breaking change.
When i use
init_if_needed
flag to initialize my account if not initialized, i have to pass the space flag indicating the amount of space i need to allocate. But if the account is already initialized and has data length more or less than the space specified which can be due to reallocation, the constraint fails and panics. Ideally we want the space constraint only when the account is not initialized. We wouldnt want to check if the data length matches the space specified since thats only for uninitialized accounts.