Skip to content

Commit

Permalink
Fix intermittent test failure in test_deny_executable_write (#1588)
Browse files Browse the repository at this point in the history
The test was writing 42 to offset 4 of the program account. The program
is upgradable, so offset 4 is first byte of the account which holds the
actual elf program.

There was a chance that the first byte of the account is 42, in which
case the test passes, because with the non-direct mapping case, you can
write to read only accounts as long as the contents does not change.
  • Loading branch information
seanyoung authored Jun 5, 2024
1 parent 478f190 commit 8c80bda
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion programs/sbf/tests/programs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4451,7 +4451,7 @@ fn test_deny_executable_write() {
];

let mut instruction_data = vec![TEST_WRITE_ACCOUNT, 2];
instruction_data.extend_from_slice(4usize.to_le_bytes().as_ref());
instruction_data.extend_from_slice(3usize.to_le_bytes().as_ref());
instruction_data.push(42);
let instruction = Instruction::new_with_bytes(
invoke_program_id,
Expand Down

0 comments on commit 8c80bda

Please sign in to comment.