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

lang: Add space attribute to the InitSpace macro #2862

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Aursen
Copy link
Contributor

@Aursen Aursen commented Mar 21, 2024

Problem

#2765

Summary of changes

  • Add attribute space to InitSpace macro

Copy link

vercel bot commented Mar 21, 2024

@Aursen is attempting to deploy a commit to the coral-xyz Team on Vercel.

A member of the Team first needs to authorize it.

Copy link
Collaborator

@acheroncrypto acheroncrypto left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. What happens when the space is not enough?

#[space(2)]
pub data: Vec<u64>,

@Aursen
Copy link
Contributor Author

Aursen commented Mar 22, 2024

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

@acheroncrypto
Copy link
Collaborator

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?

@Aursen
Copy link
Contributor Author

Aursen commented Apr 2, 2024

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

@acheroncrypto
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants