Revert "Bumps solana_rbpf to v0.2.16 (#21492)"
This reverts commit f04e06e0c2
.
This commit is contained in:
5
Cargo.lock
generated
5
Cargo.lock
generated
@ -5898,9 +5898,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "solana_rbpf"
|
||||
version = "0.2.16"
|
||||
version = "0.2.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3af7860a2bf51e63a07c4098966b1c80e8cbfdab3cf4ac36aac7fdd80ea1094c"
|
||||
checksum = "dc53d7522cccfd4a86a82a2fad79328002b70910d944f5be3ba72ac96c64c518"
|
||||
dependencies = [
|
||||
"byteorder",
|
||||
"combine",
|
||||
@ -5913,6 +5913,7 @@ dependencies = [
|
||||
"scroll",
|
||||
"thiserror",
|
||||
"time 0.1.43",
|
||||
"version_check 0.9.2",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -40,7 +40,7 @@ solana-config-program = { path = "../programs/config", version = "=1.8.7" }
|
||||
solana-faucet = { path = "../faucet", version = "=1.8.7" }
|
||||
solana-logger = { path = "../logger", version = "=1.8.7" }
|
||||
solana-net-utils = { path = "../net-utils", version = "=1.8.7" }
|
||||
solana_rbpf = "=0.2.16"
|
||||
solana_rbpf = "=0.2.15"
|
||||
solana-remote-wallet = { path = "../remote-wallet", version = "=1.8.7" }
|
||||
solana-sdk = { path = "../sdk", version = "=1.8.7" }
|
||||
solana-transaction-status = { path = "../transaction-status", version = "=1.8.7" }
|
||||
|
@ -24,7 +24,10 @@ use {
|
||||
rpc_filter::{Memcmp, MemcmpEncodedBytes, RpcFilterType},
|
||||
tpu_client::{TpuClient, TpuClientConfig},
|
||||
},
|
||||
solana_rbpf::{elf::Executable, verifier, vm::Config},
|
||||
solana_rbpf::{
|
||||
verifier,
|
||||
vm::{Config, Executable},
|
||||
},
|
||||
solana_remote_wallet::remote_wallet::RemoteWalletManager,
|
||||
solana_sdk::{
|
||||
account::Account,
|
||||
@ -1986,7 +1989,7 @@ fn read_and_verify_elf(program_location: &str) -> Result<Vec<u8>, Box<dyn std::e
|
||||
let mut invoke_context = MockInvokeContext::new(vec![]);
|
||||
|
||||
// Verify the program
|
||||
Executable::<BpfError, ThisInstructionMeter>::from_elf(
|
||||
<dyn Executable<BpfError, ThisInstructionMeter>>::from_elf(
|
||||
&program_data,
|
||||
Some(verifier::check),
|
||||
Config {
|
||||
|
5
programs/bpf/Cargo.lock
generated
5
programs/bpf/Cargo.lock
generated
@ -3698,9 +3698,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "solana_rbpf"
|
||||
version = "0.2.16"
|
||||
version = "0.2.15"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3af7860a2bf51e63a07c4098966b1c80e8cbfdab3cf4ac36aac7fdd80ea1094c"
|
||||
checksum = "dc53d7522cccfd4a86a82a2fad79328002b70910d944f5be3ba72ac96c64c518"
|
||||
dependencies = [
|
||||
"byteorder 1.3.4",
|
||||
"combine",
|
||||
@ -3713,6 +3713,7 @@ dependencies = [
|
||||
"scroll",
|
||||
"thiserror",
|
||||
"time",
|
||||
"version_check",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
|
@ -30,7 +30,7 @@ solana-bpf-loader-program = { path = "../bpf_loader", version = "=1.8.7" }
|
||||
solana-cli-output = { path = "../../cli-output", version = "=1.8.7" }
|
||||
solana-logger = { path = "../../logger", version = "=1.8.7" }
|
||||
solana-measure = { path = "../../measure", version = "=1.8.7" }
|
||||
solana_rbpf = "=0.2.16"
|
||||
solana_rbpf = "=0.2.15"
|
||||
solana-runtime = { path = "../../runtime", version = "=1.8.7" }
|
||||
solana-sdk = { path = "../../sdk", version = "=1.8.7" }
|
||||
solana-transaction-status = { path = "../../transaction-status", version = "=1.8.7" }
|
||||
|
@ -11,7 +11,7 @@ use solana_bpf_loader_program::{
|
||||
ThisInstructionMeter,
|
||||
};
|
||||
use solana_measure::measure::Measure;
|
||||
use solana_rbpf::{elf::Executable, vm::{Config, InstructionMeter, SyscallRegistry}};
|
||||
use solana_rbpf::vm::{Config, Executable, InstructionMeter, SyscallRegistry};
|
||||
use solana_runtime::{
|
||||
bank::Bank,
|
||||
bank_client::BankClient,
|
||||
@ -75,7 +75,7 @@ fn bench_program_create_executable(bencher: &mut Bencher) {
|
||||
let elf = load_elf("bench_alu").unwrap();
|
||||
|
||||
bencher.iter(|| {
|
||||
let _ = Executable::<BpfError, ThisInstructionMeter>::from_elf(
|
||||
let _ = <dyn Executable<BpfError, ThisInstructionMeter>>::from_elf(
|
||||
&elf,
|
||||
None,
|
||||
Config::default(),
|
||||
@ -98,7 +98,7 @@ fn bench_program_alu(bencher: &mut Bencher) {
|
||||
let mut invoke_context = MockInvokeContext::new(vec![]);
|
||||
|
||||
let elf = load_elf("bench_alu").unwrap();
|
||||
let mut executable = Executable::<BpfError, ThisInstructionMeter>::from_elf(
|
||||
let mut executable = <dyn Executable<BpfError, ThisInstructionMeter>>::from_elf(
|
||||
&elf,
|
||||
None,
|
||||
Config::default(),
|
||||
@ -110,7 +110,7 @@ fn bench_program_alu(bencher: &mut Bencher) {
|
||||
let mut instruction_meter = ThisInstructionMeter { compute_meter };
|
||||
let mut vm = create_vm(
|
||||
&loader_id,
|
||||
&executable,
|
||||
executable.as_ref(),
|
||||
&mut inner_iter,
|
||||
&mut invoke_context,
|
||||
)
|
||||
@ -229,7 +229,7 @@ fn bench_create_vm(bencher: &mut Bencher) {
|
||||
.unwrap();
|
||||
|
||||
let elf = load_elf("noop").unwrap();
|
||||
let executable = Executable::<BpfError, ThisInstructionMeter>::from_elf(
|
||||
let executable = <dyn Executable<BpfError, ThisInstructionMeter>>::from_elf(
|
||||
&elf,
|
||||
None,
|
||||
Config::default(),
|
||||
@ -240,7 +240,7 @@ fn bench_create_vm(bencher: &mut Bencher) {
|
||||
bencher.iter(|| {
|
||||
let _ = create_vm(
|
||||
&loader_id,
|
||||
&executable,
|
||||
executable.as_ref(),
|
||||
serialized.as_slice_mut(),
|
||||
&mut invoke_context,
|
||||
)
|
||||
@ -280,7 +280,7 @@ fn bench_instruction_count_tuner(_bencher: &mut Bencher) {
|
||||
.unwrap();
|
||||
|
||||
let elf = load_elf("tuner").unwrap();
|
||||
let executable = Executable::<BpfError, ThisInstructionMeter>::from_elf(
|
||||
let executable = <dyn Executable<BpfError, ThisInstructionMeter>>::from_elf(
|
||||
&elf,
|
||||
None,
|
||||
Config::default(),
|
||||
@ -291,7 +291,7 @@ fn bench_instruction_count_tuner(_bencher: &mut Bencher) {
|
||||
let mut instruction_meter = ThisInstructionMeter { compute_meter };
|
||||
let mut vm = create_vm(
|
||||
&loader_id,
|
||||
&executable,
|
||||
executable.as_ref(),
|
||||
serialized.as_slice_mut(),
|
||||
&mut invoke_context,
|
||||
)
|
||||
|
@ -16,9 +16,8 @@ use solana_bpf_loader_program::{
|
||||
};
|
||||
use solana_cli_output::display::println_transaction;
|
||||
use solana_rbpf::{
|
||||
elf::Executable,
|
||||
static_analysis::Analysis,
|
||||
vm::{Config, Tracer},
|
||||
vm::{Config, Executable, Tracer},
|
||||
};
|
||||
use solana_runtime::{
|
||||
bank::{Bank, ExecuteTimings, NonceRollbackInfo, TransactionBalancesSet, TransactionResults},
|
||||
@ -215,7 +214,7 @@ fn run_program(
|
||||
enable_instruction_tracing: true,
|
||||
..Config::default()
|
||||
};
|
||||
let mut executable = Executable::<BpfError, ThisInstructionMeter>::from_elf(
|
||||
let mut executable = <dyn Executable<BpfError, ThisInstructionMeter>>::from_elf(
|
||||
&data,
|
||||
None,
|
||||
config,
|
||||
@ -233,7 +232,7 @@ fn run_program(
|
||||
|
||||
let mut vm = create_vm(
|
||||
&loader_id,
|
||||
&executable,
|
||||
executable.as_ref(),
|
||||
parameter_bytes.as_slice_mut(),
|
||||
&mut invoke_context,
|
||||
)
|
||||
@ -251,7 +250,7 @@ fn run_program(
|
||||
if config.enable_instruction_tracing {
|
||||
if i == 1 {
|
||||
if !Tracer::compare(tracer.as_ref().unwrap(), vm.get_tracer()) {
|
||||
let analysis = Analysis::from_executable(&executable);
|
||||
let analysis = Analysis::from_executable(executable.as_ref());
|
||||
let stdout = std::io::stdout();
|
||||
println!("TRACE (interpreted):");
|
||||
tracer
|
||||
@ -265,7 +264,7 @@ fn run_program(
|
||||
.unwrap();
|
||||
assert!(false);
|
||||
} else if log_enabled!(Trace) {
|
||||
let analysis = Analysis::from_executable(&executable);
|
||||
let analysis = Analysis::from_executable(executable.as_ref());
|
||||
let mut trace_buffer = Vec::<u8>::new();
|
||||
tracer
|
||||
.as_ref()
|
||||
|
@ -21,7 +21,7 @@ sha3 = "0.9.1"
|
||||
solana-measure = { path = "../../measure", version = "=1.8.7" }
|
||||
solana-runtime = { path = "../../runtime", version = "=1.8.7" }
|
||||
solana-sdk = { path = "../../sdk", version = "=1.8.7" }
|
||||
solana_rbpf = "=0.2.16"
|
||||
solana_rbpf = "=0.2.15"
|
||||
thiserror = "1.0"
|
||||
|
||||
[dev-dependencies]
|
||||
|
@ -18,11 +18,10 @@ use {
|
||||
solana_rbpf::{
|
||||
aligned_memory::AlignedMemory,
|
||||
ebpf::HOST_ALIGN,
|
||||
elf::Executable,
|
||||
error::{EbpfError, UserDefinedError},
|
||||
static_analysis::Analysis,
|
||||
verifier::{self, VerifierError},
|
||||
vm::{Config, EbpfVm, InstructionMeter},
|
||||
vm::{Config, EbpfVm, Executable, InstructionMeter},
|
||||
},
|
||||
solana_runtime::message_processor::MessageProcessor,
|
||||
solana_sdk::{
|
||||
@ -102,7 +101,12 @@ pub fn create_executor(
|
||||
let program = keyed_account_at_index(keyed_accounts, program_account_index)?;
|
||||
let account = program.try_account_ref()?;
|
||||
let data = &account.data()[program_data_offset..];
|
||||
Executable::<BpfError, ThisInstructionMeter>::from_elf(data, None, config, syscall_registry)
|
||||
<dyn Executable<BpfError, ThisInstructionMeter>>::from_elf(
|
||||
data,
|
||||
None,
|
||||
config,
|
||||
syscall_registry,
|
||||
)
|
||||
}
|
||||
.map_err(|e| map_ebpf_error(invoke_context, e))?;
|
||||
let text_bytes = executable.get_text_bytes().1;
|
||||
@ -150,7 +154,7 @@ fn check_loader_id(id: &Pubkey) -> bool {
|
||||
/// Create the BPF virtual machine
|
||||
pub fn create_vm<'a>(
|
||||
loader_id: &'a Pubkey,
|
||||
program: &'a Executable<BpfError, ThisInstructionMeter>,
|
||||
program: &'a dyn Executable<BpfError, ThisInstructionMeter>,
|
||||
parameter_bytes: &mut [u8],
|
||||
invoke_context: &'a mut dyn InvokeContext,
|
||||
) -> Result<EbpfVm<'a, BpfError, ThisInstructionMeter>, EbpfError<BpfError>> {
|
||||
@ -872,7 +876,7 @@ impl InstructionMeter for ThisInstructionMeter {
|
||||
|
||||
/// BPF Loader's Executor implementation
|
||||
pub struct BpfExecutor {
|
||||
executable: Executable<BpfError, ThisInstructionMeter>,
|
||||
executable: Box<dyn Executable<BpfError, ThisInstructionMeter>>,
|
||||
}
|
||||
|
||||
// Well, implement Debug for solana_rbpf::vm::Executable in solana-rbpf...
|
||||
@ -909,7 +913,7 @@ impl Executor for BpfExecutor {
|
||||
let compute_meter = invoke_context.get_compute_meter();
|
||||
let mut vm = match create_vm(
|
||||
loader_id,
|
||||
&self.executable,
|
||||
self.executable.as_ref(),
|
||||
parameter_bytes.as_slice_mut(),
|
||||
invoke_context,
|
||||
) {
|
||||
@ -940,7 +944,7 @@ impl Executor for BpfExecutor {
|
||||
);
|
||||
if log_enabled!(Trace) {
|
||||
let mut trace_buffer = Vec::<u8>::new();
|
||||
let analysis = Analysis::from_executable(&self.executable);
|
||||
let analysis = Analysis::from_executable(self.executable.as_ref());
|
||||
vm.get_tracer().write(&mut trace_buffer, &analysis).unwrap();
|
||||
let trace_string = String::from_utf8(trace_buffer).unwrap();
|
||||
trace!("BPF Program Instruction Trace:\n{}", trace_string);
|
||||
@ -1052,9 +1056,8 @@ mod tests {
|
||||
];
|
||||
let input = &mut [0x00];
|
||||
let mut bpf_functions = std::collections::BTreeMap::<u32, (usize, String)>::new();
|
||||
solana_rbpf::elf::register_bpf_function(&mut bpf_functions, 0, "entrypoint", false)
|
||||
.unwrap();
|
||||
let program = Executable::<BpfError, TestInstructionMeter>::from_text_bytes(
|
||||
solana_rbpf::elf::register_bpf_function(&mut bpf_functions, 0, "entrypoint").unwrap();
|
||||
let program = <dyn Executable<BpfError, TestInstructionMeter>>::from_text_bytes(
|
||||
program,
|
||||
None,
|
||||
Config::default(),
|
||||
@ -1063,7 +1066,8 @@ mod tests {
|
||||
)
|
||||
.unwrap();
|
||||
let mut vm =
|
||||
EbpfVm::<BpfError, TestInstructionMeter>::new(&program, &mut [], input).unwrap();
|
||||
EbpfVm::<BpfError, TestInstructionMeter>::new(program.as_ref(), &mut [], input)
|
||||
.unwrap();
|
||||
let mut instruction_meter = TestInstructionMeter { remaining: 10 };
|
||||
vm.execute_program_interpreted(&mut instruction_meter)
|
||||
.unwrap();
|
||||
|
@ -7,10 +7,9 @@ use solana_bpf_loader_program::{
|
||||
};
|
||||
use solana_rbpf::{
|
||||
assembler::assemble,
|
||||
elf::Executable,
|
||||
static_analysis::Analysis,
|
||||
verifier::check,
|
||||
vm::{Config, DynamicAnalysis},
|
||||
vm::{Config, DynamicAnalysis, Executable},
|
||||
};
|
||||
use solana_sdk::{
|
||||
account::AccountSharedData,
|
||||
@ -188,7 +187,7 @@ native machine code before execting it in the virtual machine.",
|
||||
file.read_to_end(&mut contents).unwrap();
|
||||
let syscall_registry = register_syscalls(&mut invoke_context).unwrap();
|
||||
let mut executable = if magic == [0x7f, 0x45, 0x4c, 0x46] {
|
||||
Executable::<BpfError, ThisInstructionMeter>::from_elf(
|
||||
<dyn Executable<BpfError, ThisInstructionMeter>>::from_elf(
|
||||
&contents,
|
||||
None,
|
||||
config,
|
||||
@ -210,7 +209,7 @@ native machine code before execting it in the virtual machine.",
|
||||
check(text_bytes, &config).unwrap();
|
||||
}
|
||||
executable.jit_compile().unwrap();
|
||||
let analysis = Analysis::from_executable(&executable);
|
||||
let analysis = Analysis::from_executable(executable.as_ref());
|
||||
|
||||
match matches.value_of("use") {
|
||||
Some("cfg") => {
|
||||
@ -227,7 +226,7 @@ native machine code before execting it in the virtual machine.",
|
||||
}
|
||||
|
||||
let id = bpf_loader::id();
|
||||
let mut vm = create_vm(&id, &executable, &mut mem, &mut invoke_context).unwrap();
|
||||
let mut vm = create_vm(&id, executable.as_ref(), &mut mem, &mut invoke_context).unwrap();
|
||||
let result = if matches.value_of("use").unwrap() == "interpreter" {
|
||||
vm.execute_program_interpreted(&mut instruction_meter)
|
||||
} else {
|
||||
@ -245,7 +244,7 @@ native machine code before execting it in the virtual machine.",
|
||||
if matches.is_present("trace") {
|
||||
println!("Trace is saved in trace.out");
|
||||
let mut file = File::create("trace.out").unwrap();
|
||||
let analysis = Analysis::from_executable(&executable);
|
||||
let analysis = Analysis::from_executable(executable.as_ref());
|
||||
vm.get_tracer().write(&mut file, &analysis).unwrap();
|
||||
}
|
||||
if matches.is_present("profile") {
|
||||
|
Reference in New Issue
Block a user