* Update verify policy (#18459)
(cherry picked from commit 44289e6728
)
# Conflicts:
# runtime/src/message_processor.rs
* resolve conflicts
Co-authored-by: Jack May <jack@solana.com>
This commit is contained in:
@ -175,7 +175,7 @@ impl PreAccount {
|
|||||||
}
|
}
|
||||||
if !is_writable // line coverage used to get branch coverage
|
if !is_writable // line coverage used to get branch coverage
|
||||||
|| pre.executable
|
|| pre.executable
|
||||||
|| *program_id != pre.owner
|
|| *program_id != post.owner
|
||||||
{
|
{
|
||||||
return Err(InstructionError::ExecutableModified);
|
return Err(InstructionError::ExecutableModified);
|
||||||
}
|
}
|
||||||
@ -1736,6 +1736,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]
|
#[test]
|
||||||
fn test_process_message_readonly_handling() {
|
fn test_process_message_readonly_handling() {
|
||||||
#[derive(Serialize, Deserialize)]
|
#[derive(Serialize, Deserialize)]
|
||||||
|
Reference in New Issue
Block a user