From fe8d1a63bdf49ead74485a692d67634f1bd46944 Mon Sep 17 00:00:00 2001 From: Christian Kamm Date: Mon, 24 Apr 2023 09:52:44 +0200 Subject: [PATCH] Fix building with "no-entrypoint" feature (#558) Without this, anchor complains about a missing lifetime on a struct relating to Benchmark. --- programs/mango-v4/src/accounts_ix/benchmark.rs | 5 ++++- programs/mango-v4/tests/program_test/mango_client.rs | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/programs/mango-v4/src/accounts_ix/benchmark.rs b/programs/mango-v4/src/accounts_ix/benchmark.rs index a31e101ef..3f7ec01d8 100644 --- a/programs/mango-v4/src/accounts_ix/benchmark.rs +++ b/programs/mango-v4/src/accounts_ix/benchmark.rs @@ -1,4 +1,7 @@ use anchor_lang::prelude::*; #[derive(Accounts)] -pub struct Benchmark {} +pub struct Benchmark<'info> { + /// CHECK: unused, exists only because anchor is unhappy in no-entrypoint mode otherwise + pub dummy: UncheckedAccount<'info>, +} diff --git a/programs/mango-v4/tests/program_test/mango_client.rs b/programs/mango-v4/tests/program_test/mango_client.rs index 21027268f..5eaabbc07 100644 --- a/programs/mango-v4/tests/program_test/mango_client.rs +++ b/programs/mango-v4/tests/program_test/mango_client.rs @@ -3922,7 +3922,9 @@ impl ClientInstruction for BenchmarkInstruction { ) -> (Self::Accounts, instruction::Instruction) { let program_id = mango_v4::id(); let instruction = Self::Instruction {}; - let accounts = Self::Accounts {}; + let accounts = Self::Accounts { + dummy: Pubkey::new_unique(), + }; let instruction = make_instruction(program_id, &accounts, &instruction); (accounts, instruction)