Skip to content

Commit

Permalink
Add native loader entry points (#9486)
Browse files Browse the repository at this point in the history
  • Loading branch information
jackcmay authored Apr 15, 2020
1 parent 40737e9 commit 241a05f
Show file tree
Hide file tree
Showing 17 changed files with 272 additions and 470 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ regex = "1.3.6"
serde = "1.0.106"
serde_derive = "1.0.103"
serde_json = "1.0.49"
solana-bpf-loader-program = { path = "../programs/bpf_loader", version = "1.2.0" }
solana-budget-program = { path = "../programs/budget", version = "1.2.0" }
solana-clap-utils = { path = "../clap-utils", version = "1.2.0" }
solana-client = { path = "../client", version = "1.2.0" }
Expand Down
3 changes: 3 additions & 0 deletions core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ pub mod verified_vote_packets;
pub mod weighted_shuffle;
pub mod window_service;

#[macro_use]
extern crate solana_bpf_loader_program;

#[macro_use]
extern crate solana_budget_program;

Expand Down
3 changes: 3 additions & 0 deletions core/src/validator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -718,6 +718,9 @@ impl TestValidator {
genesis_config
.native_instruction_processors
.push(solana_budget_program!());
genesis_config
.native_instruction_processors
.push(solana_bpf_loader_program!());

genesis_config.rent.lamports_per_byte_year = 1;
genesis_config.rent.exemption_threshold = 1.0;
Expand Down
69 changes: 34 additions & 35 deletions programs/bpf/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 7 additions & 3 deletions programs/bpf/tests/programs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ mod bpf {
sysvar::{clock, fees, rent, rewards, slot_hashes, stake_history},
transaction::TransactionError,
};
use solana_bpf_loader_program::solana_bpf_loader_program;
use std::{env, fs::File, io::Read, path::PathBuf, sync::Arc};

/// BPF program file extension
Expand Down Expand Up @@ -83,10 +84,11 @@ mod bpf {
println!("Test program: {:?}", program.0);

let GenesisConfigInfo {
genesis_config,
mut genesis_config,
mint_keypair,
..
} = create_genesis_config(50);
genesis_config.native_instruction_processors.push(solana_bpf_loader_program!());
let bank = Arc::new(Bank::new(&genesis_config));
// Create bank with specific slot, used by solana_bpf_rust_sysvar test
let bank =
Expand Down Expand Up @@ -133,10 +135,11 @@ mod bpf {
println!("Test program: {:?}", program);

let GenesisConfigInfo {
genesis_config,
mut genesis_config,
mint_keypair,
..
} = create_genesis_config(50);
genesis_config.native_instruction_processors.push(solana_bpf_loader_program!());
let bank = Arc::new(Bank::new(&genesis_config));
let bank_client = BankClient::new_shared(&bank);
let program_id = load_bpf_program(&bank_client, &mint_keypair, program);
Expand Down Expand Up @@ -215,10 +218,11 @@ mod bpf {
println!("Test program: {:?}", program);

let GenesisConfigInfo {
genesis_config,
mut genesis_config,
mint_keypair,
..
} = create_genesis_config(50);
genesis_config.native_instruction_processors.push(solana_bpf_loader_program!());
let bank = Bank::new(&genesis_config);
let bank_client = BankClient::new(bank);
let program_id = load_bpf_program(&bank_client, &mint_keypair, program);
Expand Down
2 changes: 1 addition & 1 deletion programs/bpf_loader/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use solana_sdk::{
use std::{io::prelude::*, mem};
use thiserror::Error;

solana_sdk::declare_program!(
solana_sdk::declare_loader!(
solana_sdk::bpf_loader::ID,
solana_bpf_loader_program,
process_instruction
Expand Down
Loading

0 comments on commit 241a05f

Please sign in to comment.