This commit is contained in:
@@ -182,7 +182,7 @@ pub fn upgrade(
|
||||
&UpgradeableLoaderInstruction::Upgrade,
|
||||
vec![
|
||||
AccountMeta::new(programdata_address, false),
|
||||
AccountMeta::new_readonly(*program_address, false),
|
||||
AccountMeta::new(*program_address, false),
|
||||
AccountMeta::new(*buffer_address, false),
|
||||
AccountMeta::new(*spill_address, false),
|
||||
AccountMeta::new_readonly(sysvar::rent::id(), false),
|
||||
@@ -250,4 +250,45 @@ mod tests {
|
||||
UpgradeableLoaderState::programdata_len(42).unwrap()
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_is_upgrade_instruction() {
|
||||
assert_eq!(
|
||||
false,
|
||||
is_upgrade_instruction(
|
||||
&bincode::serialize(&UpgradeableLoaderInstruction::InitializeBuffer).unwrap()
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
false,
|
||||
is_upgrade_instruction(
|
||||
&bincode::serialize(&UpgradeableLoaderInstruction::Write {
|
||||
offset: 0,
|
||||
bytes: vec![],
|
||||
})
|
||||
.unwrap()
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
false,
|
||||
is_upgrade_instruction(
|
||||
&bincode::serialize(&UpgradeableLoaderInstruction::DeployWithMaxDataLen {
|
||||
max_data_len: 0,
|
||||
})
|
||||
.unwrap()
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
true,
|
||||
is_upgrade_instruction(
|
||||
&bincode::serialize(&UpgradeableLoaderInstruction::Upgrade).unwrap()
|
||||
)
|
||||
);
|
||||
assert_eq!(
|
||||
false,
|
||||
is_upgrade_instruction(
|
||||
&bincode::serialize(&UpgradeableLoaderInstruction::SetAuthority).unwrap()
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@@ -86,8 +86,8 @@ pub enum UpgradeableLoaderInstruction {
|
||||
///
|
||||
/// # Account references
|
||||
/// 0. [writable] The ProgramData account.
|
||||
/// 1. [] The Program account.
|
||||
/// 2. [Writable] The Buffer account where the program data has been
|
||||
/// 1. [writable] The Program account.
|
||||
/// 2. [writable] The Buffer account where the program data has been
|
||||
/// written.
|
||||
/// 3. [writable] The spill account.
|
||||
/// 4. [] Rent sysvar.
|
||||
|
Reference in New Issue
Block a user