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

client: Support non-8-byte discriminators #3125

Conversation

acheroncrypto
Copy link
Collaborator

Problem

anchor-client assumes discriminator length to always equal 8:

anchor/client/src/lib.rs

Lines 385 to 391 in 9fce3df

let mut slice: &[u8] = &borsh_bytes[..];
let disc: [u8; 8] = {
let mut disc = [0; 8];
disc.copy_from_slice(&borsh_bytes[..8]);
slice = &slice[8..];
disc
};

Summary of changes

Get the discriminator length dynamically rather than hardcoding as 8.


Note: This PR is part of a greater effort explained in #3097.

Copy link

vercel bot commented Jul 27, 2024

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

A member of the Team first needs to authorize it.

@acheroncrypto acheroncrypto merged commit c5337c5 into coral-xyz:master Jul 27, 2024
47 of 49 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant