Skip to content

Commit ed31dd6

Browse files
committed
review all the diff between p-token's here and p-token's proofs branch
1 parent ce456e3 commit ed31dd6

13 files changed

+31
-31
lines changed

specs/prelude-p-token.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ macro_rules! is_signer {
2424

2525
macro_rules! assert_pubkey_from_slice {
2626
($actual:expr, $slice:expr) => {{
27-
assert_eq!(&$actual[..], &$slice[..]);
27+
assert_eq!($actual, $slice);
2828
}};
2929
}
3030

specs/shared/test_process_burn.rs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/// accounts[2] // Authority Info
44
/// instruction_data[0..8] // Little Endian Bytes of u64 amount
55
#[inline(never)]
6-
fn test_process_burn(accounts: &[AccountInfo; 3], instruction_data: &[u8; 8]) -> ProgramResult {
6+
pub fn test_process_burn(accounts: &[AccountInfo; 3], instruction_data: &[u8; 8]) -> ProgramResult {
77
cheatcode_account!(&accounts[0]);
88
cheatcode_mint!(&accounts[1]);
99
cheatcode_account!(&accounts[2]); // Excluding the multisig case
@@ -22,11 +22,13 @@ fn test_process_burn(accounts: &[AccountInfo; 3], instruction_data: &[u8; 8]) ->
2222
let src_mint = src_old.mint;
2323
let src_owned_sys_inc = src_old.is_owned_by_system_program_or_incinerator();
2424
let src_owner = src_old.owner;
25+
let src_info_owner = owner!(&accounts[0]);
2526
let old_src_delgate = src_old.delegate().cloned();
2627
let old_src_delgated_amount = src_old.delegated_amount();
2728
let mint_initialised = mint_old.is_initialized();
2829
let mint_init_supply = mint_old.supply();
29-
let maybe_multisig_is_initialised = None;
30+
let mint_info_owner = *owner!(&accounts[1]);
31+
let maybe_multisig_is_initialised = None; // Value set to `None` since authority is an account
3032

3133
#[cfg(feature = "assumptions")]
3234
if !(src_init_amount <= mint_init_supply && old_src_delgated_amount <= src_init_amount) {
@@ -87,9 +89,9 @@ fn test_process_burn(accounts: &[AccountInfo; 3], instruction_data: &[u8; 8]) ->
8789
}
8890
}
8991

90-
if amount == 0 && !(owner!(&accounts[0]) == &PROGRAM_ID) {
92+
if amount == 0 && *src_info_owner != PROGRAM_ID {
9193
assert_eq!(result, Err(ProgramError::IncorrectProgramId))
92-
} else if amount == 0 && !(owner!(&accounts[1]) == &PROGRAM_ID) {
94+
} else if amount == 0 && mint_info_owner != PROGRAM_ID {
9395
assert_eq!(result, Err(ProgramError::IncorrectProgramId))
9496
} else {
9597
let src_new = get_account(&accounts[0]);

specs/shared/test_process_burn_checked.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
/// accounts[2] // Authority Info
44
/// instruction_data[0..9] // Little Endian Bytes of u64 amount, and decimals
55
#[inline(never)]
6-
fn test_process_burn_checked(
6+
pub fn test_process_burn_checked(
77
accounts: &[AccountInfo; 3],
88
instruction_data: &[u8; 9],
99
) -> ProgramResult {
@@ -31,7 +31,7 @@ fn test_process_burn_checked(
3131
let mint_initialised = mint_old.is_initialized();
3232
let mint_init_supply = mint_old.supply();
3333
let mint_decimals = mint_old.decimals;
34-
let mint_info_owner = owner!(&accounts[1]);
34+
let mint_info_owner = *owner!(&accounts[1]);
3535
let maybe_multisig_is_initialised = None; // Value set to `None` since authority is an account
3636

3737
#[cfg(feature = "assumptions")]
@@ -99,9 +99,9 @@ fn test_process_burn_checked(
9999
}
100100
}
101101

102-
if amount == 0 && src_info_owner != &PROGRAM_ID {
102+
if amount == 0 && *src_info_owner != PROGRAM_ID {
103103
assert_eq!(result, Err(ProgramError::IncorrectProgramId))
104-
} else if amount == 0 && mint_info_owner != &PROGRAM_ID {
104+
} else if amount == 0 && mint_info_owner != PROGRAM_ID {
105105
assert_eq!(result, Err(ProgramError::IncorrectProgramId))
106106
} else {
107107
let src_new = get_account(&accounts[0]);

specs/shared/test_process_initialize_mint2_freeze.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ pub fn test_process_initialize_mint2_freeze(
3737

3838
let mint_new = get_mint(&accounts[0]);
3939
assert!(mint_new.is_initialized().unwrap());
40-
assert_pubkey_from_slice!(*mint_new.mint_authority().unwrap(), &instruction_data[1..33]);
40+
assert_pubkey_from_slice!(mint_new.mint_authority().unwrap(), &instruction_data[1..33]);
4141
assert_eq!(mint_new.decimals, instruction_data[0]);
4242

4343
if instruction_data[33] == 1 {
44-
assert_pubkey_from_slice!(*mint_new.freeze_authority().unwrap(), &instruction_data[34..66]);
44+
assert_pubkey_from_slice!(mint_new.freeze_authority().unwrap(), &instruction_data[34..66]);
4545
}
4646
}
4747

specs/shared/test_process_initialize_mint2_no_freeze.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,13 @@ pub fn test_process_initialize_mint2_no_freeze(
3737

3838
let mint_new = get_mint(&accounts[0]);
3939
assert!(mint_new.is_initialized().unwrap());
40-
assert_pubkey_from_slice!(*mint_new.mint_authority().unwrap(), &instruction_data[1..33]);
40+
assert_pubkey_from_slice!(mint_new.mint_authority().unwrap(), &instruction_data[1..33]);
4141
assert_eq!(mint_new.decimals, instruction_data[0]);
4242

4343
#[allow(clippy::out_of_bounds_indexing)]
4444
// Guard above prevents this branch TODO: Perhaps remove?
4545
if instruction_data[33] == 1 {
46-
assert_pubkey_from_slice!(*mint_new.freeze_authority().unwrap(), &instruction_data[34..66]);
46+
assert_pubkey_from_slice!(mint_new.freeze_authority().unwrap(), &instruction_data[34..66]);
4747
}
4848
}
4949

specs/shared/test_process_initialize_mint_freeze.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,11 +44,11 @@ fn test_process_initialize_mint_freeze(
4444

4545
let mint_new = get_mint(&accounts[0]);
4646
assert!(mint_new.is_initialized().unwrap());
47-
assert_pubkey_from_slice!(*mint_new.mint_authority().unwrap(), &instruction_data[1..33]);
47+
assert_pubkey_from_slice!(mint_new.mint_authority().unwrap(), &instruction_data[1..33]);
4848
assert_eq!(mint_new.decimals, instruction_data[0]);
4949

5050
if instruction_data[33] == 1 {
51-
assert_pubkey_from_slice!(*mint_new.freeze_authority().unwrap(), &instruction_data[34..66]);
51+
assert_pubkey_from_slice!(mint_new.freeze_authority().unwrap(), &instruction_data[34..66]);
5252
}
5353
}
5454

specs/shared/test_process_initialize_mint_no_freeze.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ fn test_process_initialize_mint_no_freeze(
4242

4343
let mint_new = get_mint(&accounts[0]);
4444
assert!(mint_new.is_initialized().unwrap());
45-
assert_pubkey_from_slice!(*mint_new.mint_authority().unwrap(), &instruction_data[1..33]);
45+
assert_pubkey_from_slice!(mint_new.mint_authority().unwrap(), &instruction_data[1..33]);
4646
assert_eq!(mint_new.decimals, instruction_data[0]);
4747

4848
#[allow(clippy::out_of_bounds_indexing)]
4949
// Guard above prevents this branch TODO: Perhaps remove?
5050
if instruction_data[33] == 1 {
51-
assert_pubkey_from_slice!(*mint_new.freeze_authority().unwrap(), &instruction_data[34..66]);
51+
assert_pubkey_from_slice!(mint_new.freeze_authority().unwrap(), &instruction_data[34..66]);
5252
}
5353
}
5454

specs/shared/test_process_set_authority_account.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ fn test_process_set_authority_account(
9898

9999
if instruction_data[1] == 1 {
100100
// 1 ==> 34 <= instruction_data.len()
101-
assert_pubkey_from_slice!(*src_new.close_authority().unwrap(), instruction_data[2..34]);
101+
assert_pubkey_from_slice!(src_new.close_authority().unwrap(), &instruction_data[2..34]);
102102
} else {
103103
assert_eq!(src_new.close_authority(), None);
104104
}

specs/shared/test_process_set_authority_account_multisig.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ fn test_process_set_authority_account_multisig(
9999

100100
if instruction_data[1] == 1 {
101101
// 1 ==> 34 <= instruction_data.len()
102-
assert_pubkey_from_slice!(*src_new.close_authority().unwrap(), instruction_data[2..34]);
102+
assert_pubkey_from_slice!(src_new.close_authority().unwrap(), &instruction_data[2..34]);
103103
} else {
104104
assert_eq!(src_new.close_authority(), None);
105105
}

specs/shared/test_process_set_authority_mint.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ fn test_process_set_authority_mint(
7171

7272
if instruction_data[1] == 1 {
7373
// 1 ==> 34 <= instruction_data.len()
74-
assert_pubkey_from_slice!(*mint_new.mint_authority().unwrap(), instruction_data[2..34]);
74+
assert_pubkey_from_slice!(mint_new.mint_authority().unwrap(), &instruction_data[2..34]);
7575
} else {
7676
assert_eq!(mint_new.mint_authority(), None);
7777
}
@@ -95,7 +95,7 @@ fn test_process_set_authority_mint(
9595

9696
if instruction_data[1] == 1 {
9797
// 1 ==> 34 <= instruction_data.len()
98-
assert_pubkey_from_slice!(*mint_new.freeze_authority().unwrap(), instruction_data[2..34]);
98+
assert_pubkey_from_slice!(mint_new.freeze_authority().unwrap(), &instruction_data[2..34]);
9999
} else {
100100
assert_eq!(mint_new.freeze_authority(), None);
101101
}

0 commit comments

Comments
 (0)