make executable, vote and stake account rent exempt (#6017)

* add missing convenience method

* require vote account to be exempt

* make stake account rent exempt

* making executable rent exempt

* rent will be initialized in genesis

* add test for update_rent
This commit is contained in:
Parth
2019-10-04 02:52:48 +05:30
committed by GitHub
parent cf2bcee607
commit 92ea11fca1
7 changed files with 168 additions and 16 deletions

View File

@@ -1,5 +1,6 @@
use crate::instruction::{AccountMeta, Instruction};
use crate::pubkey::Pubkey;
use crate::sysvar::rent;
#[derive(Serialize, Deserialize, Debug, PartialEq, Eq, Clone)]
pub enum LoaderInstruction {
@@ -15,6 +16,7 @@ pub enum LoaderInstruction {
/// bit of the Account
///
/// * key[0] - the account to prepare for execution
/// * key[1] - rent sysvar account
///
/// The transaction must be signed by key[0]
Finalize,
@@ -40,6 +42,9 @@ pub fn write(
}
pub fn finalize(account_pubkey: &Pubkey, program_id: &Pubkey) -> Instruction {
let account_metas = vec![AccountMeta::new(*account_pubkey, true)];
let account_metas = vec![
AccountMeta::new(*account_pubkey, true),
AccountMeta::new(rent::id(), false),
];
Instruction::new(*program_id, &LoaderInstruction::Finalize, account_metas)
}