From 34a8e5923280a82fd8ff395fad61eb7a4a5ebed0 Mon Sep 17 00:00:00 2001 From: skrrb Date: Tue, 6 Jun 2023 11:58:56 +0200 Subject: [PATCH 1/2] syn: derive arbitrary for the instruction data --- lang/syn/src/codegen/program/instruction.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lang/syn/src/codegen/program/instruction.rs b/lang/syn/src/codegen/program/instruction.rs index 53c12306b4..7061594da4 100644 --- a/lang/syn/src/codegen/program/instruction.rs +++ b/lang/syn/src/codegen/program/instruction.rs @@ -42,6 +42,7 @@ pub fn generate(program: &Program) -> proc_macro2::TokenStream { quote! { /// Instruction. #[derive(AnchorSerialize, AnchorDeserialize)] + #[cfg_attr(feature = "arbitrary", derive(Debug, Clone, arbitrary::Arbitrary))] pub struct #ix_name_camel; #ix_data_trait @@ -50,6 +51,7 @@ pub fn generate(program: &Program) -> proc_macro2::TokenStream { quote! { /// Instruction. #[derive(AnchorSerialize, AnchorDeserialize)] + #[cfg_attr(feature = "arbitrary", derive(Debug, Clone, arbitrary::Arbitrary))] pub struct #ix_name_camel { #(#raw_args),* } From 704692c0e2dda3d500fab90d126ab9665f1ad9c6 Mon Sep 17 00:00:00 2001 From: skrrb Date: Tue, 6 Jun 2023 12:29:36 +0200 Subject: [PATCH 2/2] changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index a999c5de6f..fd7ec9e47b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,6 +12,7 @@ The minor version will be incremented upon a breaking change and the patch versi ### Features +- lang: Implement `Arbitrary` trait for the anchor-generated instruction module when the program is compiled with the arbitrary feature (requires the arbitrary crate) ([2518](https://github.com/coral-xyz/anchor/pull/2518)). - client: Add `async` feature flag to use an asynchronous anchor-client ([#2488](https://github.com/coral-xyz/anchor/pull/2488)). - spl: Add metadata wrappers `approve_collection_authority`, `bubblegum_set_collection_size`, `burn_edition_nft`, `burn_nft`, `revoke_collection_authority`, `set_token_standard`, `utilize`, `unverify_sized_collection_item`, `unverify_collection` ([#2430](https://github.com/coral-xyz/anchor/pull/2430)) - spl: Add `token_program` constraint to `Token`, `Mint`, and `AssociatedToken` accounts in order to override required `token_program` fields and use different token interface implementations in the same instruction ([#2460](https://github.com/coral-xyz/anchor/pull/2460))