From 25381b2913990f181094a05b413deb7e2f264c25 Mon Sep 17 00:00:00 2001 From: Jon Cinque Date: Fri, 1 Sep 2023 18:55:19 +0200 Subject: [PATCH] stake-pool: Add comments about unnecessary ownership checks (HAL-01) (#5084) --- stake-pool/program/src/processor.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/stake-pool/program/src/processor.rs b/stake-pool/program/src/processor.rs index 167f19a540b..52ce25e7ccb 100644 --- a/stake-pool/program/src/processor.rs +++ b/stake-pool/program/src/processor.rs @@ -739,6 +739,8 @@ impl Processor { return Err(StakePoolError::AlreadyInUse.into()); } + // This check is unnecessary since the runtime will check the ownership, + // but provides clarity that the parameter is in fact checked. check_account_owner(stake_pool_info, program_id)?; let mut stake_pool = try_from_slice_unchecked::(&stake_pool_info.data.borrow())?; if !stake_pool.is_uninitialized() { @@ -746,6 +748,8 @@ impl Processor { return Err(StakePoolError::AlreadyInUse.into()); } + // This check is unnecessary since the runtime will check the ownership, + // but provides clarity that the parameter is in fact checked. check_account_owner(validator_list_info, program_id)?; let mut validator_list = try_from_slice_unchecked::(&validator_list_info.data.borrow())?;