Skip to content

Add hand-written Anchor-compatible IDL#65

Draft
kaze-cow wants to merge 1 commit into
discriminatorsfrom
idl
Draft

Add hand-written Anchor-compatible IDL#65
kaze-cow wants to merge 1 commit into
discriminatorsfrom
idl

Conversation

@kaze-cow

@kaze-cow kaze-cow commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds a hand-written Anchor-compatible IDL (programs/settlement/idl/cow_settlement.json) describing the settlement program's instructions/accounts/types, for IDL-driven tooling (e.g. Solscan). This program is native/Pinocchio, not Anchor, so there's no generated IDL to start from.
  • A few spots can't be fully expressed in the IDL grammar and are documented inline via docs fields instead:
    • BeginSettle's dynamically-shaped tail (order count / bumps / transfer counts / pull amounts) has no Borsh-expressible layout (no length prefixes, and a trailing array whose length is the sum of an earlier array).
    • order_pda's PDA seed is sha256(intent_bytes) — a hash of the whole instruction argument, not a plain field/account reference the PDA-seed grammar can point at.
    • create_buffer's account list is padded to a chosen maximum (15) of indexed (buffer_pda_i, mint_i) pairs, since the real instruction accepts an unbounded number of them via remaining accounts.

Stacked on #64 (discriminators), which is itself stacked on #63 (little-endian encoding) — the IDL only makes sense once both land.

Draft — why

We don't yet have a cheap way to actually validate this IDL against the real program: e.g. that it can build parsable/successful transactions for every defined instruction, and successfully parse real account data pulled from a running program. That validation is planned as fast-follow work; marking this draft until we have it.

Test plan

  • JSON is well-formed (python3 -m json.tool)
  • (follow-up) round-trip validation against real transactions/accounts

🤖 Generated with Claude Code

Describes the settlement program's instructions/accounts/types for
IDL-driven tooling (e.g. Solscan), since this is a native/Pinocchio
program rather than an Anchor program and has no generated IDL.

Several spots can't be fully expressed in the IDL grammar and are
documented inline via `docs` fields instead: BeginSettle's
dynamically-shaped tail (order count/bumps/transfer counts/pull amounts,
which have no Borsh-expressible layout), and order_pda's PDA seed (a
sha256 hash of the whole intent argument, not a plain field/account
reference).

Draft: we don't yet have a cheap way to validate that this IDL is
actually correct - e.g. that it can build parsable/successful
transactions for each instruction, and successfully parse real account
data. That validation is intended as fast-follow work.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant