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
4 changes: 2 additions & 2 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 Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ consolidate-commits = false
mollusk-svm = "0.4.0"
mollusk-svm-fuzz-fixture = "0.4.0"
num-traits = "0.2"
pinocchio = "0.9"
pinocchio = "0.9.2"
solana-instruction = "2.3.0"
solana-program-error = "2.2.2"
solana-program-option = "2.2.1"
Expand Down
32 changes: 0 additions & 32 deletions p-interface/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,3 @@ pub mod state;
pub mod program {
pinocchio_pubkey::declare_id!("TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA");
}

/// A "dummy" function with a hint to the compiler that it is unlikely to be
/// called.
///
/// This function is used as a hint to the compiler to optimize other code paths
/// instead of the one where the function is used.
#[cold]
pub const fn cold_path() {}

/// Return the given `bool` value with a hint to the compiler that `true` is the
/// likely case.
#[inline(always)]
pub const fn likely(b: bool) -> bool {
if b {
true
} else {
cold_path();
false
}
}

/// Return a given `bool` value with a hint to the compiler that `false` is the
/// likely case.
#[inline(always)]
pub const fn unlikely(b: bool) -> bool {
if b {
cold_path();
true
} else {
false
}
}
3 changes: 1 addition & 2 deletions p-interface/src/state/account.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use {
super::{account_state::AccountState, COption, Initializable, Transmutable},
crate::likely,
pinocchio::{program_error::ProgramError, pubkey::Pubkey},
pinocchio::{hint::likely, program_error::ProgramError, pubkey::Pubkey},
};

/// Incinerator address.
Expand Down
3 changes: 1 addition & 2 deletions p-token/src/processor/mod.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use {
core::{slice::from_raw_parts, str::from_utf8_unchecked},
pinocchio::{
account_info::AccountInfo, program_error::ProgramError, pubkey::Pubkey,
account_info::AccountInfo, hint::unlikely, program_error::ProgramError, pubkey::Pubkey,
syscalls::sol_memcpy_, ProgramResult,
},
pinocchio_token_interface::{
Expand All @@ -12,7 +12,6 @@ use {
multisig::{Multisig, MAX_SIGNERS},
Transmutable,
},
unlikely,
},
};

Expand Down
5 changes: 3 additions & 2 deletions p-token/src/processor/shared/transfer.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
use {
crate::processor::{check_account_owner, validate_owner},
pinocchio::{account_info::AccountInfo, program_error::ProgramError, ProgramResult},
pinocchio::{
account_info::AccountInfo, hint::unlikely, program_error::ProgramError, ProgramResult,
},
pinocchio_token_interface::{
error::TokenError,
state::{account::Account, load, load_mut, load_mut_unchecked, mint::Mint},
unlikely,
},
};

Expand Down