Skip to content

Commit 6e1ef2d

Browse files
committed
apply #126: Changed inner_test_validate_owner to return Ok(())
1 parent 3d1d9bd commit 6e1ef2d

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

program/src/entrypoint-runtime-verification.rs

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -248,8 +248,11 @@ fn inner_test_validate_owner(
248248

249249
if expected_owner != owner_account_info.key {
250250
assert_eq!(result, Err(ProgramError::Custom(4)));
251-
result
252-
} else if maybe_multisig_is_initialised.is_some()
251+
return result;
252+
}
253+
// We add the `maybe_multisig_is_initialised.is_some()` to not branch vacuously in the
254+
// non-multisig cases
255+
else if maybe_multisig_is_initialised.is_some()
253256
&& owner_account_info.data_len() == Multisig::LEN
254257
&& owner_account_info.owner == &id()
255258
{
@@ -287,13 +290,15 @@ fn inner_test_validate_owner(
287290
return result;
288291
}
289292

290-
result
291-
} else if !owner_account_info.is_signer {
293+
return Ok(());
294+
}
295+
// Non-multisig case - check if owner_account_info.is_signer
296+
else if !owner_account_info.is_signer {
292297
assert_eq!(result, Err(ProgramError::MissingRequiredSignature));
293-
result
294-
} else {
295-
result
298+
return result;
296299
}
300+
301+
Ok(())
297302
}
298303

299304
// TODO: Not sure if these are needed since there is no UB like p-token

0 commit comments

Comments
 (0)