Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions p-token/src/entrypoint-runtime-verification.rs
Original file line number Diff line number Diff line change
Expand Up @@ -660,11 +660,6 @@ fn inner_process_remaining_instruction(
#[no_mangle]
pub unsafe extern "C" fn use_tests(acc: &AccountInfo) {
test_ptoken_domain_data(acc, acc, acc);
let _ =
test_validate_owner(unsafe { &*(acc as *const AccountInfo as *const [AccountInfo; 2]) });
let _ = test_validate_owner_multisig(unsafe {
&*(acc as *const AccountInfo as *const [AccountInfo; 5])
});
let acc4 = unsafe { &*(acc as *const AccountInfo as *const [AccountInfo; 4]) };
let idata8 = unsafe { &*(acc as *const AccountInfo as *const [u8; 8]) };
let _ = test_process_burn_multisig_n1(acc4, idata8);
Expand Down Expand Up @@ -779,8 +774,6 @@ include!("../../specs/shared/test_process_transfer.rs");
include!("../../specs/shared/test_process_transfer_multisig.rs");
include!("../../specs/shared/test_process_amount_to_ui_amount.rs");
include!("../../specs/shared/test_process_ui_amount_to_amount.rs");
include!("../../specs/shared/test_validate_owner.rs");
include!("../../specs/shared/test_validate_owner_multisig.rs");

// Withdraw Excess Lamports test harnesses (p-token specific)
include!("../../specs/withdraw-p-token.rs");
2 changes: 0 additions & 2 deletions p-token/test-properties/proofs.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ Proofs to run with `run-proofs.sh -a`:
| Start symbol name |
|------------------------------------------------|
| test_ptoken_domain_data |
| test_validate_owner |
| test_validate_owner_multisig |
| test_process_approve |
| test_process_approve_checked |
| test_process_withdraw_excess_lamports_account |
Expand Down
63 changes: 0 additions & 63 deletions specs/shared/inner_test_validate_owner.rs
Original file line number Diff line number Diff line change
@@ -1,66 +1,3 @@
/// Computes the expected result of mod.rs::validate_owner.
#[inline(never)]
fn expected_validate_owner_result(
expected_owner: &Pubkey,
owner_account_info: &AccountInfo,
tx_signers: &[AccountInfo],
maybe_multisig_is_initialised: Option<Result<bool, ProgramError>>,
) -> Result<(), ProgramError> {
if expected_owner != key!(owner_account_info) {
return Err(ProgramError::Custom(4));
}
// We add the `maybe_multisig_is_initialised.is_some()` to not branch vacuously in the
// non-multisig cases
else if maybe_multisig_is_initialised.is_some()
&& owner_account_info.data_len() == Multisig::LEN
&& (owner!(owner_account_info) == &PROGRAM_ID)
{
// Guaranteed to succeed by `cheatcode_is_multisig`
let multisig_is_initialised = maybe_multisig_is_initialised.unwrap();
if multisig_is_initialised.is_err() {
return Err(ProgramError::InvalidAccountData);
} else if !multisig_is_initialised.unwrap() {
return Err(ProgramError::UninitializedAccount);
} else {
let multisig = get_multisig(owner_account_info);

// Single loop matching the implementation's validate_owner:
// outer over tx_signers, inner over registered keys, with
// matched[position] to prevent double-counting and to skip
// unsigned detection when a position was already claimed.
let mut num_signers: usize = 0;
let mut matched = [false; MAX_SIGNERS as usize];

for potential_signer in tx_signers.iter() {
for (position, registered_key) in
multisig.signers[0..multisig.n as usize].iter().enumerate()
{
if registered_key == key!(potential_signer) && !matched[position] {
if !is_signer!(potential_signer) {
return Err(ProgramError::MissingRequiredSignature);
}
matched[position] = true;
num_signers += 1;
}
}
}

// Check if we have enough signers
if num_signers < multisig.m as usize {
return Err(ProgramError::MissingRequiredSignature);
}

return Ok(());
}
}
// Non-multisig case - check if owner_account_info.is_signer()
else if !is_signer!(owner_account_info) {
return Err(ProgramError::MissingRequiredSignature);
}

Ok(())
}

/// This function encapsulates the specification of validating the signature
/// requirements In particular, code from mod.rs::validate_owner is checked
#[inline(never)]
Expand Down
33 changes: 0 additions & 33 deletions specs/shared/test_validate_owner.rs

This file was deleted.

45 changes: 0 additions & 45 deletions specs/shared/test_validate_owner_multisig.rs

This file was deleted.

Loading