You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Discriminator trait has a fixed size type field ([u8; 8]) which means we can't implement it for non-Anchor programs (e.g. in declare_program!)
Discriminators are not customizable
Changing the name of the data type the discriminator was derived from results in a different discriminator
Solution
Don't make assumptions about the discriminator size and allow users to override the default Anchor discriminator. To do so, we need to complete the following tasks:
Problem
There are several problems regarding Anchor discriminators:
Discriminatortrait has a fixed size type field ([u8; 8]) which means we can't implement it for non-Anchor programs (e.g. indeclare_program!)Solution
Don't make assumptions about the discriminator size and allow users to override the default Anchor discriminator. To do so, we need to complete the following tasks:
declare_program!(lang: Add non-8-byte discriminator support indeclare_program!#3103)dispatchfunction to support dynamic discriminators (lang: Updatedispatchfunction to support dynamic discriminators #3104)try_entryfunction (lang: Remove the fallback function shortcut intry_entryfunction #3109)Discriminatortrait impl when using thezeroconstraint (lang: RequireDiscriminatortrait impl when using thezeroconstraint #3118)#[instruction]attribute proc-macro #3137)#[account]attribute arguments withsyn#3140)#[account]#3144)#[account]struct has generics #3148)discriminatorargument (lang: Adddiscriminatorargument to#[account]attribute #3149)discriminatorargument to#[event]attribute #3152)Discriminator::discriminator(lang: Removediscriminatormethod fromDiscriminatortrait #3163)#[instruction]attribute (lang: Deprecate#[interface]attribute #3195)