Skip to content

Commit 3ef37e5

Browse files
authored
program: check svsp explicitly in DepositSol (#657)
1 parent 50aa2b2 commit 3ef37e5

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

program/src/processor.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1584,6 +1584,7 @@ impl Processor {
15841584
let system_program_info = next_account_info(account_info_iter)?;
15851585
let token_program_info = next_account_info(account_info_iter)?;
15861586
let stake_program_info = next_account_info(account_info_iter)?;
1587+
let svsp_program_info = next_account_info(account_info_iter)?;
15871588

15881589
let rent = Rent::get()?;
15891590
let stake_history = &StakeHistorySysvar(clock.epoch);
@@ -1609,6 +1610,14 @@ impl Processor {
16091610
check_system_program(system_program_info.key)?;
16101611
check_token_program(token_program_info.key)?;
16111612
check_stake_program(stake_program_info.key)?;
1613+
if svsp_program_info.key != program_id {
1614+
msg!(
1615+
"Expected SVSP program {}, received {}",
1616+
program_id,
1617+
svsp_program_info.key,
1618+
);
1619+
return Err(ProgramError::IncorrectProgramId);
1620+
}
16121621

16131622
if deposit_amount == 0 {
16141623
return Err(SinglePoolError::DepositTooSmall.into());

0 commit comments

Comments
 (0)