From 58105207afa50dff8f9299b602f39b3357b7eba2 Mon Sep 17 00:00:00 2001 From: Christian Kamm Date: Mon, 15 Aug 2022 10:42:37 +0200 Subject: [PATCH] Make anchor's lint pass --- mc-release-to-devnet.sh | 3 +-- programs/mango-v4/src/instructions/flash_loan.rs | 1 + .../mango-v4/src/instructions/token_update_index_and_rate.rs | 2 ++ programs/mango-v4/src/state/dynamic_account.rs | 1 + release-to-devnet.sh | 3 +-- release-to-mainnet.sh | 3 +-- update-local-idl.sh | 3 +-- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/mc-release-to-devnet.sh b/mc-release-to-devnet.sh index 8bb90f1c6..407dfabed 100755 --- a/mc-release-to-devnet.sh +++ b/mc-release-to-devnet.sh @@ -7,9 +7,8 @@ set -e pipefail WALLET_WITH_FUNDS=~/.config/solana/mango-devnet.json PROGRAM_ID=5V2zCYCQkm4sZc3WctiwQEAzvfAiFxyjbwCvzQnmtmkM -# TODO fix need for --skip-lint # build program, -cargo run -p anchor-cli -- build --skip-lint +cargo run -p anchor-cli -- build # patch types, which we want in rust, but anchor client doesn't support ./idl-fixup.sh diff --git a/programs/mango-v4/src/instructions/flash_loan.rs b/programs/mango-v4/src/instructions/flash_loan.rs index c5a902c3a..7aa245833 100644 --- a/programs/mango-v4/src/instructions/flash_loan.rs +++ b/programs/mango-v4/src/instructions/flash_loan.rs @@ -27,6 +27,7 @@ pub struct FlashLoanBegin<'info> { pub token_program: Program<'info, Token>, /// Instructions Sysvar for instruction introspection + /// CHECK: fixed instructions sysvar account #[account(address = tx_instructions::ID)] pub instructions: UncheckedAccount<'info>, } diff --git a/programs/mango-v4/src/instructions/token_update_index_and_rate.rs b/programs/mango-v4/src/instructions/token_update_index_and_rate.rs index 8867c237a..3204b143b 100644 --- a/programs/mango-v4/src/instructions/token_update_index_and_rate.rs +++ b/programs/mango-v4/src/instructions/token_update_index_and_rate.rs @@ -34,8 +34,10 @@ pub struct TokenUpdateIndexAndRate<'info> { )] pub mint_info: AccountLoader<'info, MintInfo>, + /// CHECK: oracle can be one of multiple account types pub oracle: UncheckedAccount<'info>, + /// CHECK: fixed instructions sysvar account #[account(address = tx_instructions::ID)] pub instructions: UncheckedAccount<'info>, } diff --git a/programs/mango-v4/src/state/dynamic_account.rs b/programs/mango-v4/src/state/dynamic_account.rs index d95860b91..0a5047b42 100644 --- a/programs/mango-v4/src/state/dynamic_account.rs +++ b/programs/mango-v4/src/state/dynamic_account.rs @@ -115,6 +115,7 @@ impl DerefOrBorrowMut<[T]> for Vec { } pub struct AccountLoaderDynamic<'info, D: DynamicAccountType> { + /// CHECK: is checked below acc_info: AccountInfo<'info>, phantom1: PhantomData<&'info D>, } diff --git a/release-to-devnet.sh b/release-to-devnet.sh index edcb5c05d..0971e9e6f 100755 --- a/release-to-devnet.sh +++ b/release-to-devnet.sh @@ -5,9 +5,8 @@ set -ex pipefail WALLET_WITH_FUNDS=~/.config/solana/mango-devnet.json PROGRAM_ID=m43thNJ58XCjL798ZSq6JGAG1BnWskhdq5or6kcnfsD -# TODO fix need for --skip-lint # build program, -cargo run -p anchor-cli -- build --skip-lint +cargo run -p anchor-cli -- build # patch types, which we want in rust, but anchor client doesn't support ./idl-fixup.sh diff --git a/release-to-mainnet.sh b/release-to-mainnet.sh index e9ab8d0a9..0cdd019ec 100755 --- a/release-to-mainnet.sh +++ b/release-to-mainnet.sh @@ -5,9 +5,8 @@ set -ex pipefail WALLET_WITH_FUNDS=~/.config/solana/mango-mainnet.json PROGRAM_ID=m43thNJ58XCjL798ZSq6JGAG1BnWskhdq5or6kcnfsD -# TODO fix need for --skip-lint # build program, -cargo run -p anchor-cli -- build --skip-lint +cargo run -p anchor-cli -- build # patch types, which we want in rust, but anchor client doesn't support ./idl-fixup.sh diff --git a/update-local-idl.sh b/update-local-idl.sh index 5e71820b9..1a517375d 100755 --- a/update-local-idl.sh +++ b/update-local-idl.sh @@ -2,9 +2,8 @@ set -e pipefail -# TODO fix need for --skip-lint # build program, -cargo run -p anchor-cli -- build --skip-lint +cargo run -p anchor-cli -- build # patch types, which we want in rust, but anchor client doesn't support ./idl-fixup.sh