From 81f4456154a7eb4b612bbbdd0ec1930a2a15b272 Mon Sep 17 00:00:00 2001 From: Michal Rostecki Date: Thu, 19 Sep 2024 07:42:14 +0200 Subject: [PATCH] fix: IDL generation in programs using light-sdk (#1233) Even when using `idl-build` feature, Anchor still parses the code of the program and expects the `#[program]` attribute applied on the main module. Before this change, annotating the program module only with `#[light_program]` was preventing the IDL generation. Fix that by requiring both attributes: ```rust #[light_program] #[program] ``` And not injecting the `#[program]` inside `#[light_program]`. --- examples/name-service/programs/name-service/src/lib.rs | 1 + macros/light-sdk-macros/src/program.rs | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/name-service/programs/name-service/src/lib.rs b/examples/name-service/programs/name-service/src/lib.rs index 25c43e9802..d081df8660 100644 --- a/examples/name-service/programs/name-service/src/lib.rs +++ b/examples/name-service/programs/name-service/src/lib.rs @@ -11,6 +11,7 @@ use light_sdk::{ declare_id!("7yucc7fL3JGbyMwg4neUaenNSdySS39hbAk89Ao3t1Hz"); #[light_program] +#[program] pub mod name_service { use super::*; diff --git a/macros/light-sdk-macros/src/program.rs b/macros/light-sdk-macros/src/program.rs index ed4dfa1ff2..cd07307f10 100644 --- a/macros/light-sdk-macros/src/program.rs +++ b/macros/light-sdk-macros/src/program.rs @@ -285,7 +285,6 @@ pub(crate) fn program(mut input: ItemMod) -> Result { Ok(quote! { #instruction_params - #[program] #input }) }