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: Remove discriminator method from Discriminator trait #3163

Conversation

acheroncrypto
Copy link
Collaborator

Problem

There is no reason to have both an associated constant and a method that returns the exact same thing, as in the case with the Discriminator trait:

anchor/lang/src/lib.rs

Lines 304 to 309 in bb809fd

pub trait Discriminator {
const DISCRIMINATOR: &'static [u8];
fn discriminator() -> &'static [u8] {
Self::DISCRIMINATOR
}
}

The reason why both exist is likely because of backwards compatibility reasons (DISCRIMINATOR constant was added after the discriminator method).

This is no longer necessary, and it's fitting to remove it now that the return type has also changed.

Summary of changes

Remove the discriminator method of the Discriminator trait.


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

Copy link

vercel bot commented Aug 10, 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 46f52da into coral-xyz:master Aug 10, 2024
0 of 3 checks passed
andreisilviudragnea added a commit to andreisilviudragnea/solana-test-framework that referenced this pull request Aug 14, 2024
andreisilviudragnea added a commit to andreisilviudragnea/solana-test-framework that referenced this pull request Aug 14, 2024
andreisilviudragnea added a commit to andreisilviudragnea/solana-test-framework that referenced this pull request Aug 14, 2024
andreisilviudragnea added a commit to andreisilviudragnea/solana-test-framework that referenced this pull request Aug 14, 2024
andreisilviudragnea added a commit to andreisilviudragnea/solana-test-framework that referenced this pull request Aug 14, 2024
andreisilviudragnea added a commit to andreisilviudragnea/solana-test-framework that referenced this pull request Aug 14, 2024
andreisilviudragnea added a commit to andreisilviudragnea/solana-test-framework that referenced this pull request Aug 14, 2024
halbornteam pushed a commit to halbornteam/solana-test-framework that referenced this pull request Nov 4, 2024
- Cargo.lock removed from .gitignore (previous recommendation to not check in Cargo.lock for libraries has changed)
- Deploy non-upgradable program is no longer supported (solana-labs/solana#34424) - deploy_program function was kept for backwards compatibility but now uses upgradable loader)
- Fixed outdate processor macro. Also now it is possible to use this macro with new anchor entrypoint function.
- Updated structure of the new Pyth Oracle price account.
- Replaced various deprecated functions and structs with new equivalents.
- Fixed most of the compiler warnings.
- Bumped dependencies versions.
- Fixed create_associated_token_account to work with spl_token_2022::ID as suggested in [PR#23](#23).
- Fixed add_empty_account_with_anchor to work with future Anchor versions:
coral-xyz/anchor#3163  as suggested in [PR#23](#23).
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