Skip to content
Open
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
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ members = [
edition = "2021"
license = "Apache-2.0"
repository = "https://github.com/anza-xyz/pinocchio"
rust-version = "1.79"
rust-version = "1.84"

[workspace.dependencies]
five8_const = "0.1.4"
Expand All @@ -28,12 +28,12 @@ regex = "1"
syn = "1.0"

[workspace.metadata.cli]
solana = "2.2.0"
solana = "2.3.0"

[workspace.metadata.toolchains]
build = "1.84.1"
format = "nightly-2024-11-22"
lint = "nightly-2024-11-22"
format = "nightly-2025-02-16"
lint = "nightly-2025-02-16"
test = "1.84.1"

[workspace.metadata.release]
Expand Down
2 changes: 1 addition & 1 deletion sdk/pinocchio/src/account_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ pub(crate) struct Account {
/// - `7 6 5 4 3 2 1 0`
/// - `. x x x . . . .`: number of immutable borrows that can still be
/// allocated, for the lamports field. Ranges from 7 (`111`) to
/// 0 (`000`).
/// 0 (`000`).
///
/// * data mutable borrow flag
/// - `7 6 5 4 3 2 1 0`
Expand Down
12 changes: 9 additions & 3 deletions sdk/pinocchio/src/entrypoint/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ pub use alloc::BumpAllocator;
use core::{
cmp::min,
mem::{size_of, MaybeUninit},
ptr::with_exposed_provenance_mut,
slice::from_raw_parts,
};

Expand Down Expand Up @@ -195,9 +196,14 @@ macro_rules! program_entrypoint {
/// Align a pointer to the BPF alignment of [`u128`].
macro_rules! align_pointer {
($ptr:ident) => {
// integer-to-pointer cast: the resulting pointer will have the same provenance as
// the original pointer and it follows the alignment requirement for the input.
(($ptr as usize + (BPF_ALIGN_OF_U128 - 1)) & !(BPF_ALIGN_OF_U128 - 1)) as *mut u8
// Integer-to-pointer cast: first compute the aligned address as a `usize`,
// since this is more CU-efficient than using `ptr::align_offset()` or the
// strict provenance API (e.g., `ptr::with_addr()`). Then cast the result
// back to a pointer. The resulting pointer is guaranteed to be valid
// becauseit follows the layout serialized by the runtime.
with_exposed_provenance_mut(
($ptr.expose_provenance() + (BPF_ALIGN_OF_U128 - 1)) & !(BPF_ALIGN_OF_U128 - 1),
)
};
}

Expand Down
2 changes: 1 addition & 1 deletion sdk/pinocchio/src/sysvars/slot_hashes/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ fn test_from_account_info_constructor() {
unsafe {
let header_size = core::mem::size_of::<AccountLayout>();
let total_size = header_size + data.len();
let word_len = (total_size + 7) / 8;
let word_len = total_size.div_ceil(8);
aligned_backing = std::vec![0u64; word_len];
let base_ptr = aligned_backing.as_mut_ptr() as *mut u8;

Expand Down
2 changes: 1 addition & 1 deletion sdk/pinocchio/src/sysvars/slot_hashes/test_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ pub unsafe fn make_account_info(
) -> (AccountInfo, Vec<u64>) {
let hdr_size = mem::size_of::<AccountLayout>();
let total = hdr_size + data.len();
let words = (total + 7) / 8;
let words = total.div_ceil(8);
let mut backing: Vec<u64> = std::vec![0u64; words];
assert!(
mem::align_of::<u64>() >= mem::align_of::<AccountLayout>(),
Expand Down