Skip to content

Commit db6f5af

Browse files
committed
Check upper bound instead of fixed number of instructions
1 parent ad6be43 commit db6f5af

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

programs/sbf/tests/programs.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1697,10 +1697,15 @@ fn test_program_sbf_invoke_in_same_tx_as_deployment() {
16971697
);
16981698
} else {
16991699
let (result, _, _, _) = process_transaction_and_record_inner(&bank, tx);
1700-
assert_eq!(
1701-
result.unwrap_err(),
1702-
TransactionError::InstructionError(37, InstructionError::UnsupportedProgramId),
1703-
);
1700+
if let TransactionError::InstructionError(instr_no, ty) = result.unwrap_err() {
1701+
// Asserting the instruction number as an upper bound, since the quantity of
1702+
// instructions depends on the program size, which in turn depends on the SBPF
1703+
// versions.
1704+
assert!(instr_no <= 38);
1705+
assert_eq!(ty, InstructionError::UnsupportedProgramId);
1706+
} else {
1707+
panic!("Invalid error type");
1708+
}
17041709
}
17051710
}
17061711
}

0 commit comments

Comments
 (0)