Skip to content
This repository has been archived by the owner on Feb 15, 2025. It is now read-only.

Commit

Permalink
Added the required CHECK docs from Anchor
Browse files Browse the repository at this point in the history
  • Loading branch information
Connor O'Hara authored and ckamm committed Dec 22, 2022
1 parent 55b5ea2 commit 3ef766d
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ pub struct CloseVoter<'info> {
pub voter_authority: Signer<'info>,

#[account(mut)]
/// CHECK: Destination may be any address.
pub sol_destination: UncheckedAccount<'info>,

pub token_program: Program<'info, Token>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@ pub struct CreateRegistrar<'info> {

/// An spl-governance realm
///
/// realm is validated in the instruction:
/// CHECK: realm is validated in the instruction:
/// - realm is owned by the governance_program_id
/// - realm_governing_token_mint must be the community or council mint
/// - realm_authority is realm.authority
pub realm: UncheckedAccount<'info>,

/// CHECK: May be any instance of spl-governance
/// The program id of the spl-governance program the realm belongs to.
pub governance_program_id: UncheckedAccount<'info>,
/// Either the realm community mint or the council mint.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ pub struct CreateVoter<'info> {
pub system_program: Program<'info, System>,
pub rent: Sysvar<'info, Rent>,

/// CHECK: Address constraint is set
#[account(address = tx_instructions::ID)]
pub instructions: UncheckedAccount<'info>,
}
Expand Down
1 change: 1 addition & 0 deletions programs/voter-stake-registry/src/instructions/grant.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ pub struct Grant<'info> {

/// The account of the grantee / the address controlling the voter
/// that the grant is going to.
/// CHECK: May be any address
pub voter_authority: UncheckedAccount<'info>,

/// The voter weight record is the account that will be shown to spl-governance
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use anchor_lang::prelude::*;
pub struct UpdateMaxVoteWeight<'info> {
pub registrar: AccountLoader<'info, Registrar>,
// TODO: SPL governance has not yet implemented this.
/// CHECK: TODO. Will be implemented when max_vote_weight_record is rolled out.
pub max_vote_weight_record: UncheckedAccount<'info>,
}

Expand Down
2 changes: 1 addition & 1 deletion programs/voter-stake-registry/src/instructions/withdraw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub struct Withdraw<'info> {
/// to be able to forbid withdraws while the voter is engaged with
/// a vote or has an open proposal.
///
/// token_owner_record is validated in the instruction:
/// CHECK: token_owner_record is validated in the instruction:
/// - owned by registrar.governance_program_id
/// - for the registrar.realm
/// - for the registrar.realm_governing_token_mint
Expand Down

0 comments on commit 3ef766d

Please sign in to comment.