From b00fb26098d52c625fb1c738623cd4f9dd2c9f3d Mon Sep 17 00:00:00 2001 From: Sean Young Date: Tue, 4 Jun 2024 13:44:33 +0100 Subject: [PATCH] Fix intermittent test failure in test_deny_executable_write 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 chance. --- programs/sbf/tests/programs.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/programs/sbf/tests/programs.rs b/programs/sbf/tests/programs.rs index fa77f9844da6b1..49e6b27a05f286 100644 --- a/programs/sbf/tests/programs.rs +++ b/programs/sbf/tests/programs.rs @@ -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,