Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit 25381b2

Browse files
authored
stake-pool: Add comments about unnecessary ownership checks (HAL-01) (#5084)
1 parent c9edc4d commit 25381b2

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

stake-pool/program/src/processor.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -739,13 +739,17 @@ impl Processor {
739739
return Err(StakePoolError::AlreadyInUse.into());
740740
}
741741

742+
// This check is unnecessary since the runtime will check the ownership,
743+
// but provides clarity that the parameter is in fact checked.
742744
check_account_owner(stake_pool_info, program_id)?;
743745
let mut stake_pool = try_from_slice_unchecked::<StakePool>(&stake_pool_info.data.borrow())?;
744746
if !stake_pool.is_uninitialized() {
745747
msg!("Provided stake pool already in use");
746748
return Err(StakePoolError::AlreadyInUse.into());
747749
}
748750

751+
// This check is unnecessary since the runtime will check the ownership,
752+
// but provides clarity that the parameter is in fact checked.
749753
check_account_owner(validator_list_info, program_id)?;
750754
let mut validator_list =
751755
try_from_slice_unchecked::<ValidatorList>(&validator_list_info.data.borrow())?;

0 commit comments

Comments
 (0)