Skip to content

Commit

Permalink
Revert "Bump solana_rbpf to version 0.2.13 (solana-labs#18068) (solan…
Browse files Browse the repository at this point in the history
  • Loading branch information
Lichtso committed Nov 17, 2021
1 parent c53174d commit 19fb2e9
Show file tree
Hide file tree
Showing 13 changed files with 371 additions and 114 deletions.
8 changes: 4 additions & 4 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ solana-config-program = { path = "../programs/config", version = "=1.8.5" }
solana-faucet = { path = "../faucet", version = "=1.8.5" }
solana-logger = { path = "../logger", version = "=1.8.5" }
solana-net-utils = { path = "../net-utils", version = "=1.8.5" }
solana_rbpf = "=0.2.13"
solana_rbpf = "=0.2.11"
solana-remote-wallet = { path = "../remote-wallet", version = "=1.8.5" }
solana-sdk = { path = "../sdk", version = "=1.8.5" }
solana-transaction-status = { path = "../transaction-status", version = "=1.8.5" }
Expand Down
17 changes: 4 additions & 13 deletions cli/src/program.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use bip39::{Language, Mnemonic, MnemonicType, Seed};
use clap::{App, AppSettings, Arg, ArgMatches, SubCommand};
use log::*;
use solana_account_decoder::{UiAccountEncoding, UiDataSliceConfig};
use solana_bpf_loader_program::{syscalls::register_syscalls, BpfError, ThisInstructionMeter};
use solana_bpf_loader_program::{bpf_verifier, BpfError, ThisInstructionMeter};
use solana_clap_utils::{self, input_parsers::*, input_validators::*, keypair::*};
use solana_cli_output::{
CliProgram, CliProgramAccountType, CliProgramAuthority, CliProgramBuffer, CliProgramId,
Expand All @@ -24,10 +24,7 @@ use solana_client::{
rpc_filter::{Memcmp, MemcmpEncodedBytes, RpcFilterType},
tpu_client::{TpuClient, TpuClientConfig},
};
use solana_rbpf::{
verifier,
vm::{Config, Executable},
};
use solana_rbpf::vm::{Config, Executable};
use solana_remote_wallet::remote_wallet::RemoteWalletManager;
use solana_sdk::{
account::Account,
Expand All @@ -40,7 +37,6 @@ use solana_sdk::{
message::Message,
native_token::Sol,
packet::PACKET_DATA_SIZE,
process_instruction::MockInvokeContext,
pubkey::Pubkey,
signature::{keypair_from_seed, read_keypair_file, Keypair, Signature, Signer},
system_instruction::{self, SystemError},
Expand Down Expand Up @@ -1987,17 +1983,12 @@ fn read_and_verify_elf(program_location: &str) -> Result<Vec<u8>, Box<dyn std::e
let mut program_data = Vec::new();
file.read_to_end(&mut program_data)
.map_err(|err| format!("Unable to read program file: {}", err))?;
let mut invoke_context = MockInvokeContext::new(vec![]);

// Verify the program
<dyn Executable<BpfError, ThisInstructionMeter>>::from_elf(
&program_data,
Some(verifier::check),
Config {
reject_unresolved_syscalls: true,
..Config::default()
},
register_syscalls(&mut invoke_context).unwrap(),
Some(|x| bpf_verifier::check(x)),
Config::default(),
)
.map_err(|err| format!("ELF error: {}", err))?;

Expand Down
Binary file modified cli/tests/fixtures/noop.so
Binary file not shown.
8 changes: 4 additions & 4 deletions programs/bpf/Cargo.lock

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

2 changes: 1 addition & 1 deletion programs/bpf/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ solana-bpf-loader-program = { path = "../bpf_loader", version = "=1.8.5" }
solana-cli-output = { path = "../../cli-output", version = "=1.8.5" }
solana-logger = { path = "../../logger", version = "=1.8.5" }
solana-measure = { path = "../../measure", version = "=1.8.5" }
solana_rbpf = "=0.2.13"
solana_rbpf = "=0.2.11"
solana-runtime = { path = "../../runtime", version = "=1.8.5" }
solana-sdk = { path = "../../sdk", version = "=1.8.5" }
solana-transaction-status = { path = "../../transaction-status", version = "=1.8.5" }
Expand Down
36 changes: 13 additions & 23 deletions programs/bpf/benches/bpf_loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use solana_bpf_loader_program::{
ThisInstructionMeter,
};
use solana_measure::measure::Measure;
use solana_rbpf::vm::{Config, Executable, InstructionMeter, SyscallRegistry};
use solana_rbpf::vm::{Config, Executable, InstructionMeter};
use solana_runtime::{
bank::Bank,
bank_client::BankClient,
Expand Down Expand Up @@ -79,7 +79,6 @@ fn bench_program_create_executable(bencher: &mut Bencher) {
&elf,
None,
Config::default(),
SyscallRegistry::default(),
)
.unwrap();
});
Expand All @@ -98,13 +97,10 @@ fn bench_program_alu(bencher: &mut Bencher) {
let mut invoke_context = MockInvokeContext::new(vec![]);

let elf = load_elf("bench_alu").unwrap();
let mut executable = <dyn Executable<BpfError, ThisInstructionMeter>>::from_elf(
&elf,
None,
Config::default(),
register_syscalls(&mut invoke_context).unwrap(),
)
.unwrap();
let mut executable =
<dyn Executable<BpfError, ThisInstructionMeter>>::from_elf(&elf, None, Config::default())
.unwrap();
executable.set_syscall_registry(register_syscalls(&mut invoke_context).unwrap());
executable.jit_compile().unwrap();
let compute_meter = invoke_context.get_compute_meter();
let mut instruction_meter = ThisInstructionMeter { compute_meter };
Expand Down Expand Up @@ -229,13 +225,10 @@ fn bench_create_vm(bencher: &mut Bencher) {
.unwrap();

let elf = load_elf("noop").unwrap();
let mut executable = <dyn Executable<BpfError, ThisInstructionMeter>>::from_elf(
&elf,
None,
Config::default(),
register_syscalls(&mut invoke_context).unwrap(),
)
.unwrap();
let mut executable =
<dyn Executable<BpfError, ThisInstructionMeter>>::from_elf(&elf, None, Config::default())
.unwrap();
executable.set_syscall_registry(register_syscalls(&mut invoke_context).unwrap());

bencher.iter(|| {
let _ = create_vm(
Expand Down Expand Up @@ -280,13 +273,10 @@ fn bench_instruction_count_tuner(_bencher: &mut Bencher) {
.unwrap();

let elf = load_elf("tuner").unwrap();
let executable = <dyn Executable<BpfError, ThisInstructionMeter>>::from_elf(
&elf,
None,
Config::default(),
register_syscalls(&mut invoke_context).unwrap(),
)
.unwrap();
let mut executable =
<dyn Executable<BpfError, ThisInstructionMeter>>::from_elf(&elf, None, Config::default())
.unwrap();
executable.set_syscall_registry(register_syscalls(&mut invoke_context).unwrap());
let compute_meter = invoke_context.get_compute_meter();
let mut instruction_meter = ThisInstructionMeter { compute_meter };
let mut vm = create_vm(
Expand Down
14 changes: 6 additions & 8 deletions programs/bpf/tests/programs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,16 +211,14 @@ fn run_program(
let mut instruction_meter = ThisInstructionMeter { compute_meter };

let config = Config {
max_call_depth: 20,
stack_frame_size: 4096,
enable_instruction_meter: true,
enable_instruction_tracing: true,
..Config::default()
};
let mut executable = <dyn Executable<BpfError, ThisInstructionMeter>>::from_elf(
&data,
None,
config,
register_syscalls(&mut invoke_context).unwrap(),
)
.unwrap();
let mut executable =
<dyn Executable<BpfError, ThisInstructionMeter>>::from_elf(&data, None, config).unwrap();
executable.set_syscall_registry(register_syscalls(&mut invoke_context).unwrap());
executable.jit_compile().unwrap();

let mut instruction_count = 0;
Expand Down
2 changes: 1 addition & 1 deletion programs/bpf_loader/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ sha3 = "0.9.1"
solana-measure = { path = "../../measure", version = "=1.8.5" }
solana-runtime = { path = "../../runtime", version = "=1.8.5" }
solana-sdk = { path = "../../sdk", version = "=1.8.5" }
solana_rbpf = "=0.2.13"
solana_rbpf = "=0.2.11"
thiserror = "1.0"

[dev-dependencies]
Expand Down
Loading

0 comments on commit 19fb2e9

Please sign in to comment.