Bump solana_rbpf to v0.5.0 (#31943)
* Renames RBPF BuiltIn to Builtin. * Bump solana_rbpf to v0.5.0
This commit is contained in:
parent
858ea5a143
commit
3792204598
|
@ -7176,9 +7176,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "solana_rbpf"
|
name = "solana_rbpf"
|
||||||
version = "0.4.0"
|
version = "0.5.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5c0820fa96c8e644159a308b338465d2a6314b0a71abc92ed3ecf9ad61c906e3"
|
checksum = "5ae90c406f0a2d4a15f08d16c8b64f37997a57611fec0a89f1277854166996e8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"byteorder",
|
"byteorder",
|
||||||
"combine",
|
"combine",
|
||||||
|
|
|
@ -288,7 +288,7 @@ signal-hook = "0.3.15"
|
||||||
smpl_jwt = "0.7.1"
|
smpl_jwt = "0.7.1"
|
||||||
socket2 = "0.4.9"
|
socket2 = "0.4.9"
|
||||||
soketto = "0.7"
|
soketto = "0.7"
|
||||||
solana_rbpf = "=0.4.0"
|
solana_rbpf = "=0.5.0"
|
||||||
solana-account-decoder = { path = "account-decoder", version = "=1.17.0" }
|
solana-account-decoder = { path = "account-decoder", version = "=1.17.0" }
|
||||||
solana-address-lookup-table-program = { path = "programs/address-lookup-table", version = "=1.17.0" }
|
solana-address-lookup-table-program = { path = "programs/address-lookup-table", version = "=1.17.0" }
|
||||||
solana-banks-client = { path = "banks-client", version = "=1.17.0" }
|
solana-banks-client = { path = "banks-client", version = "=1.17.0" }
|
||||||
|
|
|
@ -14,7 +14,7 @@ use {
|
||||||
solana_rbpf::{
|
solana_rbpf::{
|
||||||
ebpf::MM_HEAP_START,
|
ebpf::MM_HEAP_START,
|
||||||
memory_region::MemoryMapping,
|
memory_region::MemoryMapping,
|
||||||
vm::{BuiltInFunction, Config, ContextObject, ProgramResult},
|
vm::{BuiltinFunction, Config, ContextObject, ProgramResult},
|
||||||
},
|
},
|
||||||
solana_sdk::{
|
solana_sdk::{
|
||||||
account::{AccountSharedData, ReadableAccount},
|
account::{AccountSharedData, ReadableAccount},
|
||||||
|
@ -43,7 +43,7 @@ use {
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
pub type ProcessInstructionWithContext = BuiltInFunction<InvokeContext<'static>>;
|
pub type ProcessInstructionWithContext = BuiltinFunction<InvokeContext<'static>>;
|
||||||
|
|
||||||
/// Adapter so we can unify the interfaces of built-in programs and syscalls
|
/// Adapter so we can unify the interfaces of built-in programs and syscalls
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
|
|
|
@ -9,7 +9,7 @@ use {
|
||||||
log::{debug, log_enabled, trace},
|
log::{debug, log_enabled, trace},
|
||||||
percentage::PercentageInteger,
|
percentage::PercentageInteger,
|
||||||
solana_measure::measure::Measure,
|
solana_measure::measure::Measure,
|
||||||
solana_rbpf::{elf::Executable, verifier::RequisiteVerifier, vm::BuiltInProgram},
|
solana_rbpf::{elf::Executable, verifier::RequisiteVerifier, vm::BuiltinProgram},
|
||||||
solana_sdk::{
|
solana_sdk::{
|
||||||
bpf_loader, bpf_loader_deprecated, bpf_loader_upgradeable, clock::Slot, loader_v4,
|
bpf_loader, bpf_loader_deprecated, bpf_loader_upgradeable, clock::Slot, loader_v4,
|
||||||
pubkey::Pubkey, saturating_add_assign,
|
pubkey::Pubkey, saturating_add_assign,
|
||||||
|
@ -71,7 +71,7 @@ pub enum LoadedProgramType {
|
||||||
Typed(Executable<RequisiteVerifier, InvokeContext<'static>>),
|
Typed(Executable<RequisiteVerifier, InvokeContext<'static>>),
|
||||||
#[cfg(test)]
|
#[cfg(test)]
|
||||||
TestLoaded,
|
TestLoaded,
|
||||||
Builtin(BuiltInProgram<InvokeContext<'static>>),
|
Builtin(BuiltinProgram<InvokeContext<'static>>),
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Debug for LoadedProgramType {
|
impl Debug for LoadedProgramType {
|
||||||
|
@ -217,7 +217,7 @@ impl LoadedProgram {
|
||||||
/// Creates a new user program
|
/// Creates a new user program
|
||||||
pub fn new(
|
pub fn new(
|
||||||
loader_key: &Pubkey,
|
loader_key: &Pubkey,
|
||||||
program_runtime_environment: Arc<BuiltInProgram<InvokeContext<'static>>>,
|
program_runtime_environment: Arc<BuiltinProgram<InvokeContext<'static>>>,
|
||||||
deployment_slot: Slot,
|
deployment_slot: Slot,
|
||||||
effective_slot: Slot,
|
effective_slot: Slot,
|
||||||
maybe_expiration_slot: Option<Slot>,
|
maybe_expiration_slot: Option<Slot>,
|
||||||
|
@ -286,7 +286,7 @@ impl LoadedProgram {
|
||||||
account_size: usize,
|
account_size: usize,
|
||||||
entrypoint: ProcessInstructionWithContext,
|
entrypoint: ProcessInstructionWithContext,
|
||||||
) -> Self {
|
) -> Self {
|
||||||
let mut program = BuiltInProgram::default();
|
let mut program = BuiltinProgram::default();
|
||||||
program
|
program
|
||||||
.register_function(b"entrypoint", entrypoint)
|
.register_function(b"entrypoint", entrypoint)
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
@ -351,7 +351,7 @@ pub struct LoadedPrograms {
|
||||||
/// Pubkey is the address of a program, multiple versions can coexists simultaneously under the same address (in different slots).
|
/// Pubkey is the address of a program, multiple versions can coexists simultaneously under the same address (in different slots).
|
||||||
entries: HashMap<Pubkey, Vec<Arc<LoadedProgram>>>,
|
entries: HashMap<Pubkey, Vec<Arc<LoadedProgram>>>,
|
||||||
/// Globally shared RBPF config and syscall registry
|
/// Globally shared RBPF config and syscall registry
|
||||||
pub program_runtime_environment_v1: Arc<BuiltInProgram<InvokeContext<'static>>>,
|
pub program_runtime_environment_v1: Arc<BuiltinProgram<InvokeContext<'static>>>,
|
||||||
latest_root: Slot,
|
latest_root: Slot,
|
||||||
pub stats: Stats,
|
pub stats: Stats,
|
||||||
}
|
}
|
||||||
|
@ -740,7 +740,7 @@ mod tests {
|
||||||
LoadedPrograms, LoadedProgramsForTxBatch, WorkingSlot, DELAY_VISIBILITY_SLOT_OFFSET,
|
LoadedPrograms, LoadedProgramsForTxBatch, WorkingSlot, DELAY_VISIBILITY_SLOT_OFFSET,
|
||||||
},
|
},
|
||||||
percentage::Percentage,
|
percentage::Percentage,
|
||||||
solana_rbpf::vm::BuiltInProgram,
|
solana_rbpf::vm::BuiltinProgram,
|
||||||
solana_sdk::{clock::Slot, pubkey::Pubkey},
|
solana_sdk::{clock::Slot, pubkey::Pubkey},
|
||||||
std::{
|
std::{
|
||||||
ops::ControlFlow,
|
ops::ControlFlow,
|
||||||
|
@ -753,7 +753,7 @@ mod tests {
|
||||||
|
|
||||||
fn new_test_builtin_program(deployment_slot: Slot, effective_slot: Slot) -> Arc<LoadedProgram> {
|
fn new_test_builtin_program(deployment_slot: Slot, effective_slot: Slot) -> Arc<LoadedProgram> {
|
||||||
Arc::new(LoadedProgram {
|
Arc::new(LoadedProgram {
|
||||||
program: LoadedProgramType::Builtin(BuiltInProgram::default()),
|
program: LoadedProgramType::Builtin(BuiltinProgram::default()),
|
||||||
account_size: 0,
|
account_size: 0,
|
||||||
deployment_slot,
|
deployment_slot,
|
||||||
effective_slot,
|
effective_slot,
|
||||||
|
|
|
@ -23,7 +23,7 @@ use {
|
||||||
error::EbpfError,
|
error::EbpfError,
|
||||||
memory_region::{AccessType, MemoryCowCallback, MemoryMapping, MemoryRegion},
|
memory_region::{AccessType, MemoryCowCallback, MemoryMapping, MemoryRegion},
|
||||||
verifier::RequisiteVerifier,
|
verifier::RequisiteVerifier,
|
||||||
vm::{BuiltInProgram, ContextObject, EbpfVm, ProgramResult},
|
vm::{BuiltinProgram, ContextObject, EbpfVm, ProgramResult},
|
||||||
},
|
},
|
||||||
solana_sdk::{
|
solana_sdk::{
|
||||||
account::WritableAccount,
|
account::WritableAccount,
|
||||||
|
@ -71,7 +71,7 @@ pub fn load_program_from_bytes(
|
||||||
loader_key: &Pubkey,
|
loader_key: &Pubkey,
|
||||||
account_size: usize,
|
account_size: usize,
|
||||||
deployment_slot: Slot,
|
deployment_slot: Slot,
|
||||||
program_runtime_environment: Arc<BuiltInProgram<InvokeContext<'static>>>,
|
program_runtime_environment: Arc<BuiltinProgram<InvokeContext<'static>>>,
|
||||||
) -> Result<LoadedProgram, InstructionError> {
|
) -> Result<LoadedProgram, InstructionError> {
|
||||||
let effective_slot = if feature_set.is_active(&delay_visibility_of_program_deployment::id()) {
|
let effective_slot = if feature_set.is_active(&delay_visibility_of_program_deployment::id()) {
|
||||||
deployment_slot.saturating_add(DELAY_VISIBILITY_SLOT_OFFSET)
|
deployment_slot.saturating_add(DELAY_VISIBILITY_SLOT_OFFSET)
|
||||||
|
@ -100,7 +100,7 @@ pub fn load_program_from_account(
|
||||||
log_collector: Option<Rc<RefCell<LogCollector>>>,
|
log_collector: Option<Rc<RefCell<LogCollector>>>,
|
||||||
program: &BorrowedAccount,
|
program: &BorrowedAccount,
|
||||||
programdata: &BorrowedAccount,
|
programdata: &BorrowedAccount,
|
||||||
program_runtime_environment: Arc<BuiltInProgram<InvokeContext<'static>>>,
|
program_runtime_environment: Arc<BuiltinProgram<InvokeContext<'static>>>,
|
||||||
) -> Result<(Arc<LoadedProgram>, LoadProgramMetrics), InstructionError> {
|
) -> Result<(Arc<LoadedProgram>, LoadProgramMetrics), InstructionError> {
|
||||||
if !check_loader_id(program.get_owner()) {
|
if !check_loader_id(program.get_owner()) {
|
||||||
ic_logger_msg!(
|
ic_logger_msg!(
|
||||||
|
@ -352,7 +352,7 @@ macro_rules! create_vm {
|
||||||
#[macro_export]
|
#[macro_export]
|
||||||
macro_rules! mock_create_vm {
|
macro_rules! mock_create_vm {
|
||||||
($vm:ident, $additional_regions:expr, $orig_account_lengths:expr, $invoke_context:expr $(,)?) => {
|
($vm:ident, $additional_regions:expr, $orig_account_lengths:expr, $invoke_context:expr $(,)?) => {
|
||||||
let loader = std::sync::Arc::new(BuiltInProgram::new_loader(
|
let loader = std::sync::Arc::new(BuiltinProgram::new_loader(
|
||||||
solana_rbpf::vm::Config::default(),
|
solana_rbpf::vm::Config::default(),
|
||||||
));
|
));
|
||||||
let function_registry = solana_rbpf::vm::FunctionRegistry::default();
|
let function_registry = solana_rbpf::vm::FunctionRegistry::default();
|
||||||
|
|
|
@ -17,7 +17,7 @@ use {
|
||||||
},
|
},
|
||||||
solana_rbpf::{
|
solana_rbpf::{
|
||||||
memory_region::{AccessType, MemoryMapping},
|
memory_region::{AccessType, MemoryMapping},
|
||||||
vm::{BuiltInProgram, Config, ProgramResult, PROGRAM_ENVIRONMENT_KEY_SHIFT},
|
vm::{BuiltinProgram, Config, ProgramResult, PROGRAM_ENVIRONMENT_KEY_SHIFT},
|
||||||
},
|
},
|
||||||
solana_sdk::{
|
solana_sdk::{
|
||||||
account::{ReadableAccount, WritableAccount},
|
account::{ReadableAccount, WritableAccount},
|
||||||
|
@ -146,7 +146,7 @@ pub fn create_program_runtime_environment<'a>(
|
||||||
compute_budget: &ComputeBudget,
|
compute_budget: &ComputeBudget,
|
||||||
reject_deployment_of_broken_elfs: bool,
|
reject_deployment_of_broken_elfs: bool,
|
||||||
debugging_features: bool,
|
debugging_features: bool,
|
||||||
) -> Result<BuiltInProgram<InvokeContext<'a>>, Error> {
|
) -> Result<BuiltinProgram<InvokeContext<'a>>, Error> {
|
||||||
use rand::Rng;
|
use rand::Rng;
|
||||||
let config = Config {
|
let config = Config {
|
||||||
max_call_depth: compute_budget.max_call_depth,
|
max_call_depth: compute_budget.max_call_depth,
|
||||||
|
@ -186,7 +186,7 @@ pub fn create_program_runtime_environment<'a>(
|
||||||
let disable_deploy_of_alloc_free_syscall = reject_deployment_of_broken_elfs
|
let disable_deploy_of_alloc_free_syscall = reject_deployment_of_broken_elfs
|
||||||
&& feature_set.is_active(&disable_deploy_of_alloc_free_syscall::id());
|
&& feature_set.is_active(&disable_deploy_of_alloc_free_syscall::id());
|
||||||
|
|
||||||
let mut result = BuiltInProgram::new_loader(config);
|
let mut result = BuiltinProgram::new_loader(config);
|
||||||
|
|
||||||
// Abort
|
// Abort
|
||||||
result.register_function(b"abort", SyscallAbort::call)?;
|
result.register_function(b"abort", SyscallAbort::call)?;
|
||||||
|
@ -1786,7 +1786,7 @@ mod tests {
|
||||||
solana_rbpf::{
|
solana_rbpf::{
|
||||||
error::EbpfError,
|
error::EbpfError,
|
||||||
memory_region::MemoryRegion,
|
memory_region::MemoryRegion,
|
||||||
vm::{BuiltInFunction, Config},
|
vm::{BuiltinFunction, Config},
|
||||||
},
|
},
|
||||||
solana_sdk::{
|
solana_sdk::{
|
||||||
account::{create_account_shared_data_for_test, AccountSharedData},
|
account::{create_account_shared_data_for_test, AccountSharedData},
|
||||||
|
@ -3341,7 +3341,7 @@ mod tests {
|
||||||
seeds: &[&[u8]],
|
seeds: &[&[u8]],
|
||||||
program_id: &Pubkey,
|
program_id: &Pubkey,
|
||||||
overlap_outputs: bool,
|
overlap_outputs: bool,
|
||||||
syscall: BuiltInFunction<InvokeContext<'b>>,
|
syscall: BuiltinFunction<InvokeContext<'b>>,
|
||||||
) -> Result<(Pubkey, u8), Error> {
|
) -> Result<(Pubkey, u8), Error> {
|
||||||
const SEEDS_VA: u64 = 0x100000000;
|
const SEEDS_VA: u64 = 0x100000000;
|
||||||
const PROGRAM_ID_VA: u64 = 0x200000000;
|
const PROGRAM_ID_VA: u64 = 0x200000000;
|
||||||
|
|
|
@ -16,7 +16,7 @@ use {
|
||||||
memory_region::{MemoryMapping, MemoryRegion},
|
memory_region::{MemoryMapping, MemoryRegion},
|
||||||
verifier::RequisiteVerifier,
|
verifier::RequisiteVerifier,
|
||||||
vm::{
|
vm::{
|
||||||
BuiltInProgram, Config, ContextObject, EbpfVm, ProgramResult,
|
BuiltinProgram, Config, ContextObject, EbpfVm, ProgramResult,
|
||||||
PROGRAM_ENVIRONMENT_KEY_SHIFT,
|
PROGRAM_ENVIRONMENT_KEY_SHIFT,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -105,7 +105,7 @@ pub fn load_program_from_account(
|
||||||
aligned_memory_mapping: true,
|
aligned_memory_mapping: true,
|
||||||
// Warning, do not use `Config::default()` so that configuration here is explicit.
|
// Warning, do not use `Config::default()` so that configuration here is explicit.
|
||||||
};
|
};
|
||||||
let loader = BuiltInProgram::new_loader(config);
|
let loader = BuiltinProgram::new_loader(config);
|
||||||
let state = get_state(program.get_data())?;
|
let state = get_state(program.get_data())?;
|
||||||
let programdata = program
|
let programdata = program
|
||||||
.get_data()
|
.get_data()
|
||||||
|
|
|
@ -6282,9 +6282,9 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "solana_rbpf"
|
name = "solana_rbpf"
|
||||||
version = "0.4.0"
|
version = "0.5.0"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "5c0820fa96c8e644159a308b338465d2a6314b0a71abc92ed3ecf9ad61c906e3"
|
checksum = "5ae90c406f0a2d4a15f08d16c8b64f37997a57611fec0a89f1277854166996e8"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"byteorder 1.4.3",
|
"byteorder 1.4.3",
|
||||||
"combine",
|
"combine",
|
||||||
|
|
|
@ -24,7 +24,7 @@ num-traits = "0.2"
|
||||||
rand = "0.7"
|
rand = "0.7"
|
||||||
serde = "1.0.112"
|
serde = "1.0.112"
|
||||||
serde_json = "1.0.56"
|
serde_json = "1.0.56"
|
||||||
solana_rbpf = "=0.4.0"
|
solana_rbpf = "=0.5.0"
|
||||||
solana-account-decoder = { path = "../../account-decoder", version = "=1.17.0" }
|
solana-account-decoder = { path = "../../account-decoder", version = "=1.17.0" }
|
||||||
solana-address-lookup-table-program = { path = "../../programs/address-lookup-table", version = "=1.17.0" }
|
solana-address-lookup-table-program = { path = "../../programs/address-lookup-table", version = "=1.17.0" }
|
||||||
solana-bpf-loader-program = { path = "../bpf_loader", version = "=1.17.0" }
|
solana-bpf-loader-program = { path = "../bpf_loader", version = "=1.17.0" }
|
||||||
|
|
Loading…
Reference in New Issue