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

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ The minor version will be incremented upon a breaking change and the patch versi
- lang: `#[account]` attribute arguments no longer parses identifiers as namespaces ([#3140](https://github.com/coral-xyz/anchor/pull/3140)).
- spl: Rename metadata interface instruction fields from `token_program_id` to `program_id` ([#3076](https://github.com/coral-xyz/anchor/pull/3076)).
- lang, ts: Remove "8 byte" requirement from discriminator error messages ([#3161](https://github.com/coral-xyz/anchor/pull/3161)).
- lang: Remove `discriminator` method from `Discriminator` trait ([#3163](https://github.com/coral-xyz/anchor/pull/3163)).

## [0.30.1] - 2024-06-20

Expand Down
3 changes: 0 additions & 3 deletions lang/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,9 +303,6 @@ pub trait Event: AnchorSerialize + AnchorDeserialize + Discriminator {
/// 8 byte unique identifier for a type.
pub trait Discriminator {
const DISCRIMINATOR: &'static [u8];
fn discriminator() -> &'static [u8] {
Self::DISCRIMINATOR
}
}

/// Defines the space of an account for initialization.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ async fn update_foo() {
let foo_pubkey = Pubkey::new_unique();
let foo_account = {
let mut foo_data = Vec::new();
foo_data.extend_from_slice(&zero_copy::Foo::discriminator());
foo_data.extend_from_slice(zero_copy::Foo::DISCRIMINATOR);
foo_data.extend_from_slice(bytemuck::bytes_of(&zero_copy::Foo {
authority: authority.pubkey(),
..zero_copy::Foo::default()
Expand Down
Loading