Skip to content

ts: Get discriminator lengths dynamically#3120

Merged
acheroncrypto merged 6 commits into
otter-sec:masterfrom
acheroncrypto:ts-get-discriminator-lengths-dynamically
Jul 26, 2024
Merged

ts: Get discriminator lengths dynamically#3120
acheroncrypto merged 6 commits into
otter-sec:masterfrom
acheroncrypto:ts-get-discriminator-lengths-dynamically

Conversation

@acheroncrypto

Copy link
Copy Markdown
Collaborator

Problem

TypeScript library uses a hardcoded value for the discriminator length in many places:

https://github.com/coral-xyz/anchor/blob/293ee9142bcbcf253e4507b83a941e7d580699aa/ts/packages/anchor/src/coder/borsh/discriminator.ts#L1-L4

Summary of changes

  • Remove the DISCRIMINATOR_SIZE constant
  • Get discriminator lengths of instructions, accounts and events dynamically

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

@vercel

vercel Bot commented Jul 26, 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 9fce3df into otter-sec:master Jul 26, 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