Skip to content

idl: Fix defined types with unsupported fields not producing an error#4088

Merged
acheroncrypto merged 2 commits into
otter-sec:masterfrom
acheroncrypto:idl-fix-defined-types-with-unsupported-fields-not-producing-an-error
Nov 23, 2025
Merged

idl: Fix defined types with unsupported fields not producing an error#4088
acheroncrypto merged 2 commits into
otter-sec:masterfrom
acheroncrypto:idl-fix-defined-types-with-unsupported-fields-not-producing-an-error

Conversation

@acheroncrypto

Copy link
Copy Markdown
Collaborator

Problem

As mentioned in #4073, defined types (structs and enums) do not get included in the IDL if they contain unsupported type(s).

For example, with the following type:

pub struct BrokenType {
    x: (u32, u32),
}

IDL build successfully, but there is no type definition for BrokenType in the types section. This is not only unintuitive, but it also breaks other parts of the framework e.g. declare_program! and TS package usage.

Summary of changes

Make unsupported field types of defined types produce an error instead of omitting the type definition altogether.

Example error output:

error: Unsupported type
  --> programs/name/src/lib.rs:37:8
   |
37 |     x: (u32, u32),
   |        ^^^^^^^^^^

Note: This is a fix but also a breaking change because, although unlikely, programs that compiled before this change might not compile after this change if they are using unsupported types in their public API.

Fixes #4073

@vercel

vercel Bot commented Nov 22, 2025

Copy link
Copy Markdown

@acheroncrypto is attempting to deploy a commit to the Solana Foundation Team on Vercel.

A member of the Team first needs to authorize it.

@acheroncrypto acheroncrypto added idl related to the IDL, either program or client side fix Bug fix PR labels Nov 22, 2025
@acheroncrypto acheroncrypto merged commit f39a7a5 into otter-sec:master Nov 23, 2025
56 of 57 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix Bug fix PR idl related to the IDL, either program or client side

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: invalid type is accepted during build but generates invalid idl

1 participant