Skip to content

Commit ffd21b7

Browse files
authored
Assert result.is_ok() for InitializeMint{2} harnesses (#140)
In checking all branches asserted that the result was either `Err` (an error with specified error code) or `Ok` I found the success case for `InitializeMint{2}` proof harnesses was missing the assertion. This PR adds those assertions.
1 parent 5f5531d commit ffd21b7

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

p-token/src/entrypoint-runtime-verification.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -858,6 +858,8 @@ pub fn test_process_initialize_mint_freeze(
858858
} else if accounts[0].lamports() < minimum_balance {
859859
assert_eq!(result, Err(ProgramError::Custom(0)))
860860
} else {
861+
assert!(result.is_ok());
862+
861863
let mint_new = get_mint(&accounts[0]);
862864
assert!(mint_new.is_initialized().unwrap());
863865
assert_eq!(mint_new.mint_authority().unwrap(), &instruction_data[1..33]);
@@ -914,6 +916,8 @@ pub fn test_process_initialize_mint_no_freeze(
914916
} else if accounts[0].lamports() < minimum_balance {
915917
assert_eq!(result, Err(ProgramError::Custom(0)))
916918
} else {
919+
assert!(result.is_ok());
920+
917921
let mint_new = get_mint(&accounts[0]);
918922
assert!(mint_new.is_initialized().unwrap());
919923
assert_eq!(mint_new.mint_authority().unwrap(), &instruction_data[1..33]);
@@ -2676,6 +2680,8 @@ pub fn test_process_initialize_mint2_freeze(
26762680
} else if accounts[0].lamports() < minimum_balance {
26772681
assert_eq!(result, Err(ProgramError::Custom(0)))
26782682
} else {
2683+
assert!(result.is_ok());
2684+
26792685
let mint_new = get_mint(&accounts[0]);
26802686
assert!(mint_new.is_initialized().unwrap());
26812687
assert_eq!(mint_new.mint_authority().unwrap(), &instruction_data[1..33]);
@@ -2731,6 +2737,8 @@ pub fn test_process_initialize_mint2_no_freeze(
27312737
} else if accounts[0].lamports() < minimum_balance {
27322738
assert_eq!(result, Err(ProgramError::Custom(0)))
27332739
} else {
2740+
assert!(result.is_ok());
2741+
27342742
let mint_new = get_mint(&accounts[0]);
27352743
assert!(mint_new.is_initialized().unwrap());
27362744
assert_eq!(mint_new.mint_authority().unwrap(), &instruction_data[1..33]);

0 commit comments

Comments
 (0)