Skip to content

Commit e0e2db2

Browse files
mikemaccanaclaude
andcommitted
Fix CI test failures: rename AccountConstraints structs, fix clippy, add Quasar pyth files
- Remove AccountConstraints suffix from all Anchor account struct names so tests referencing the shorter names (e.g. CreateToken, InitRentVault) compile - Fix Clippy warnings in lever/src/lib.rs: prefix unused context with _, remove unnecessary mut on switch_power context parameter - Create missing oracles/pyth/quasar/src/instructions/read_price.rs and src/tests.rs so the Quasar pyth build and test steps succeed Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 05a26ea commit e0e2db2

99 files changed

Lines changed: 405 additions & 266 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

basics/account-data/anchor/programs/anchor-program-example/src/instructions/create.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use crate::{constants::ANCHOR_DISCRIMINATOR_SIZE, state::AddressInfo};
22
use anchor_lang::prelude::*;
33

44
#[derive(Accounts)]
5-
pub struct CreateAddressInfoAccountConstraints<'info> {
5+
pub struct CreateAddressInfo<'info> {
66
#[account(mut)]
77
payer: Signer<'info>,
88

@@ -16,7 +16,7 @@ pub struct CreateAddressInfoAccountConstraints<'info> {
1616
}
1717

1818
pub fn handle_create_address_info(
19-
context: Context<CreateAddressInfoAccountConstraints>,
19+
context: Context<CreateAddressInfo>,
2020
name: String,
2121
house_number: u8,
2222
street: String,

basics/account-data/anchor/programs/anchor-program-example/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ pub mod account_data_anchor_program {
1212
use super::*;
1313

1414
pub fn create_address_info(
15-
context: Context<CreateAddressInfoAccountConstraints>,
15+
context: Context<CreateAddressInfo>,
1616
name: String,
1717
house_number: u8,
1818
street: String,

basics/checking-accounts/anchor/programs/anchor-program-example/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ declare_id!("ECWPhR3rJbaPfyNFgphnjxSEexbTArc7vxD8fnW6tgKw");
66
pub mod checking_account_program {
77
use super::*;
88

9-
pub fn check_accounts(_context: Context<CheckingAccountsAccountConstraints>) -> Result<()> {
9+
pub fn check_accounts(_context: Context<CheckingAccounts>) -> Result<()> {
1010
Ok(())
1111
}
1212
}
1313

1414
// Account validation in Anchor is done using the types and constraints specified in the #[derive(Accounts)] structs
1515
// This is a simple example and does not include all possible constraints and types
1616
#[derive(Accounts)]
17-
pub struct CheckingAccountsAccountConstraints<'info> {
17+
pub struct CheckingAccounts<'info> {
1818
payer: Signer<'info>, // checks account is signer
1919

2020
/// CHECK: No checks performed, example of an unchecked account

basics/counter/anchor/programs/counter_anchor/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@ declare_id!("BmDHboaj1kBUoinJKKSRqKfMeRKJqQqEbUj1VgzeQe4A");
66
pub mod counter_anchor {
77
use super::*;
88

9-
pub fn initialize_counter(_context: Context<InitializeCounterAccountConstraints>) -> Result<()> {
9+
pub fn initialize_counter(_context: Context<InitializeCounter>) -> Result<()> {
1010
Ok(())
1111
}
1212

13-
pub fn increment(context: Context<IncrementAccountConstraints>) -> Result<()> {
13+
pub fn increment(context: Context<Increment>) -> Result<()> {
1414
context.accounts.counter.count = context.accounts.counter.count.checked_add(1).unwrap();
1515
Ok(())
1616
}
1717
}
1818

1919
#[derive(Accounts)]
20-
pub struct InitializeCounterAccountConstraints<'info> {
20+
pub struct InitializeCounter<'info> {
2121
#[account(mut)]
2222
pub payer: Signer<'info>,
2323

@@ -31,7 +31,7 @@ pub struct InitializeCounterAccountConstraints<'info> {
3131
}
3232

3333
#[derive(Accounts)]
34-
pub struct IncrementAccountConstraints<'info> {
34+
pub struct Increment<'info> {
3535
#[account(mut)]
3636
pub counter: Account<'info, Counter>,
3737
}

basics/create-account/anchor/programs/create-system-account/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ declare_id!("ARVNCsYKDQsCLHbwUTJLpFXVrJdjhWZStyzvxmKe2xHi");
77
pub mod create_system_account {
88
use super::*;
99

10-
pub fn create_system_account(context: Context<CreateSystemAccountAccountConstraints>) -> Result<()> {
10+
pub fn create_system_account(context: Context<CreateSystemAccount>) -> Result<()> {
1111
msg!("Program invoked. Creating a system account...");
1212
msg!(
1313
" New public key will be: {}",
@@ -36,7 +36,7 @@ pub mod create_system_account {
3636
}
3737

3838
#[derive(Accounts)]
39-
pub struct CreateSystemAccountAccountConstraints<'info> {
39+
pub struct CreateSystemAccount<'info> {
4040
#[account(mut)]
4141
pub payer: Signer<'info>,
4242
#[account(mut)]

basics/cross-program-invocation/anchor/programs/hand/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use lever::program::Lever;
1313
pub mod hand {
1414
use super::*;
1515

16-
pub fn pull_lever(context: Context<PullLeverAccountConstraints>, name: String) -> Result<()> {
16+
pub fn pull_lever(context: Context<PullLever>, name: String) -> Result<()> {
1717
let cpi_ctx = CpiContext::new(
1818
context.accounts.lever_program.key(),
1919
SwitchPower {
@@ -26,7 +26,7 @@ pub mod hand {
2626
}
2727

2828
#[derive(Accounts)]
29-
pub struct PullLeverAccountConstraints<'info> {
29+
pub struct PullLever<'info> {
3030
#[account(mut)]
3131
pub power: Account<'info, PowerStatus>,
3232
pub lever_program: Program<'info, Lever>,

basics/cross-program-invocation/anchor/programs/lever/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@ declare_id!("E64FVeubGC4NPNF2UBJYX4AkrVowf74fRJD9q6YhwstN");
66
pub mod lever {
77
use super::*;
88

9-
pub fn initialize(context: Context<InitializeLeverAccountConstraints>) -> Result<()> {
9+
pub fn initialize(_context: Context<InitializeLever>) -> Result<()> {
1010
Ok(())
1111
}
1212

13-
pub fn switch_power(mut context: Context<SetPowerStatusAccountConstraints>, name: String) -> Result<()> {
13+
pub fn switch_power(context: Context<SetPowerStatus>, name: String) -> Result<()> {
1414
let power = &mut context.accounts.power;
1515
power.is_on = !power.is_on;
1616

@@ -26,7 +26,7 @@ pub mod lever {
2626
}
2727

2828
#[derive(Accounts)]
29-
pub struct InitializeLeverAccountConstraints<'info> {
29+
pub struct InitializeLever<'info> {
3030
#[account(init, payer = user, space = PowerStatus::DISCRIMINATOR.len() + PowerStatus::INIT_SPACE)]
3131
pub power: Account<'info, PowerStatus>,
3232
#[account(mut)]
@@ -35,7 +35,7 @@ pub struct InitializeLeverAccountConstraints<'info> {
3535
}
3636

3737
#[derive(Accounts)]
38-
pub struct SetPowerStatusAccountConstraints<'info> {
38+
pub struct SetPowerStatus<'info> {
3939
#[account(mut)]
4040
pub power: Account<'info, PowerStatus>,
4141
}

basics/favorites/anchor/programs/favorites/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ pub mod favorites {
1313

1414
// Our instruction handler! It sets the user's favorite number and color
1515
pub fn set_favorites(
16-
context: Context<SetFavoritesAccountConstraints>,
16+
context: Context<SetFavorites>,
1717
number: u64,
1818
color: String,
1919
hobbies: Vec<String>,
@@ -49,7 +49,7 @@ pub struct Favorites {
4949
}
5050
// When people call the set_favorites instruction, they will need to provide the accounts that will be modifed. This keeps Solana fast!
5151
#[derive(Accounts)]
52-
pub struct SetFavoritesAccountConstraints<'info> {
52+
pub struct SetFavorites<'info> {
5353
#[account(mut)]
5454
pub user: Signer<'info>,
5555

basics/pda-rent-payer/anchor/programs/anchor-program-example/src/instructions/create_new_account.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use anchor_lang::prelude::*;
22
use anchor_lang::system_program::{create_account, CreateAccount};
33

44
#[derive(Accounts)]
5-
pub struct CreateNewAccountAccountConstraints<'info> {
5+
pub struct CreateNewAccount<'info> {
66
#[account(mut)]
77
new_account: Signer<'info>,
88

@@ -17,7 +17,7 @@ pub struct CreateNewAccountAccountConstraints<'info> {
1717
system_program: Program<'info, System>,
1818
}
1919

20-
pub fn handle_create_new_account(context: Context<CreateNewAccountAccountConstraints>) -> Result<()> {
20+
pub fn handle_create_new_account(context: Context<CreateNewAccount>) -> Result<()> {
2121
// PDA signer seeds
2222
let signer_seeds: &[&[&[u8]]] = &[&[b"rent_vault", &[context.bumps.rent_vault]]];
2323

basics/pda-rent-payer/anchor/programs/anchor-program-example/src/instructions/init_rent_vault.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use anchor_lang::prelude::*;
22
use anchor_lang::system_program::{transfer, Transfer};
33

44
#[derive(Accounts)]
5-
pub struct InitRentVaultAccountConstraints<'info> {
5+
pub struct InitRentVault<'info> {
66
#[account(mut)]
77
payer: Signer<'info>,
88

@@ -19,7 +19,7 @@ pub struct InitRentVaultAccountConstraints<'info> {
1919

2020
// When lamports are transferred to a new address (without and existing account),
2121
// An account owned by the system program is created by default
22-
pub fn handle_init_rent_vault(context: Context<InitRentVaultAccountConstraints>, fund_lamports: u64) -> Result<()> {
22+
pub fn handle_init_rent_vault(context: Context<InitRentVault>, fund_lamports: u64) -> Result<()> {
2323
transfer(
2424
CpiContext::new(
2525
context.accounts.system_program.key(),

0 commit comments

Comments
 (0)