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

vue + vite = broken sha256 for anchor discriminator ? #2619

Closed
effeaucarre opened this issue Aug 30, 2023 · 3 comments
Closed

vue + vite = broken sha256 for anchor discriminator ? #2619

effeaucarre opened this issue Aug 30, 2023 · 3 comments
Labels
bug Something isn't working ts

Comments

@effeaucarre
Copy link

I have a weird use case :
when i call my program instruction in a vue + vite app, i get the error 101, wrong discriminator (fallback function error).

So i tried a very simple code :

console.log(sha256.digest('global:bid'));

And this does not give me the same result in my app and in a node app (the one in the node app seems to be the right one because transaction are OK with this one).

So it seems something is breaking sha256 (so, anchor too).

i have a
var global = global || window;
might be linked ?

@acheroncrypto
Copy link
Collaborator

Yes, there is an issue with newer versions of Chrome and js-sha256 package(emn178/js-sha256#40) which cause Error: Invalid account discriminator. We've updated to a new package in #2580 which shouldn't have this problem.

Upgrade to latest version https://www.npmjs.com/package/@coral-xyz/anchor/v/0.28.1-beta.2 to fix this problem. I'm closing this but feel free to reopen if the issue persists after upgrading.

@acheroncrypto acheroncrypto added bug Something isn't working ts labels Aug 30, 2023
@effeaucarre
Copy link
Author

it seems to work, thanks

btw, what is the difference between coral-xyz/anchor and project-serum/anchor ?

@acheroncrypto
Copy link
Collaborator

btw, what is the difference between coral-xyz/anchor and project-serum/anchor ?

Latter is deprecated, @coral-xyz/anchor is the package that is up to date.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ts
Projects
None yet
Development

No branches or pull requests

2 participants