Skip to content

Commit

Permalink
Check upper bound instead of fixed number of instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
LucasSte committed Mar 4, 2025
1 parent ad6be43 commit db6f5af
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions programs/sbf/tests/programs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1697,10 +1697,15 @@ fn test_program_sbf_invoke_in_same_tx_as_deployment() {
);
} else {
let (result, _, _, _) = process_transaction_and_record_inner(&bank, tx);
assert_eq!(
result.unwrap_err(),
TransactionError::InstructionError(37, InstructionError::UnsupportedProgramId),
);
if let TransactionError::InstructionError(instr_no, ty) = result.unwrap_err() {
// Asserting the instruction number as an upper bound, since the quantity of
// instructions depends on the program size, which in turn depends on the SBPF
// versions.
assert!(instr_no <= 38);
assert_eq!(ty, InstructionError::UnsupportedProgramId);
} else {
panic!("Invalid error type");
}
}
}
}
Expand Down

0 comments on commit db6f5af

Please sign in to comment.