Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion runtime/src/message_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ impl PreAccount {
}
if !is_writable // line coverage used to get branch coverage
|| pre.executable()
|| program_id != pre.owner()
|| program_id != post.owner()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need gated?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

n/m. I see #18492 now 😉

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, totally missed that in review. Needs gating because you could set executable to be true and get a successful transaction right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup, realized that as soon as I hit merge ;-).

This covers it: #18492

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, totally missed that in review. Needs gating because you could set executable to be true and get a successful transaction right?

These get easier to see the more cluster deaths you cause 🙂

{
return Err(InstructionError::ExecutableModified);
}
Expand Down Expand Up @@ -1812,6 +1812,21 @@ mod tests {
);
}

#[test]
fn test_verify_account_changes_owner_executable() {
let alice_program_id = solana_sdk::pubkey::new_rand();
let bob_program_id = solana_sdk::pubkey::new_rand();

assert_eq!(
Change::new(&alice_program_id, &alice_program_id)
.owner(&bob_program_id)
.executable(false, true)
.verify(),
Err(InstructionError::ExecutableModified),
"Program should not be able to change owner and executable at the same time"
);
}

#[test]
fn test_process_message_readonly_handling() {
#[derive(Serialize, Deserialize)]
Expand Down