diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index adf5fecd..68562d26 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,4 +1,4 @@ -name: rbpf +name: sbpf on: push: diff --git a/Cargo.lock b/Cargo.lock index 8b9c8a77..b6adf25e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -346,8 +346,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] -name = "solana_rbpf" -version = "0.8.2" +name = "solana-sbpf" +version = "0.9.0" dependencies = [ "arbitrary", "byteorder 1.4.3", @@ -385,10 +385,10 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "test_utils" -version = "0.8.2" +version = "0.9.0" dependencies = [ "libc", - "solana_rbpf", + "solana-sbpf", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index f5537db5..cd0d1c84 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,9 +1,9 @@ [package] -name = "solana_rbpf" -version = "0.8.2" +name = "solana-sbpf" +version = "0.9.0" description = "Virtual machine and JIT compiler for eBPF programs" authors = ["Solana Maintainers "] -repository = "https://github.com/solana-labs/rbpf" +repository = "https://github.com/anza-xyz/sbpf" homepage = "https://solana.com/" keywords = ["BPF", "eBPF", "interpreter", "JIT", "filtering"] license = "Apache-2.0" diff --git a/README.md b/README.md index f1d9e63a..0b5ee51a 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,13 @@ -# solana_rbpf +# solana-sbpf -![](misc/rbpf_256.png) +SBPF virtual machine -Rust (user-space) virtual machine for eBPF - -[![Build Status](https://github.com/solana-labs/rbpf/actions/workflows/main.yml/badge.svg)](https://github.com/solana-labs/rbpf/actions/workflows/main.yml) -[![Crates.io](https://img.shields.io/crates/v/solana_rbpf.svg)](https://crates.io/crates/solana_rbpf) +[![Build Status](https://github.com/anza-xyz/sbpf/actions/workflows/main.yml/badge.svg)](https://github.com/anza-xyz/sbpf/actions/workflows/main.yml) +[![Crates.io](https://img.shields.io/crates/v/solana-sbpf.svg)](https://crates.io/crates/solana-sbpf) ## Description -This is a fork of [RBPF](https://github.com/qmonnet/rbpf) by Quentin Monnet. +This is a fork of [RBPF](https://github.com/solana-labs/rbpf) which in turn is a fork of [RBPF](https://github.com/qmonnet/rbpf) by Quentin Monnet. This crate contains a virtual machine for eBPF program execution. BPF, as in _Berkeley Packet Filter_, is an assembly-like language initially developed for @@ -26,13 +24,13 @@ although the JIT-compiler does not work with Windows at this time. ## Link to the crate -This crate is available from [crates.io](https://crates.io/crates/solana_rbpf), +This crate is available from [crates.io](https://crates.io/crates/solana-sbpf), so it should work out of the box by adding it as a dependency in your `Cargo.toml` file: ```toml [dependencies] -solana_rbpf = "0.8.2" +solana-sbpf = "0.9.0" ``` You can also use the development version from this GitHub repository. This @@ -40,7 +38,7 @@ should be as simple as putting this inside your `Cargo.toml`: ```toml [dependencies] -solana_rbpf = { git = "https://github.com/solana-labs/rbpf", branch = "main" } +solana-sbpf = { git = "https://github.com/anza-xyz/sbpf", branch = "main" } ``` Of course, if you prefer, you can clone it locally, possibly hack the crate, @@ -48,26 +46,26 @@ and then indicate the path of your local version in `Cargo.toml`: ```toml [dependencies] -solana_rbpf = { path = "path/to/solana_rbpf" } +solana-sbpf = { path = "path/to/sbpf" } ``` Then indicate in your source code that you want to use the crate: ```rust,ignore -extern crate solana_rbpf; +extern crate solana_sbpf; ``` ## API The API is pretty well documented inside the source code. You should also be able to access [an online version of the documentation from -here](https://docs.rs/solana_rbpf/), automatically generated from the -[crates.io](https://crates.io/crates/solana_rbpf) +here](https://docs.rs/solana-sbpf/), automatically generated from the +[crates.io](https://crates.io/crates/solana-sbpf) version (may not be up-to-date with master branch). [Examples](examples), [unit tests](tests) and [performance benchmarks](benches) should also prove helpful. -Here are the steps to follow to run an eBPF program with rbpf: +Here are the steps to follow to run an SBPF: 1. Create the config and a loader built-in program, add some functions. 2. Create an executable, either from the bytecode or an ELF. @@ -81,7 +79,7 @@ Here are the steps to follow to run an eBPF program with rbpf: ## Developer ### Dependencies -- rustc version 1.72 or higher +- rustc version 1.83 or higher ### Build and test instructions - To build run `cargo build` @@ -90,7 +88,7 @@ Here are the steps to follow to run an eBPF program with rbpf: ## License Following the effort of the Rust language project itself in order to ease -integration with other projects, the rbpf crate is distributed under the terms +integration with other projects, the sbpf crate is distributed under the terms of both the MIT license and the Apache License (Version 2.0). See [LICENSE-APACHE](LICENSE-APACHE) and [LICENSE-MIT](LICENSE-MIT) for details. diff --git a/benches/elf_loader.rs b/benches/elf_loader.rs index 656c794a..d64c0745 100644 --- a/benches/elf_loader.rs +++ b/benches/elf_loader.rs @@ -6,11 +6,11 @@ #![feature(test)] -extern crate solana_rbpf; +extern crate solana_sbpf; extern crate test; extern crate test_utils; -use solana_rbpf::{ +use solana_sbpf::{ elf::Executable, program::{BuiltinFunction, BuiltinProgram, FunctionRegistry}, syscalls, diff --git a/benches/jit_compile.rs b/benches/jit_compile.rs index cbc7a072..6c7f7b5b 100644 --- a/benches/jit_compile.rs +++ b/benches/jit_compile.rs @@ -6,10 +6,10 @@ #![feature(test)] -extern crate solana_rbpf; +extern crate solana_sbpf; extern crate test; -use solana_rbpf::{ +use solana_sbpf::{ elf::Executable, program::BuiltinProgram, verifier::RequisiteVerifier, vm::TestContextObject, }; use std::{fs::File, io::Read, sync::Arc}; diff --git a/benches/memory_mapping.rs b/benches/memory_mapping.rs index 91e77dee..a2074a96 100644 --- a/benches/memory_mapping.rs +++ b/benches/memory_mapping.rs @@ -7,11 +7,11 @@ #![feature(test)] extern crate rand; -extern crate solana_rbpf; +extern crate solana_sbpf; extern crate test; use rand::{rngs::SmallRng, Rng, SeedableRng}; -use solana_rbpf::{ +use solana_sbpf::{ memory_region::{ AccessType, AlignedMemoryMapping, MemoryRegion, MemoryState, UnalignedMemoryMapping, }, diff --git a/benches/vm_execution.rs b/benches/vm_execution.rs index d39b47c4..45c02690 100644 --- a/benches/vm_execution.rs +++ b/benches/vm_execution.rs @@ -6,17 +6,17 @@ #![feature(test)] -extern crate solana_rbpf; +extern crate solana_sbpf; extern crate test; #[cfg(all(feature = "jit", not(target_os = "windows"), target_arch = "x86_64"))] -use solana_rbpf::{ +use solana_sbpf::{ ebpf, memory_region::MemoryRegion, program::{FunctionRegistry, SBPFVersion}, vm::Config, }; -use solana_rbpf::{ +use solana_sbpf::{ elf::Executable, program::BuiltinProgram, verifier::RequisiteVerifier, vm::TestContextObject, }; use std::{fs::File, io::Read, sync::Arc}; @@ -83,7 +83,7 @@ fn bench_jit_vs_interpreter( instruction_meter: u64, mem: &mut [u8], ) { - let mut executable = solana_rbpf::assembler::assemble::( + let mut executable = solana_sbpf::assembler::assemble::( assembly, Arc::new(BuiltinProgram::new_loader( config, diff --git a/cli/Cargo.lock b/cli/Cargo.lock index 0caf8e1a..c1d74f53 100644 --- a/cli/Cargo.lock +++ b/cli/Cargo.lock @@ -301,11 +301,11 @@ dependencies = [ ] [[package]] -name = "rbpf_cli" -version = "0.8.2" +name = "sbpf_cli" +version = "0.9.0" dependencies = [ "clap", - "solana_rbpf", + "solana-sbpf", "test_utils", ] @@ -322,8 +322,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "04c565b551bafbef4157586fa379538366e4385d42082f255bfd96e4fe8519da" [[package]] -name = "solana_rbpf" -version = "0.8.2" +name = "solana-sbpf" +version = "0.9.0" dependencies = [ "byteorder", "combine", @@ -366,10 +366,10 @@ dependencies = [ [[package]] name = "test_utils" -version = "0.8.2" +version = "0.9.0" dependencies = [ "libc", - "solana_rbpf", + "solana-sbpf", ] [[package]] diff --git a/cli/Cargo.toml b/cli/Cargo.toml index 6aa44a7d..1146356c 100644 --- a/cli/Cargo.toml +++ b/cli/Cargo.toml @@ -1,14 +1,14 @@ [package] -name = "rbpf_cli" -version = "0.8.2" +name = "sbpf_cli" +version = "0.9.0" description = "CLI to test and analyze eBPF programs" authors = ["Solana Maintainers "] -repository = "https://github.com/solana-labs/rbpf" +repository = "https://github.com/anza-xyz/sbpf" homepage = "https://solana.com/" keywords = ["BPF", "eBPF", "interpreter", "JIT"] edition = "2018" [dependencies] -solana_rbpf = { path = "../", features = ["debugger"] } +solana-sbpf = { path = "../", features = ["debugger"] } test_utils = { path = "../test_utils/" } clap = "3.0.0-beta.2" diff --git a/cli/src/main.rs b/cli/src/main.rs index cded744a..5c3d344b 100644 --- a/cli/src/main.rs +++ b/cli/src/main.rs @@ -1,5 +1,5 @@ use clap::{crate_version, App, Arg}; -use solana_rbpf::{ +use solana_sbpf::{ aligned_memory::AlignedMemory, assembler::assemble, ebpf, diff --git a/examples/disassemble.rs b/examples/disassemble.rs index d668cbaf..50b45fec 100644 --- a/examples/disassemble.rs +++ b/examples/disassemble.rs @@ -4,8 +4,8 @@ // the MIT license , at your option. This file may not be // copied, modified, or distributed except according to those terms. -extern crate solana_rbpf; -use solana_rbpf::{ +extern crate solana_sbpf; +use solana_sbpf::{ elf::Executable, program::{BuiltinProgram, FunctionRegistry, SBPFVersion}, static_analysis::Analysis, diff --git a/examples/to_json.rs b/examples/to_json.rs index cb6b1e2e..068c5edf 100644 --- a/examples/to_json.rs +++ b/examples/to_json.rs @@ -10,8 +10,8 @@ extern crate json; extern crate elf; use std::path::PathBuf; -extern crate solana_rbpf; -use solana_rbpf::{ +extern crate solana_sbpf; +use solana_sbpf::{ elf::Executable, program::{BuiltinProgram, FunctionRegistry, SBPFVersion}, static_analysis::Analysis, diff --git a/fuzz/Cargo.lock b/fuzz/Cargo.lock index 287092d4..0116e06f 100644 --- a/fuzz/Cargo.lock +++ b/fuzz/Cargo.lock @@ -315,8 +315,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "04c565b551bafbef4157586fa379538366e4385d42082f255bfd96e4fe8519da" [[package]] -name = "solana_rbpf" -version = "0.8.2" +name = "solana-sbpf" +version = "0.9.0" dependencies = [ "arbitrary", "byteorder", @@ -332,14 +332,14 @@ dependencies = [ ] [[package]] -name = "solana_rbpf-fuzz" -version = "0.8.2" +name = "solana-sbpf-fuzz" +version = "0.9.0" dependencies = [ "arbitrary", "libfuzzer-sys", "num-traits", "rayon", - "solana_rbpf", + "solana-sbpf", "test_utils", ] @@ -356,10 +356,10 @@ dependencies = [ [[package]] name = "test_utils" -version = "0.8.2" +version = "0.9.0" dependencies = [ "libc", - "solana_rbpf", + "solana-sbpf", ] [[package]] diff --git a/fuzz/Cargo.toml b/fuzz/Cargo.toml index c16abfa7..03a1b71f 100644 --- a/fuzz/Cargo.toml +++ b/fuzz/Cargo.toml @@ -1,6 +1,6 @@ [package] -name = "solana_rbpf-fuzz" -version = "0.8.2" +name = "solana-sbpf-fuzz" +version = "0.9.0" authors = ["Automatically generated"] publish = false edition = "2018" @@ -15,7 +15,7 @@ num-traits = "0.2" rayon = "1.5" test_utils = { path = "../test_utils/" } -[dependencies.solana_rbpf] +[dependencies.solana-sbpf] path = ".." features = ["fuzzer-not-safe-for-production"] diff --git a/fuzz/fuzz_targets/common.rs b/fuzz/fuzz_targets/common.rs index 17e8d0c7..0caa9bef 100644 --- a/fuzz/fuzz_targets/common.rs +++ b/fuzz/fuzz_targets/common.rs @@ -2,7 +2,7 @@ use std::mem::size_of; use arbitrary::{Arbitrary, Unstructured}; -use solana_rbpf::vm::Config; +use solana_sbpf::vm::Config; #[derive(Debug)] pub struct ConfigTemplate { diff --git a/fuzz/fuzz_targets/dumb.rs b/fuzz/fuzz_targets/dumb.rs index ee624f5b..d0c8fc0c 100644 --- a/fuzz/fuzz_targets/dumb.rs +++ b/fuzz/fuzz_targets/dumb.rs @@ -4,7 +4,7 @@ use std::hint::black_box; use libfuzzer_sys::fuzz_target; -use solana_rbpf::{ +use solana_sbpf::{ ebpf, elf::Executable, memory_region::MemoryRegion, diff --git a/fuzz/fuzz_targets/grammar_aware.rs b/fuzz/fuzz_targets/grammar_aware.rs index b5b19f2e..69e557fa 100644 --- a/fuzz/fuzz_targets/grammar_aware.rs +++ b/fuzz/fuzz_targets/grammar_aware.rs @@ -1,6 +1,6 @@ #![allow(dead_code)] -use solana_rbpf::insn_builder::{Arch, BpfCode, Cond, Endian, Instruction, MemSize, Source}; +use solana_sbpf::insn_builder::{Arch, BpfCode, Cond, Endian, Instruction, MemSize, Source}; #[derive(arbitrary::Arbitrary, Debug, Eq, PartialEq)] pub enum FuzzedOp { diff --git a/fuzz/fuzz_targets/semantic_aware.rs b/fuzz/fuzz_targets/semantic_aware.rs index 6e1a066f..28bd752a 100644 --- a/fuzz/fuzz_targets/semantic_aware.rs +++ b/fuzz/fuzz_targets/semantic_aware.rs @@ -3,7 +3,7 @@ use std::num::NonZeroI32; -use solana_rbpf::insn_builder::{Arch, BpfCode, Cond, Endian, Instruction, MemSize, Move, Source}; +use solana_sbpf::insn_builder::{Arch, BpfCode, Cond, Endian, Instruction, MemSize, Move, Source}; #[derive(arbitrary::Arbitrary, Debug, Eq, PartialEq, Copy, Clone)] pub struct Register(u8); diff --git a/fuzz/fuzz_targets/smart.rs b/fuzz/fuzz_targets/smart.rs index 9232b0d3..e003ceff 100644 --- a/fuzz/fuzz_targets/smart.rs +++ b/fuzz/fuzz_targets/smart.rs @@ -5,7 +5,7 @@ use std::hint::black_box; use libfuzzer_sys::fuzz_target; use grammar_aware::*; -use solana_rbpf::{ +use solana_sbpf::{ ebpf, elf::Executable, insn_builder::{Arch, IntoBytes}, diff --git a/fuzz/fuzz_targets/smart_jit_diff.rs b/fuzz/fuzz_targets/smart_jit_diff.rs index b77ab691..0bfb637f 100644 --- a/fuzz/fuzz_targets/smart_jit_diff.rs +++ b/fuzz/fuzz_targets/smart_jit_diff.rs @@ -3,7 +3,7 @@ use libfuzzer_sys::fuzz_target; use grammar_aware::*; -use solana_rbpf::{ +use solana_sbpf::{ ebpf, elf::Executable, insn_builder::{Arch, Instruction, IntoBytes}, diff --git a/fuzz/fuzz_targets/smarter_jit_diff.rs b/fuzz/fuzz_targets/smarter_jit_diff.rs index ebfa6e04..e1774b4f 100644 --- a/fuzz/fuzz_targets/smarter_jit_diff.rs +++ b/fuzz/fuzz_targets/smarter_jit_diff.rs @@ -3,7 +3,7 @@ use libfuzzer_sys::fuzz_target; use semantic_aware::*; -use solana_rbpf::{ +use solana_sbpf::{ ebpf, elf::Executable, insn_builder::IntoBytes, diff --git a/fuzz/fuzz_targets/verify_semantic_aware.rs b/fuzz/fuzz_targets/verify_semantic_aware.rs index 68c7d4b1..68e6fecb 100644 --- a/fuzz/fuzz_targets/verify_semantic_aware.rs +++ b/fuzz/fuzz_targets/verify_semantic_aware.rs @@ -3,7 +3,7 @@ use libfuzzer_sys::fuzz_target; use semantic_aware::*; -use solana_rbpf::{ +use solana_sbpf::{ insn_builder::IntoBytes, program::{BuiltinFunction, FunctionRegistry, SBPFVersion}, verifier::{RequisiteVerifier, Verifier}, diff --git a/misc/rbpf.ico b/misc/rbpf.ico deleted file mode 100644 index 6bb94a1c..00000000 Binary files a/misc/rbpf.ico and /dev/null differ diff --git a/misc/rbpf.png b/misc/rbpf.png deleted file mode 100644 index b3f07c4b..00000000 Binary files a/misc/rbpf.png and /dev/null differ diff --git a/misc/rbpf_256.png b/misc/rbpf_256.png deleted file mode 100644 index b8ae8349..00000000 Binary files a/misc/rbpf_256.png and /dev/null differ diff --git a/src/assembler.rs b/src/assembler.rs index 40f58ba3..0737a6be 100644 --- a/src/assembler.rs +++ b/src/assembler.rs @@ -293,7 +293,7 @@ fn resolve_label( /// # Examples /// /// ``` -/// use solana_rbpf::{assembler::assemble, program::BuiltinProgram, vm::{Config, TestContextObject}}; +/// use solana_sbpf::{assembler::assemble, program::BuiltinProgram, vm::{Config, TestContextObject}}; /// let executable = assemble::( /// "add64 r1, 0x605 /// mov64 r2, 0x32 diff --git a/src/ebpf.rs b/src/ebpf.rs index 35bdcb36..be9bfc7e 100644 --- a/src/ebpf.rs +++ b/src/ebpf.rs @@ -208,7 +208,7 @@ pub const BPF_JSLT: u8 = 0xc0; pub const BPF_JSLE: u8 = 0xd0; // Op codes -// (Following operation names are not “official”, but may be proper to rbpf; Linux kernel only +// (Following operation names are not “official”, but may be proper to sbpf; Linux kernel only // combines above flags and does not attribute a name per operation.) /// BPF opcode: `lddw dst, imm` /// `dst = imm`. [DEPRECATED] @@ -531,7 +531,7 @@ impl Insn { /// # Examples /// /// ``` - /// use solana_rbpf::ebpf; + /// use solana_sbpf::ebpf; /// /// let prog: &[u8] = &[ /// 0xb7, 0x12, 0x56, 0x34, 0xde, 0xbc, 0x9a, 0x78, @@ -564,7 +564,7 @@ impl Insn { /// # Examples /// /// ``` - /// use solana_rbpf::ebpf; + /// use solana_sbpf::ebpf; /// /// let prog: Vec = vec![ /// 0xb7, 0x12, 0x56, 0x34, 0xde, 0xbc, 0x9a, 0x78, @@ -595,7 +595,7 @@ impl Insn { /// # Examples /// /// ``` -/// use solana_rbpf::ebpf; +/// use solana_sbpf::ebpf; /// /// let prog = &[ /// 0xb7, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -608,7 +608,7 @@ impl Insn { /// The example below will panic, since the last instruction is not complete and cannot be loaded. /// /// ```rust,should_panic -/// use solana_rbpf::ebpf; +/// use solana_sbpf::ebpf; /// /// let prog = &[ /// 0xb7, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, diff --git a/src/lib.rs b/src/lib.rs index 573d8810..3e1c6176 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -9,12 +9,8 @@ // the MIT license , at your option. This file may not be // copied, modified, or distributed except according to those terms. -//! Virtual machine and JIT compiler for eBPF programs. +//! Virtual machine for SBPF programs. #![warn(missing_docs)] -#![doc( - html_logo_url = "https://raw.githubusercontent.com/qmonnet/rbpf/master/misc/rbpf.png", - html_favicon_url = "https://raw.githubusercontent.com/qmonnet/rbpf/master/misc/rbpf.ico" -)] #![deny(clippy::arithmetic_side_effects)] #![deny(clippy::ptr_as_ptr)] diff --git a/src/syscalls.rs b/src/syscalls.rs index a8d398db..1ef007b5 100644 --- a/src/syscalls.rs +++ b/src/syscalls.rs @@ -15,7 +15,7 @@ //! //! * Some of them mimic the syscalls available in the Linux kernel. //! * Some of them were proposed as example syscalls in uBPF and they were adapted here. -//! * Other syscalls may be specific to rbpf. +//! * Other syscalls may be specific to sbpf. //! //! The prototype for syscalls is always the same: five `u64` as arguments, and a `u64` as a return //! value. Hence some syscalls have unused arguments, or return a 0 value in all cases, in order to diff --git a/src/vm.rs b/src/vm.rs index 3afa01b6..e1312c94 100644 --- a/src/vm.rs +++ b/src/vm.rs @@ -232,7 +232,7 @@ pub struct CallFrame { /// # Examples /// /// ``` -/// use solana_rbpf::{ +/// use solana_sbpf::{ /// aligned_memory::AlignedMemory, /// ebpf, /// elf::Executable, diff --git a/test_utils/Cargo.lock b/test_utils/Cargo.lock index a546bc6d..fe0d0385 100644 --- a/test_utils/Cargo.lock +++ b/test_utils/Cargo.lock @@ -153,8 +153,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "04c565b551bafbef4157586fa379538366e4385d42082f255bfd96e4fe8519da" [[package]] -name = "solana_rbpf" -version = "0.8.2" +name = "solana-sbpf" +version = "0.9.0" dependencies = [ "byteorder", "combine", @@ -181,10 +181,10 @@ dependencies = [ [[package]] name = "test_utils" -version = "0.8.2" +version = "0.9.0" dependencies = [ "libc", - "solana_rbpf", + "solana-sbpf", ] [[package]] diff --git a/test_utils/Cargo.toml b/test_utils/Cargo.toml index 2c1bc4de..f4592b20 100644 --- a/test_utils/Cargo.toml +++ b/test_utils/Cargo.toml @@ -1,10 +1,10 @@ [package] name = "test_utils" -version = "0.8.2" +version = "0.9.0" authors = ["Solana Maintainers "] edition = "2018" publish = false [dependencies] libc = "0.2" -solana_rbpf = { path = "../" } +solana-sbpf = { path = "../" } diff --git a/test_utils/src/lib.rs b/test_utils/src/lib.rs index 0f8e1c2d..2f1d8df5 100644 --- a/test_utils/src/lib.rs +++ b/test_utils/src/lib.rs @@ -8,7 +8,7 @@ #![allow(dead_code)] -use solana_rbpf::{ +use solana_sbpf::{ aligned_memory::AlignedMemory, ebpf::{self, HOST_ALIGN}, elf::Executable, @@ -194,10 +194,10 @@ pub fn create_memory_mapping<'a, C: ContextObject>( #[macro_export] macro_rules! create_vm { ($vm_name:ident, $verified_executable:expr, $context_object:expr, $stack:ident, $heap:ident, $additional_regions:expr, $cow_cb:expr) => { - let mut $stack = solana_rbpf::aligned_memory::AlignedMemory::zero_filled( + let mut $stack = solana_sbpf::aligned_memory::AlignedMemory::zero_filled( $verified_executable.get_config().stack_size(), ); - let mut $heap = solana_rbpf::aligned_memory::AlignedMemory::with_capacity(0); + let mut $heap = solana_sbpf::aligned_memory::AlignedMemory::with_capacity(0); let stack_len = $stack.len(); let memory_mapping = test_utils::create_memory_mapping( $verified_executable, @@ -207,7 +207,7 @@ macro_rules! create_vm { $cow_cb, ) .unwrap(); - let mut $vm_name = solana_rbpf::vm::EbpfVm::new( + let mut $vm_name = solana_sbpf::vm::EbpfVm::new( $verified_executable.get_loader().clone(), $verified_executable.get_sbpf_version(), $context_object, diff --git a/tests/assembler.rs b/tests/assembler.rs index 2ce72f09..6b78613e 100644 --- a/tests/assembler.rs +++ b/tests/assembler.rs @@ -5,12 +5,12 @@ // the MIT license , at your option. This file may not be // copied, modified, or distributed except according to those terms. -extern crate solana_rbpf; +extern crate solana_sbpf; extern crate test_utils; -use solana_rbpf::program::{FunctionRegistry, SBPFVersion}; -use solana_rbpf::vm::Config; -use solana_rbpf::{assembler::assemble, ebpf, program::BuiltinProgram, vm::TestContextObject}; +use solana_sbpf::program::{FunctionRegistry, SBPFVersion}; +use solana_sbpf::vm::Config; +use solana_sbpf::{assembler::assemble, ebpf, program::BuiltinProgram, vm::TestContextObject}; use std::sync::Arc; use test_utils::{TCP_SACK_ASM, TCP_SACK_BIN}; diff --git a/tests/disassembler.rs b/tests/disassembler.rs index cc55af86..a4a358c8 100644 --- a/tests/disassembler.rs +++ b/tests/disassembler.rs @@ -6,9 +6,9 @@ // the MIT license , at your option. This file may not be // copied, modified, or distributed except according to those terms. -extern crate solana_rbpf; -use solana_rbpf::program::SBPFVersion; -use solana_rbpf::{ +extern crate solana_sbpf; +use solana_sbpf::program::SBPFVersion; +use solana_sbpf::{ assembler::assemble, program::{BuiltinProgram, FunctionRegistry}, static_analysis::Analysis, diff --git a/tests/elfs/elfs.sh b/tests/elfs/elfs.sh index 93190d97..25b72b7a 100755 --- a/tests/elfs/elfs.sh +++ b/tests/elfs/elfs.sh @@ -1,7 +1,7 @@ #!/bin/bash -ex # Requires Latest release of Solana's custom LLVM -# https://github.com/solana-labs/platform-tools/releases +# https://github.com/anza-xyz/platform-tools/releases TOOLCHAIN=../../../agave/sdk/sbf/dependencies/platform-tools RC_COMMON="$TOOLCHAIN/rust/bin/rustc --target sbf-solana-solana --crate-type lib -C panic=abort -C opt-level=2" diff --git a/tests/execution.rs b/tests/execution.rs index 22439ffa..bd87ad07 100644 --- a/tests/execution.rs +++ b/tests/execution.rs @@ -8,14 +8,14 @@ extern crate byteorder; extern crate libc; -extern crate solana_rbpf; +extern crate solana_sbpf; extern crate test_utils; extern crate thiserror; use byteorder::{ByteOrder, LittleEndian}; #[cfg(all(not(windows), target_arch = "x86_64"))] use rand::{rngs::SmallRng, RngCore, SeedableRng}; -use solana_rbpf::{ +use solana_sbpf::{ assembler::assemble, declare_builtin_function, ebpf, elf::Executable, @@ -3435,7 +3435,7 @@ fn execute_generated_program(prog: &[u8]) -> bool { || !TestContextObject::compare_trace_log(&tracer_interpreter, tracer_jit) { let analysis = - solana_rbpf::static_analysis::Analysis::from_executable(&executable).unwrap(); + solana_sbpf::static_analysis::Analysis::from_executable(&executable).unwrap(); println!("result_interpreter={result_interpreter:?}"); println!("result_jit={result_jit:?}"); let stdout = std::io::stdout(); diff --git a/tests/exercise_instructions.rs b/tests/exercise_instructions.rs index 2538b305..f8f5a89b 100644 --- a/tests/exercise_instructions.rs +++ b/tests/exercise_instructions.rs @@ -8,12 +8,12 @@ extern crate byteorder; extern crate libc; -extern crate solana_rbpf; +extern crate solana_sbpf; extern crate test_utils; extern crate thiserror; use rand::{rngs::SmallRng, RngCore, SeedableRng}; -use solana_rbpf::{ +use solana_sbpf::{ assembler::assemble, ebpf, memory_region::MemoryRegion, diff --git a/tests/verifier.rs b/tests/verifier.rs index d6ff690d..658d9b5e 100644 --- a/tests/verifier.rs +++ b/tests/verifier.rs @@ -19,10 +19,10 @@ // These are unit tests for the eBPF “verifier”. -extern crate solana_rbpf; +extern crate solana_sbpf; extern crate thiserror; -use solana_rbpf::{ +use solana_sbpf::{ assembler::assemble, ebpf, elf::Executable,