Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lang: derive arbitrary traits for the instruction data #2518

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)).
- idl: Allow overriding the idl build toolchain with the `RUSTUP_TOOLCHAIN` environment variable ([#2941](https://github.com/coral-xyz/anchor/pull/2941]))
- avm: Support customizing the installation location using `AVM_HOME` environment variable ([#2917](https://github.com/coral-xyz/anchor/pull/2917))
- idl, ts: Add accounts resolution for associated token accounts ([#2927](https://github.com/coral-xyz/anchor/pull/2927))
Expand Down
2 changes: 2 additions & 0 deletions lang/syn/src/codegen/program/instruction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,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
Expand All @@ -52,6 +53,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),*
}
Expand Down
Loading