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: program constants defined as constant expressions are stored literally in IDL #1830

Closed
cavemanloverboy opened this issue Apr 24, 2022 · 1 comment
Labels
bug Something isn't working idl related to the IDL, either program or client side

Comments

@cavemanloverboy
Copy link
Contributor

if one defines some

#[constant]
/// This is a useful constant
pub const USEFUL_CONSTANT: usize = 2_usize.pow(8);

then the idl will store "2_usize.pow(8)" literally instead of "256".

If there is an easy way to evaluate const expressions before storing it in the IDL, I personally think that is a better outcome. This would allow for easy use of parseInt or similar fn's in typescript.

@acheroncrypto acheroncrypto mentioned this issue Feb 25, 2024
@acheroncrypto acheroncrypto added bug Something isn't working idl related to the IDL, either program or client side labels Mar 10, 2024
@acheroncrypto
Copy link
Collaborator

Fixed by #2824.

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
Projects
None yet
Development

No branches or pull requests

2 participants