Skip to content

lang: Add discriminator argument to #[event] attribute#3152

Merged
acheroncrypto merged 4 commits into
otter-sec:masterfrom
acheroncrypto:lang-add-discriminator-argument-to-event-attribute
Aug 5, 2024
Merged

lang: Add discriminator argument to #[event] attribute#3152
acheroncrypto merged 4 commits into
otter-sec:masterfrom
acheroncrypto:lang-add-discriminator-argument-to-event-attribute

Conversation

@acheroncrypto

Copy link
Copy Markdown
Collaborator

Problem

It's not possible to override the discriminator generated by the #[event] attribute.

Summary of changes

Add discriminator = <EXPR> argument to the #[event] attribute similar to #3137 and #3149.

Example

#[event(discriminator = 1)]
pub struct MyAccount {
    pub field: u8,
}

See a full example in custom-discriminator tests.


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

@vercel

vercel Bot commented Aug 5, 2024

Copy link
Copy Markdown

@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 9117bbc into otter-sec:master Aug 5, 2024
Otter-0x4ka5h pushed a commit to Otter-0x4ka5h/anchor that referenced this pull request Mar 25, 2026
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