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

Naming an account struct RNGEvent causes an invalid account discriminator #1859

Closed
asktree opened this issue May 2, 2022 · 4 comments
Closed
Labels
bug Something isn't working idl related to the IDL, either program or client side ts

Comments

@asktree
Copy link

asktree commented May 2, 2022

If I make an #[account] struct called RNGEvent, and then use program.account to fetch it, I get an invalid account discriminator error. If I rename the struct to Cum or RngEvent it works fine.

I am guessing this is to do with the consecutive capital letters in "RNGEvent" though I have not tested this.

This issue appears both in anchor-ts and anchor-client-gen.

@0xdeepmehta
Copy link
Contributor

0xdeepmehta commented May 2, 2022

I think this explains it pretty much, unless & Until I'm missing something.

Screenshot 2022-05-02 at 11 54 34 AM

@asktree
Copy link
Author

asktree commented May 3, 2022

@0xdeepmehta
Maybe the discriminator should just ignore casing entirely?

@fekow
Copy link

fekow commented May 6, 2022

Just dealt with this issue, it was a pain to debug, from my experimenting, any struct you name with more than 2 uppercase letters will not work and will give you the error invalid account discriminator. This seems to be new, because the candy machine program itself uses an CollectionPDA struct, and it works fine (was compiled with older version of anchor, 0.21.0 i think).

@acheroncrypto acheroncrypto mentioned this issue Feb 25, 2024
@acheroncrypto acheroncrypto added bug Something isn't working ts 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 ts
Projects
None yet
Development

No branches or pull requests

4 participants