Skip to content

Commit

Permalink
Update tests with missing mut signer attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
losman0s committed Jan 9, 2022
1 parent 84c937f commit a030d6a
Show file tree
Hide file tree
Showing 11 changed files with 81 additions and 104 deletions.
6 changes: 2 additions & 4 deletions tests/cashiers-check/programs/cashiers-check/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,7 @@ pub struct CashCheck<'info> {
check_signer: AccountInfo<'info>,
#[account(mut, has_one = owner)]
to: Account<'info, TokenAccount>,
#[account(signer)]
owner: AccountInfo<'info>,
owner: Signer<'info>,
token_program: AccountInfo<'info>,
}

Expand All @@ -148,8 +147,7 @@ pub struct CancelCheck<'info> {
check_signer: AccountInfo<'info>,
#[account(mut, has_one = owner)]
from: Account<'info, TokenAccount>,
#[account(signer)]
owner: AccountInfo<'info>,
owner: Signer<'info>,
token_program: AccountInfo<'info>,
}

Expand Down
7 changes: 3 additions & 4 deletions tests/chat/programs/chat/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@ pub struct CreateUser<'info> {
space = 320,
)]
user: Account<'info, User>,
#[account(signer)]
authority: AccountInfo<'info>,
#[account(mut)]
authority: Signer<'info>,
system_program: AccountInfo<'info>,
}

Expand All @@ -68,8 +68,7 @@ pub struct SendMessage<'info> {
has_one = authority,
)]
user: Account<'info, User>,
#[account(signer)]
authority: AccountInfo<'info>,
authority: Signer<'info>,
#[account(mut)]
chat_room: Loader<'info, ChatRoom>,
}
Expand Down
3 changes: 1 addition & 2 deletions tests/errors/programs/errors/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ pub struct HasOneError<'info> {

#[derive(Accounts)]
pub struct SignerError<'info> {
#[account(signer)]
my_account: AccountInfo<'info>,
my_account: Signer<'info>,
}

#[account]
Expand Down
2 changes: 1 addition & 1 deletion tests/escrow/programs/escrow/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ pub mod escrow {
#[derive(Accounts)]
#[instruction(initializer_amount: u64)]
pub struct InitializeEscrow<'info> {
#[account(signer)]
#[account(signer, mut)]
pub initializer: AccountInfo<'info>,
#[account(
mut,
Expand Down
6 changes: 2 additions & 4 deletions tests/lockup/programs/lockup/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,7 @@ pub struct Withdraw<'info> {
// Vesting.
#[account(mut, has_one = beneficiary, has_one = vault)]
vesting: Account<'info, Vesting>,
#[account(signer)]
beneficiary: AccountInfo<'info>,
beneficiary: Signer<'info>,
#[account(mut)]
vault: Account<'info, TokenAccount>,
#[account(
Expand Down Expand Up @@ -281,8 +280,7 @@ pub struct WhitelistDeposit<'info> {
#[derive(Accounts)]
pub struct WhitelistTransfer<'info> {
lockup: ProgramState<'info, Lockup>,
#[account(signer)]
beneficiary: AccountInfo<'info>,
beneficiary: Signer<'info>,
whitelisted_program: AccountInfo<'info>,

// Whitelist interface.
Expand Down
44 changes: 15 additions & 29 deletions tests/lockup/programs/registry/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -596,8 +596,7 @@ impl<'info> Initialize<'info> {
pub struct UpdateRegistrar<'info> {
#[account(mut, has_one = authority)]
registrar: Account<'info, Registrar>,
#[account(signer)]
authority: AccountInfo<'info>,
authority: Signer<'info>,
}

#[derive(Accounts)]
Expand All @@ -607,8 +606,7 @@ pub struct CreateMember<'info> {
// Member.
#[account(zero)]
member: Box<Account<'info, Member>>,
#[account(signer)]
beneficiary: AccountInfo<'info>,
beneficiary: Signer<'info>,
#[account(
"&balances.spt.owner == member_signer.key",
"balances.spt.mint == registrar.pool_mint",
Expand Down Expand Up @@ -672,8 +670,7 @@ pub struct Ctor<'info> {

#[derive(Accounts)]
pub struct SetLockupProgram<'info> {
#[account(signer)]
authority: AccountInfo<'info>,
authority: Signer<'info>,
}

#[derive(Accounts)]
Expand All @@ -691,17 +688,15 @@ pub struct IsRealized<'info> {
pub struct UpdateMember<'info> {
#[account(mut, has_one = beneficiary)]
member: Account<'info, Member>,
#[account(signer)]
beneficiary: AccountInfo<'info>,
beneficiary: Signer<'info>,
}

