Let native_loader own native executable accounts
This commit is contained in:
@ -13,11 +13,11 @@ pub fn check_id(program_id: &Pubkey) -> bool {
|
|||||||
program_id.as_ref() == NATIVE_LOADER_PROGRAM_ID
|
program_id.as_ref() == NATIVE_LOADER_PROGRAM_ID
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Create an executable account owned by the given program_id and shared object name.
|
/// Create an executable account with the given shared object name.
|
||||||
pub fn create_program_account(program_id: Pubkey, name: &str) -> Account {
|
pub fn create_program_account(name: &str) -> Account {
|
||||||
Account {
|
Account {
|
||||||
tokens: 1,
|
tokens: 1,
|
||||||
owner: program_id,
|
owner: id(),
|
||||||
userdata: name.as_bytes().to_vec(),
|
userdata: name.as_bytes().to_vec(),
|
||||||
executable: true,
|
executable: true,
|
||||||
loader: id(),
|
loader: id(),
|
||||||
|
17
src/bank.rs
17
src/bank.rs
@ -220,18 +220,16 @@ impl Bank {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn add_builtin_programs(&self) {
|
fn add_builtin_programs(&self) {
|
||||||
let system_program_account =
|
let system_program_account = native_loader::create_program_account("solana_system_program");
|
||||||
native_loader::create_program_account(system_program::id(), "solana_system_program");
|
|
||||||
self.accounts
|
self.accounts
|
||||||
.store_slow(true, &system_program::id(), &system_program_account);
|
.store_slow(true, &system_program::id(), &system_program_account);
|
||||||
|
|
||||||
let vote_program_account =
|
let vote_program_account = native_loader::create_program_account("solana_vote_program");
|
||||||
native_loader::create_program_account(vote_program::id(), "solana_vote_program");
|
|
||||||
self.accounts
|
self.accounts
|
||||||
.store_slow(true, &vote_program::id(), &vote_program_account);
|
.store_slow(true, &vote_program::id(), &vote_program_account);
|
||||||
|
|
||||||
let storage_program_account =
|
let storage_program_account =
|
||||||
native_loader::create_program_account(storage_program::id(), "solana_storage_program");
|
native_loader::create_program_account("solana_storage_program");
|
||||||
self.accounts
|
self.accounts
|
||||||
.store_slow(true, &storage_program::id(), &storage_program_account);
|
.store_slow(true, &storage_program::id(), &storage_program_account);
|
||||||
|
|
||||||
@ -239,18 +237,15 @@ impl Bank {
|
|||||||
self.accounts
|
self.accounts
|
||||||
.store_slow(true, &storage_program::system_id(), &storage_system_account);
|
.store_slow(true, &storage_program::system_id(), &storage_system_account);
|
||||||
|
|
||||||
let bpf_loader_account =
|
let bpf_loader_account = native_loader::create_program_account("solana_bpf_loader");
|
||||||
native_loader::create_program_account(bpf_loader::id(), "solana_bpf_loader");
|
|
||||||
self.accounts
|
self.accounts
|
||||||
.store_slow(true, &bpf_loader::id(), &bpf_loader_account);
|
.store_slow(true, &bpf_loader::id(), &bpf_loader_account);
|
||||||
|
|
||||||
let budget_program_account =
|
let budget_program_account = native_loader::create_program_account("solana_budget_program");
|
||||||
native_loader::create_program_account(budget_program::id(), "solana_budget_program");
|
|
||||||
self.accounts
|
self.accounts
|
||||||
.store_slow(true, &budget_program::id(), &budget_program_account);
|
.store_slow(true, &budget_program::id(), &budget_program_account);
|
||||||
|
|
||||||
let erc20_account =
|
let erc20_account = native_loader::create_program_account("solana_erc20");
|
||||||
native_loader::create_program_account(token_program::id(), "solana_erc20");
|
|
||||||
self.accounts
|
self.accounts
|
||||||
.store_slow(true, &token_program::id(), &erc20_account);
|
.store_slow(true, &token_program::id(), &erc20_account);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user