Skip to content
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
89 changes: 78 additions & 11 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
RUST_TOOLCHAIN_NIGHTLY = nightly-2026-01-22
RUST_TOOLCHAIN_NIGHTLY = nightly-2026-07-16
SOLANA_CLI_VERSION = 3.0.0

nightly = +${RUST_TOOLCHAIN_NIGHTLY}
Expand Down
9 changes: 8 additions & 1 deletion pinocchio/program/src/processor/mod.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#[cfg(any(target_arch = "bpf", target_os = "solana"))]
use pinocchio::syscalls::sol_memcpy_;
use {
core::{slice::from_raw_parts, str::from_utf8_unchecked},
pinocchio::{
account_info::AccountInfo,
hint::{likely, unlikely},
program_error::ProgramError,
pubkey::{pubkey_eq, Pubkey},
syscalls::sol_memcpy_,
ProgramResult,
},
pinocchio_token_interface::{
Expand Down Expand Up @@ -180,6 +181,7 @@ fn try_ui_amount_into_amount(ui_amount: &str, decimals: u8) -> Result<u64, Progr

// SAFETY: the total length of `amount_str` and `after_decimal` is less than
// `MAX_FORMATTED_DIGITS`.
#[cfg(any(target_arch = "bpf", target_os = "solana"))]
unsafe {
sol_memcpy_(digits.as_mut_ptr(), amount_str.as_ptr(), length as u64);

Expand All @@ -189,6 +191,11 @@ fn try_ui_amount_into_amount(ui_amount: &str, decimals: u8) -> Result<u64, Progr
after_decimal.len() as u64,
);
}
#[cfg(not(any(target_arch = "bpf", target_os = "solana")))]
{
digits[..length].copy_from_slice(amount_str.as_bytes());
digits[length..length + after_decimal.len()].copy_from_slice(after_decimal.as_bytes());
}

let length = amount_str.len() + decimals;

Expand Down
4 changes: 2 additions & 2 deletions pinocchio/program/tests/ui_amount_to_amount.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ fn fail_ui_amount_to_amount_with_invalid_ui_amount() {
);

// String representing the ui value `2.0`
let ui_amount = [b'2', b'.', b'0'];
let input = from_utf8(&ui_amount).unwrap();
let ui_amount = b"2.0";
let input = from_utf8(ui_amount).unwrap();

// When we try to convert the ui amount using the mint, the transaction should
// fail with an error since the resulting value does not fit in an `u64`.
Expand Down
5 changes: 1 addition & 4 deletions program/tests/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,7 @@ fn do_process_instruction(
mollusk.process_and_validate_instruction(&instruction, &instruction_accounts, checks);

// Update accounts after the instruction is processed.
for (original, (_, updated)) in accounts
.iter_mut()
.zip(result.resulting_accounts.into_iter())
{
for (original, (_, updated)) in accounts.iter_mut().zip(result.resulting_accounts) {
original.data = updated.data().to_vec();
original.lamports = updated.lamports();
original.owner = *updated.owner();
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[toolchain]
channel = "1.93.1"
channel = "1.98.1"
Loading