#[derive(Accounts)]
pub struct Deposit<'info> {
// Member.
#[account(has_one = beneficiary)]
member: Account<'info, Member>,
#[account(signer)]
beneficiary: AccountInfo<'info>,
beneficiary: Signer<'info>,
#[account(mut, constraint = vault.to_account_info().key == &member.balances.vault)]
vault: Account<'info, TokenAccount>,
// Depositor.
Expand All @@ -727,7 +722,7 @@ pub struct DepositLocked<'info> {
// Note: no need to verify the depositor_authority since the SPL program
// will fail the transaction if it's not correct.
#[account(signer)]
depositor_authority: AccountInfo<'info>,
pub depositor_authority: AccountInfo<'info>,
#[account(constraint = token_program.key == &token::ID)]
token_program: AccountInfo<'info>,
#[account(
Expand All @@ -746,8 +741,7 @@ pub struct DepositLocked<'info> {
registrar: Box<Account<'info, Registrar>>,
#[account(has_one = registrar, has_one = beneficiary)]
member: Box<Account<'info, Member>>,
#[account(signer)]
beneficiary: AccountInfo<'info>,
beneficiary: Signer<'info>,
}

#[derive(Accounts)]
Expand All @@ -762,8 +756,7 @@ pub struct Stake<'info> {
// Member.
#[account(mut, has_one = beneficiary, has_one = registrar)]
member: Account<'info, Member>,
#[account(signer)]
beneficiary: AccountInfo<'info>,
beneficiary: Signer<'info>,
#[account(constraint = BalanceSandbox::from(&balances) == member.balances)]
balances: BalanceSandboxAccounts<'info>,
#[account(constraint = BalanceSandbox::from(&balances_locked) == member.balances_locked)]
Expand Down Expand Up @@ -801,8 +794,7 @@ pub struct StartUnstake<'info> {
pending_withdrawal: Account<'info, PendingWithdrawal>,
#[account(has_one = beneficiary, has_one = registrar)]
member: Account<'info, Member>,
#[account(signer)]
beneficiary: AccountInfo<'info>,
beneficiary: Signer<'info>,
#[account(constraint = BalanceSandbox::from(&balances) == member.balances)]
balances: BalanceSandboxAccounts<'info>,
#[account(constraint = BalanceSandbox::from(&balances_locked) == member.balances_locked)]
Expand All @@ -827,8 +819,7 @@ pub struct EndUnstake<'info> {

#[account(has_one = registrar, has_one = beneficiary)]
member: Account<'info, Member>,
#[account(signer)]
beneficiary: AccountInfo<'info>,
beneficiary: Signer<'info>,
#[account(mut, has_one = registrar, has_one = member, constraint = !pending_withdrawal.burned)]
pending_withdrawal: Account<'info, PendingWithdrawal>,

Expand Down Expand Up @@ -859,8 +850,7 @@ pub struct Withdraw<'info> {
// Member.
#[account(has_one = registrar, has_one = beneficiary)]
member: Account<'info, Member>,
#[account(signer)]
beneficiary: AccountInfo<'info>,
beneficiary: Signer<'info>,
#[account(mut, constraint = vault.to_account_info().key == &member.balances.vault)]
vault: Account<'info, TokenAccount>,
#[account(
Expand All @@ -886,8 +876,7 @@ pub struct WithdrawLocked<'info> {
vesting: Box<Account<'info, Vesting>>,
#[account(mut, constraint = vesting_vault.key == &vesting.vault)]
vesting_vault: AccountInfo<'info>,
#[account(signer)]
vesting_signer: AccountInfo<'info>,
vesting_signer: Signer<'info>,
#[account(constraint = token_program.key == &token::ID)]
token_program: AccountInfo<'info>,
#[account(
Expand All @@ -906,8 +895,7 @@ pub struct WithdrawLocked<'info> {
registrar: Box<Account<'info, Registrar>>,
#[account(has_one = registrar, has_one = beneficiary)]
member: Box<Account<'info, Member>>,
#[account(signer)]
beneficiary: AccountInfo<'info>,
beneficiary: Signer<'info>,
}

#[derive(Accounts)]
Expand Down Expand Up @@ -977,8 +965,7 @@ pub struct ClaimRewardCommon<'info> {
// Member.
#[account(mut, has_one = registrar, has_one = beneficiary)]
member: Account<'info, Member>,
#[account(signer)]
beneficiary: AccountInfo<'info>,
beneficiary: Signer<'info>,
#[account(constraint = BalanceSandbox::from(&balances) == member.balances)]
balances: BalanceSandboxAccounts<'info>,
#[account(constraint = BalanceSandbox::from(&balances_locked) == member.balances_locked)]
Expand Down Expand Up @@ -1014,8 +1001,7 @@ pub struct ExpireReward<'info> {
)]
vendor_signer: AccountInfo<'info>,
// Receiver.
#[account(signer)]
expiry_receiver: AccountInfo<'info>,
expiry_receiver: Signer<'info>,
#[account(mut)]
expiry_receiver_token: AccountInfo<'info>,
// Misc.
Expand Down
Loading

0 comments on commit a030d6a

Please sign in to comment.