Revert "Bump solana_rbpf to version 0.2.13 (#18068)"
This reverts commit 765fbc9a8c
.
This commit is contained in:
@@ -2778,6 +2778,13 @@ mod tests {
|
||||
std::str::FromStr,
|
||||
};
|
||||
|
||||
const DEFAULT_CONFIG: Config = Config {
|
||||
max_call_depth: 20,
|
||||
stack_frame_size: 4_096,
|
||||
enable_instruction_meter: true,
|
||||
enable_instruction_tracing: false,
|
||||
};
|
||||
|
||||
macro_rules! assert_access_violation {
|
||||
($result:expr, $va:expr, $len:expr) => {
|
||||
match $result {
|
||||
@@ -2799,10 +2806,9 @@ mod tests {
|
||||
const LENGTH: u64 = 1000;
|
||||
let data = vec![0u8; LENGTH as usize];
|
||||
let addr = data.as_ptr() as u64;
|
||||
let config = Config::default();
|
||||
let memory_mapping = MemoryMapping::new::<UserError>(
|
||||
vec![MemoryRegion::new_from_slice(&data, START, 0, false)],
|
||||
&config,
|
||||
&DEFAULT_CONFIG,
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
@@ -2839,7 +2845,6 @@ mod tests {
|
||||
// Pubkey
|
||||
let pubkey = solana_sdk::pubkey::new_rand();
|
||||
let addr = &pubkey as *const _ as u64;
|
||||
let config = Config::default();
|
||||
let memory_mapping = MemoryMapping::new::<UserError>(
|
||||
vec![MemoryRegion {
|
||||
host_addr: addr,
|
||||
@@ -2848,7 +2853,7 @@ mod tests {
|
||||
vm_gap_shift: 63,
|
||||
is_writable: false,
|
||||
}],
|
||||
&config,
|
||||
&DEFAULT_CONFIG,
|
||||
)
|
||||
.unwrap();
|
||||
let translated_pubkey =
|
||||
@@ -2870,7 +2875,7 @@ mod tests {
|
||||
vm_gap_shift: 63,
|
||||
is_writable: false,
|
||||
}],
|
||||
&config,
|
||||
&DEFAULT_CONFIG,
|
||||
)
|
||||
.unwrap();
|
||||
let translated_instruction =
|
||||
@@ -2889,7 +2894,6 @@ mod tests {
|
||||
let data: Vec<u8> = vec![];
|
||||
assert_eq!(0x1 as *const u8, data.as_ptr());
|
||||
let addr = good_data.as_ptr() as *const _ as u64;
|
||||
let config = Config::default();
|
||||
let memory_mapping = MemoryMapping::new::<UserError>(
|
||||
vec![MemoryRegion {
|
||||
host_addr: addr,
|
||||
@@ -2898,7 +2902,7 @@ mod tests {
|
||||
vm_gap_shift: 63,
|
||||
is_writable: false,
|
||||
}],
|
||||
&config,
|
||||
&DEFAULT_CONFIG,
|
||||
)
|
||||
.unwrap();
|
||||
let translated_data = translate_slice::<u8>(
|
||||
@@ -2923,7 +2927,7 @@ mod tests {
|
||||
vm_gap_shift: 63,
|
||||
is_writable: false,
|
||||
}],
|
||||
&config,
|
||||
&DEFAULT_CONFIG,
|
||||
)
|
||||
.unwrap();
|
||||
let translated_data = translate_slice::<u8>(
|
||||
@@ -2966,7 +2970,7 @@ mod tests {
|
||||
vm_gap_shift: 63,
|
||||
is_writable: false,
|
||||
}],
|
||||
&config,
|
||||
&DEFAULT_CONFIG,
|
||||
)
|
||||
.unwrap();
|
||||
let translated_data = translate_slice::<u64>(
|
||||
@@ -2996,7 +3000,7 @@ mod tests {
|
||||
vm_gap_shift: 63,
|
||||
is_writable: false,
|
||||
}],
|
||||
&config,
|
||||
&DEFAULT_CONFIG,
|
||||
)
|
||||
.unwrap();
|
||||
let translated_data = translate_slice::<Pubkey>(
|
||||
@@ -3016,7 +3020,6 @@ mod tests {
|
||||
fn test_translate_string_and_do() {
|
||||
let string = "Gaggablaghblagh!";
|
||||
let addr = string.as_ptr() as *const _ as u64;
|
||||
let config = Config::default();
|
||||
let memory_mapping = MemoryMapping::new::<UserError>(
|
||||
vec![MemoryRegion {
|
||||
host_addr: addr,
|
||||
@@ -3025,7 +3028,7 @@ mod tests {
|
||||
vm_gap_shift: 63,
|
||||
is_writable: false,
|
||||
}],
|
||||
&config,
|
||||
&DEFAULT_CONFIG,
|
||||
)
|
||||
.unwrap();
|
||||
assert_eq!(
|
||||
@@ -3048,9 +3051,9 @@ mod tests {
|
||||
#[test]
|
||||
#[should_panic(expected = "UserError(SyscallError(Abort))")]
|
||||
fn test_syscall_abort() {
|
||||
let config = Config::default();
|
||||
let memory_mapping =
|
||||
MemoryMapping::new::<UserError>(vec![MemoryRegion::default()], &config).unwrap();
|
||||
MemoryMapping::new::<UserError>(vec![MemoryRegion::default()], &DEFAULT_CONFIG)
|
||||
.unwrap();
|
||||
let mut result: Result<u64, EbpfError<BpfError>> = Ok(0);
|
||||
SyscallAbort::call(
|
||||
&mut SyscallAbort {},
|
||||
@@ -3070,7 +3073,6 @@ mod tests {
|
||||
fn test_syscall_sol_panic() {
|
||||
let string = "Gaggablaghblagh!";
|
||||
let addr = string.as_ptr() as *const _ as u64;
|
||||
let config = Config::default();
|
||||
let memory_mapping = MemoryMapping::new::<UserError>(
|
||||
vec![MemoryRegion {
|
||||
host_addr: addr,
|
||||
@@ -3079,7 +3081,7 @@ mod tests {
|
||||
vm_gap_shift: 63,
|
||||
is_writable: false,
|
||||
}],
|
||||
&config,
|
||||
&DEFAULT_CONFIG,
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
@@ -3147,7 +3149,6 @@ mod tests {
|
||||
loader_id: &bpf_loader::id(),
|
||||
enforce_aligned_host_addrs: true,
|
||||
};
|
||||
let config = Config::default();
|
||||
let memory_mapping = MemoryMapping::new::<UserError>(
|
||||
vec![MemoryRegion {
|
||||
host_addr: addr,
|
||||
@@ -3156,7 +3157,7 @@ mod tests {
|
||||
vm_gap_shift: 63,
|
||||
is_writable: false,
|
||||
}],
|
||||
&config,
|
||||
&DEFAULT_CONFIG,
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
@@ -3261,8 +3262,7 @@ mod tests {
|
||||
compute_meter,
|
||||
logger,
|
||||
};
|
||||
let config = Config::default();
|
||||
let memory_mapping = MemoryMapping::new::<UserError>(vec![], &config).unwrap();
|
||||
let memory_mapping = MemoryMapping::new::<UserError>(vec![], &DEFAULT_CONFIG).unwrap();
|
||||
|
||||
let mut result: Result<u64, EbpfError<BpfError>> = Ok(0);
|
||||
syscall_sol_log_u64.call(1, 2, 3, 4, 5, &memory_mapping, &mut result);
|
||||
@@ -3289,7 +3289,6 @@ mod tests {
|
||||
loader_id: &bpf_loader::id(),
|
||||
enforce_aligned_host_addrs: true,
|
||||
};
|
||||
let config = Config::default();
|
||||
let memory_mapping = MemoryMapping::new::<UserError>(
|
||||
vec![MemoryRegion {
|
||||
host_addr: addr,
|
||||
@@ -3298,7 +3297,7 @@ mod tests {
|
||||
vm_gap_shift: 63,
|
||||
is_writable: false,
|
||||
}],
|
||||
&config,
|
||||
&DEFAULT_CONFIG,
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
@@ -3333,7 +3332,6 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_syscall_sol_alloc_free() {
|
||||
let config = Config::default();
|
||||
// large alloc
|
||||
{
|
||||
let heap = AlignedMemory::new_with_size(100, HOST_ALIGN);
|
||||
@@ -3344,7 +3342,7 @@ mod tests {
|
||||
0,
|
||||
true,
|
||||
)],
|
||||
&config,
|
||||
&DEFAULT_CONFIG,
|
||||
)
|
||||
.unwrap();
|
||||
let mut syscall = SyscallAllocFree {
|
||||
@@ -3371,7 +3369,7 @@ mod tests {
|
||||
0,
|
||||
true,
|
||||
)],
|
||||
&config,
|
||||
&DEFAULT_CONFIG,
|
||||
)
|
||||
.unwrap();
|
||||
let mut syscall = SyscallAllocFree {
|
||||
@@ -3397,7 +3395,7 @@ mod tests {
|
||||
0,
|
||||
true,
|
||||
)],
|
||||
&config,
|
||||
&DEFAULT_CONFIG,
|
||||
)
|
||||
.unwrap();
|
||||
let mut syscall = SyscallAllocFree {
|
||||
@@ -3417,7 +3415,6 @@ mod tests {
|
||||
|
||||
fn check_alignment<T>() {
|
||||
let heap = AlignedMemory::new_with_size(100, HOST_ALIGN);
|
||||
let config = Config::default();
|
||||
let memory_mapping = MemoryMapping::new::<UserError>(
|
||||
vec![MemoryRegion::new_from_slice(
|
||||
heap.as_slice(),
|
||||
@@ -3425,7 +3422,7 @@ mod tests {
|
||||
0,
|
||||
true,
|
||||
)],
|
||||
&config,
|
||||
&DEFAULT_CONFIG,
|
||||
)
|
||||
.unwrap();
|
||||
let mut syscall = SyscallAllocFree {
|
||||
@@ -3471,7 +3468,6 @@ mod tests {
|
||||
let ro_len = bytes_to_hash.len() as u64;
|
||||
let ro_va = 96;
|
||||
let rw_va = 192;
|
||||
let config = Config::default();
|
||||
let memory_mapping = MemoryMapping::new::<UserError>(
|
||||
vec![
|
||||
MemoryRegion {
|
||||
@@ -3503,7 +3499,7 @@ mod tests {
|
||||
is_writable: true,
|
||||
},
|
||||
],
|
||||
&config,
|
||||
&DEFAULT_CONFIG,
|
||||
)
|
||||
.unwrap();
|
||||
let compute_meter: Rc<RefCell<dyn ComputeMeter>> =
|
||||
@@ -3569,7 +3565,6 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn test_syscall_get_sysvar() {
|
||||
let config = Config::default();
|
||||
// Test clock sysvar
|
||||
{
|
||||
let got_clock = Clock::default();
|
||||
@@ -3583,7 +3578,7 @@ mod tests {
|
||||
vm_gap_shift: 63,
|
||||
is_writable: true,
|
||||
}],
|
||||
&config,
|
||||
&DEFAULT_CONFIG,
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
@@ -3625,7 +3620,7 @@ mod tests {
|
||||
vm_gap_shift: 63,
|
||||
is_writable: true,
|
||||
}],
|
||||
&config,
|
||||
&DEFAULT_CONFIG,
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
@@ -3675,7 +3670,7 @@ mod tests {
|
||||
vm_gap_shift: 63,
|
||||
is_writable: true,
|
||||
}],
|
||||
&config,
|
||||
&DEFAULT_CONFIG,
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
@@ -3715,7 +3710,7 @@ mod tests {
|
||||
vm_gap_shift: 63,
|
||||
is_writable: true,
|
||||
}],
|
||||
&config,
|
||||
&DEFAULT_CONFIG,
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
|
Reference in New Issue
Block a user