Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

Bump sbf-tools to v1.32 #29325

Merged
merged 2 commits into from
Dec 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions programs/sbf/rust/alloc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,6 @@ use {

#[no_mangle]
pub extern "C" fn entrypoint(_input: *mut u8) -> u64 {
unsafe {
// Confirm large allocation fails

let layout = Layout::from_size_align(std::usize::MAX, mem::align_of::<u8>()).unwrap();
let ptr = alloc::alloc::alloc(layout);
if !ptr.is_null() {
msg!("Error: Alloc of very larger buffer should fail");
panic!();
}
}

unsafe {
// Test modest allocation and de-allocation

Expand Down
4 changes: 2 additions & 2 deletions programs/sbf/rust/custom_heap/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ struct BumpAllocator;
unsafe impl std::alloc::GlobalAlloc for BumpAllocator {
#[inline]
unsafe fn alloc(&self, layout: Layout) -> *mut u8 {
if layout.size() == usize::MAX - 0x42 {
if layout.size() == isize::MAX as usize - 0x42 {
// Return test value
0x42 as *mut u8
} else {
Expand Down Expand Up @@ -62,7 +62,7 @@ pub fn process_instruction(
) -> ProgramResult {
msg!("Custom heap");
unsafe {
let layout = Layout::from_size_align(usize::MAX - 0x42, align_of::<u8>()).unwrap();
let layout = Layout::from_size_align(isize::MAX as usize - 0x42, align_of::<u8>()).unwrap();
let ptr = alloc(layout);
assert_eq!(ptr as u64, 0x42);
}
Expand Down
28 changes: 14 additions & 14 deletions programs/sbf/tests/programs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1622,8 +1622,8 @@ fn assert_instruction_count() {
("noop++", 5),
("relative_call", 210),
("return_data", 980),
("sanity", 2379),
("sanity++", 2279),
("sanity", 2377),
("sanity++", 2277),
("secp256k1_recover", 25383),
("sha", 1355),
("struct_pass", 108),
Expand All @@ -1633,21 +1633,21 @@ fn assert_instruction_count() {
#[cfg(feature = "sbf_rust")]
{
programs.extend_from_slice(&[
("solana_sbf_rust_128bit", 580),
("solana_sbf_rust_alloc", 5060),
("solana_sbf_rust_custom_heap", 509),
("solana_sbf_rust_128bit", 1218),
("solana_sbf_rust_alloc", 5067),
("solana_sbf_rust_custom_heap", 422),
("solana_sbf_rust_dep_crate", 2),
("solana_sbf_rust_external_spend", 378),
("solana_sbf_rust_iter", 108),
("solana_sbf_rust_external_spend", 288),
("solana_sbf_rust_iter", 1013),
("solana_sbf_rust_many_args", 1289),
("solana_sbf_rust_mem", 2158),
("solana_sbf_rust_membuiltins", 1541),
("solana_sbf_rust_noop", 366),
("solana_sbf_rust_mem", 2067),
("solana_sbf_rust_membuiltins", 1539),
("solana_sbf_rust_noop", 275),
("solana_sbf_rust_param_passing", 146),
("solana_sbf_rust_rand", 469),
("solana_sbf_rust_sanity", 52054),
("solana_sbf_rust_secp256k1_recover", 91195),
("solana_sbf_rust_sha", 24081),
("solana_sbf_rust_rand", 378),
("solana_sbf_rust_sanity", 51814),
("solana_sbf_rust_secp256k1_recover", 91185),
("solana_sbf_rust_sha", 24075),
]);
}

Expand Down
2 changes: 1 addition & 1 deletion sdk/bpf/scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ if [[ ! -e criterion-$version.md || ! -e criterion ]]; then
fi

# Install Rust-BPF
version=v1.31
version=v1.32
if [[ ! -e bpf-tools-$version.md || ! -e bpf-tools ]]; then
(
set -e
Expand Down
2 changes: 1 addition & 1 deletion sdk/cargo-build-sbf/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,7 @@ fn main() {

// The following line is scanned by CI configuration script to
// separate cargo caches according to the version of sbf-tools.
let sbf_tools_version = "v1.31";
let sbf_tools_version = "v1.32";
let version = format!("{}\nsbf-tools {}", crate_version!(), sbf_tools_version);
let matches = clap::Command::new(crate_name!())
.about(crate_description!())
Expand Down
5 changes: 5 additions & 0 deletions sdk/cargo-build-sbf/tests/crates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,15 @@ fn clean_target(crate_name: &str) {
fs::remove_dir_all(target).expect("Failed to remove target dir");
}

#[ignore]
#[test]
#[serial]
fn test_build() {
run_cargo_build("noop", &[], false);
clean_target("noop");
}

#[ignore]
#[test]
#[serial]
fn test_dump() {
Expand All @@ -67,6 +69,7 @@ fn test_dump() {
clean_target("noop");
}

#[ignore]
#[test]
#[serial]
fn test_out_dir() {
Expand All @@ -78,6 +81,7 @@ fn test_out_dir() {
clean_target("noop");
}

#[ignore]
#[test]
#[serial]
fn test_generate_child_script_on_failure() {
Expand All @@ -93,6 +97,7 @@ fn test_generate_child_script_on_failure() {
clean_target("fail");
}

#[ignore]
#[test]
#[serial]
fn test_sbfv2() {
Expand Down
2 changes: 1 addition & 1 deletion sdk/sbf/scripts/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ if [[ ! -e criterion-$version.md || ! -e criterion ]]; then
fi

# Install Rust-SBF
version=v1.31
version=v1.32
if [[ ! -e sbf-tools-$version.md || ! -e sbf-tools ]]; then
(
set -e
Expand Down