Remove sysvar special cases for rent and assign

This commit is contained in:
Ryo Onodera
2021-05-18 00:30:48 +09:00
committed by Michael Vines
parent fd574dcb3b
commit f029af0fca
7 changed files with 513 additions and 33 deletions

View File

@ -163,6 +163,10 @@ pub mod neon_evm_compute_budget {
solana_sdk::declare_id!("GLrVvDPkQi5PMYUrsYWT9doZhSHr1BVZXqj5DbFps3rS");
}
pub mod rent_for_sysvars {
solana_sdk::declare_id!("BKCPBQQBZqggVnFso5nQ8rQ4RwwogYwjuUt9biBjxwNF");
}
lazy_static! {
/// Map of feature identifiers to user-visible description
pub static ref FEATURE_NAMES: HashMap<Pubkey, &'static str> = [
@ -203,6 +207,7 @@ lazy_static! {
(vote_stake_checked_instructions::id(), "vote/state program checked instructions #18345"),
(updated_verify_policy::id(), "Update verify policy"),
(neon_evm_compute_budget::id(), "bump neon_evm's compute budget"),
(rent_for_sysvars::id(), "collect rent from accounts owned by sysvars"),
/*************** ADD NEW FEATURES HERE ***************/
]
.iter()

View File

@ -334,6 +334,7 @@ pub struct MockInvokeContext<'a> {
pub programs: Vec<(Pubkey, ProcessInstructionWithContext)>,
pub accounts: Vec<(Pubkey, Rc<RefCell<AccountSharedData>>)>,
pub sysvars: Vec<(Pubkey, Option<Rc<Vec<u8>>>)>,
pub feature_active: bool,
}
impl<'a> MockInvokeContext<'a> {
pub fn new(keyed_accounts: Vec<KeyedAccount<'a>>) -> Self {
@ -348,6 +349,7 @@ impl<'a> MockInvokeContext<'a> {
programs: vec![],
accounts: vec![],
sysvars: vec![],
feature_active: true,
};
invoke_context
.invoke_stack
@ -442,7 +444,7 @@ impl<'a> InvokeContext for MockInvokeContext<'a> {
}
fn record_instruction(&self, _instruction: &Instruction) {}
fn is_feature_active(&self, _feature_id: &Pubkey) -> bool {
true
self.feature_active
}
fn get_account(&self, pubkey: &Pubkey) -> Option<Rc<RefCell<AccountSharedData>>> {
for (key, account) in self.accounts.iter() {