Skip to content

Support custom discriminators #3097

@acheroncrypto

Description

@acheroncrypto

Problem

There are several problems regarding Anchor discriminators:

  • Due to the transaction size limits enforced by the Solana runtime (1232 bytes), 8 bytes can be too high for some use cases (e.g. Allow Optionally Reducing The Instruction Sighash Length Or Matched Bytes #2006)
  • 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:

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions