Skip to content

Commit 1ad9ee7

Browse files
committed
second pass on correctness, normalize style
1 parent 5971b45 commit 1ad9ee7

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

program/src/processor.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,7 @@ impl Processor {
394394
if Clock::check_id(branch_account.key) {
395395
let _stake_history_info = next_account_info(account_info_iter)?;
396396
let _stake_config_info = next_account_info(account_info_iter)?;
397+
// let _stake_authority_info = next_account_info(account_info_iter);
397398
} else {
398399
let stake_authority_info = branch_account;
399400
if !stake_authority_info.is_signer {
@@ -746,7 +747,9 @@ impl Processor {
746747
// diverge
747748
{
748749
let branch_account = next_account_info(account_info_iter)?;
749-
if !Clock::check_id(branch_account.key) {
750+
if Clock::check_id(branch_account.key) {
751+
// let _stake_authority_info = next_account_info(account_info_iter);
752+
} else {
750753
let stake_authority_info = branch_account;
751754
if !stake_authority_info.is_signer {
752755
return Err(ProgramError::MissingRequiredSignature);
@@ -807,6 +810,7 @@ impl Processor {
807810
let branch_account = next_account_info(account_info_iter)?;
808811
if Clock::check_id(branch_account.key) {
809812
let _stake_history_info = next_account_info(account_info_iter)?;
813+
// let _stake_authority_info = next_account_info(account_info_iter);
810814
} else {
811815
let stake_authority_info = branch_account;
812816
if !stake_authority_info.is_signer {
@@ -951,18 +955,17 @@ impl Processor {
951955
let stake_account_info = next_account_info(account_info_iter)?;
952956

953957
// diverge
954-
let _old_stake_or_withdraw_authority_info = {
958+
{
955959
let branch_account = next_account_info(account_info_iter)?;
956960
if Clock::check_id(branch_account.key) {
957-
next_account_info(account_info_iter)?
961+
let _old_stake_or_withdraw_authority_info = next_account_info(account_info_iter)?;
958962
} else {
959963
let old_stake_or_withdraw_authority_info = branch_account;
960964
if !old_stake_or_withdraw_authority_info.is_signer {
961965
return Err(ProgramError::MissingRequiredSignature);
962966
}
963-
old_stake_or_withdraw_authority_info
964967
}
965-
};
968+
}
966969

967970
// converge
968971
let new_stake_or_withdraw_authority_info = next_account_info(account_info_iter)?;

program/tests/interface.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1033,6 +1033,8 @@ fn test_no_signer_bypass_new_interface() {
10331033
.accounts
10341034
.retain(|account| !is_stake_program_sysvar_or_config(account.pubkey));
10351035

1036+
let instruction = instruction;
1037+
10361038
for i in 0..instruction.accounts.len() {
10371039
if !instruction.accounts[i].is_signer {
10381040
continue;

0 commit comments

Comments
 (0)