Skip to content

Commit 39db4fe

Browse files
committed
solana: Further comments and dylint annotations
1 parent 8cf751b commit 39db4fe

File tree

1 file changed

+7
-0
lines changed
  • solana/programs/example-native-token-transfers/src/instructions

1 file changed

+7
-0
lines changed

solana/programs/example-native-token-transfers/src/instructions/admin.rs

+7
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ pub struct TransferOwnership<'info> {
5353
}
5454

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

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

224+
#[allow(unknown_lints)]
225+
#[allow(missing_owner_check)]
221226
pub fn register_transceiver(ctx: Context<RegisterTransceiver>) -> Result<()> {
222227
let id = ctx.accounts.config.next_transceiver_id;
223228
ctx.accounts.config.next_transceiver_id += 1;
@@ -226,6 +231,8 @@ pub fn register_transceiver(ctx: Context<RegisterTransceiver>) -> Result<()> {
226231
.set_inner(RegisteredTransceiver {
227232
bump: ctx.bumps.registered_transceiver,
228233
id,
234+
// Missing ownership check is OK here: Transceiver is intended to be an arbitrary
235+
// program.
229236
transceiver_address: ctx.accounts.transceiver.key(),
230237
});
231238

0 commit comments

Comments
 (0)