Skip to content

Commit

Permalink
lang: Remove discriminator method from Discriminator trait (#3163)
Browse files Browse the repository at this point in the history
  • Loading branch information
acheroncrypto authored Aug 10, 2024
1 parent bb809fd commit 46f52da
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 4 deletions.
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

0 comments on commit 46f52da

Please sign in to comment.