Skip to content

Commit

Permalink
solana: Further comments and dylint annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
johnsaigle committed Mar 1, 2024
1 parent e326736 commit 7100a24
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ pub struct TransferOwnership<'info> {
}

pub fn transfer_ownership(ctx: Context<TransferOwnership>) -> Result<()> {
// Missing ownership check is OK here: new_owner is not expected to interact with this
// instruction. Instead, they call [`claim_ownership`]. The whole intention of new_owner
// is that it could be an arbitrary account.
ctx.accounts.config.pending_owner = Some(ctx.accounts.new_owner.key());

// TODO: only transfer authority when the authority is not already the upgrade lock
Expand Down Expand Up @@ -218,6 +221,8 @@ pub struct RegisterTransceiver<'info> {
pub system_program: Program<'info, System>,
}

#[allow(unknown_lints)]
#[allow(missing_owner_check)]
pub fn register_transceiver(ctx: Context<RegisterTransceiver>) -> Result<()> {
let id = ctx.accounts.config.next_transceiver_id;
ctx.accounts.config.next_transceiver_id += 1;
Expand All @@ -226,6 +231,8 @@ pub fn register_transceiver(ctx: Context<RegisterTransceiver>) -> Result<()> {
.set_inner(RegisteredTransceiver {
bump: ctx.bumps.registered_transceiver,
id,
// Missing ownership check is OK here: Transceiver is intended to be an arbitrary
// program.
transceiver_address: ctx.accounts.transceiver.key(),
});

Expand Down

0 comments on commit 7100a24

Please sign in to comment.