Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
5 changes: 4 additions & 1 deletion Cargo.lock

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

6 changes: 4 additions & 2 deletions sdk/pinocchio/src/account_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ pub const MAX_PERMITTED_DATA_INCREASE: usize = 1_024 * 10;

/// Represents masks for borrow state of an account.
#[repr(u8)]
#[derive(Clone, Copy)]
#[derive(Clone, Copy, Debug)]
pub enum BorrowState {
/// Mask to check whether an account is already borrowed.
///
Expand Down Expand Up @@ -112,7 +112,7 @@ pub(crate) struct Account {
/// used to track borrows of the account data and lamports, given that an
/// account can be "shared" across multiple `AccountInfo` instances.
#[repr(C)]
#[derive(Clone, PartialEq, Eq)]
#[derive(Clone, Copy, PartialEq, Eq, Debug)]
pub struct AccountInfo {
/// Raw (pointer to) account data.
///
Expand Down Expand Up @@ -627,6 +627,7 @@ const LAMPORTS_BORROW_SHIFT: u8 = 4;
const DATA_BORROW_SHIFT: u8 = 0;

/// Reference to account data or lamports with checked borrow rules.
#[derive(Debug)]
pub struct Ref<'a, T: ?Sized> {
value: NonNull<T>,
state: NonNull<u8>,
Expand Down Expand Up @@ -698,6 +699,7 @@ const LAMPORTS_MUTABLE_BORROW_BITMASK: u8 = 0b_1000_0000;
const DATA_MUTABLE_BORROW_BITMASK: u8 = 0b_0000_1000;

/// Mutable reference to account data or lamports with checked borrow rules.
#[derive(Debug)]
pub struct RefMut<'a, T: ?Sized> {
value: NonNull<T>,
state: NonNull<u8>,
Expand Down
1 change: 1 addition & 0 deletions sdk/pinocchio/src/cpi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -515,6 +515,7 @@ pub fn get_return_data() -> Option<ReturnData> {
}

/// Struct to hold the return data from an invoked program.
#[derive(Debug)]
pub struct ReturnData {
/// Program that most recently set the return data.
program_id: Pubkey,
Expand Down
2 changes: 2 additions & 0 deletions sdk/pinocchio/src/entrypoint/lazy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ macro_rules! lazy_program_entrypoint {
///
/// This is a wrapper around the input buffer that provides methods to read the accounts
/// and instruction data. It is used by the lazy entrypoint to access the input data on demand.
#[derive(Debug)]
pub struct InstructionContext {
/// Pointer to the runtime input buffer to read from.
///
Expand Down Expand Up @@ -276,6 +277,7 @@ impl InstructionContext {
}

/// Wrapper type around an [`AccountInfo`] that may be a duplicate.
#[derive(Debug, Copy, Clone)]
pub enum MaybeAccount {
/// An [`AccountInfo`] that is not a duplicate.
Account(AccountInfo),
Expand Down
1 change: 1 addition & 0 deletions sdk/pinocchio/src/entrypoint/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,7 @@ mod alloc {

#[cfg(not(feature = "std"))]
/// An allocator that does not allocate memory.
#[derive(Debug, Copy, Clone)]
pub struct NoAllocator;

#[cfg(not(feature = "std"))]
Expand Down
2 changes: 1 addition & 1 deletion sdk/pinocchio/src/instruction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pub struct ProcessedSiblingInstruction {
/// This struct contains the same information as an [`AccountInfo`], but has
/// the memory layout as expected by `sol_invoke_signed_c` syscall.
#[repr(C)]
#[derive(Clone)]
#[derive(Clone, Debug, Copy)]
pub struct Account<'a> {
// Public key of the account.
key: *const Pubkey,
Expand Down
2 changes: 1 addition & 1 deletion sdk/pinocchio/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@
//! ```ignore
//! cargo build-sbf --features bpf-entrypoint
//! ```

#![warn(missing_copy_implementations, missing_debug_implementations)]
#![no_std]

#[cfg(feature = "std")]
Expand Down
2 changes: 1 addition & 1 deletion sdk/pinocchio/src/program_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
//! <https://github.com/anza-xyz/solana-sdk/blob/master/program-error/src/lib.rs>

/// Reasons the program may fail.
#[derive(Clone, Debug, Eq, PartialEq)]
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum ProgramError {
/// Allows on-chain programs to implement program-specific error types and see them returned
/// by the Solana runtime. A program-specific error may be any type that is represented as
Expand Down
2 changes: 1 addition & 1 deletion sdk/pinocchio/src/sysvars/clock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub type UnixTimestamp = i64;
///
/// All members of `Clock` start from 0 upon network boot.
#[repr(C)]
#[derive(Copy, Clone)]
#[derive(Copy, Clone, Default, Debug)]
pub struct Clock {
/// The current `Slot`.
pub slot: Slot,
Expand Down
6 changes: 3 additions & 3 deletions sdk/pinocchio/src/sysvars/fees.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use super::{clock::DEFAULT_MS_PER_SLOT, Sysvar};
use crate::impl_sysvar_get;

/// Fee calculator for processing transactions
#[derive(Debug, Clone, Copy)]
#[derive(Debug, Clone, Copy, Default)]
pub struct FeeCalculator {
/// The current cost of a signature in lamports.
/// This amount may increase/decrease over time based on cluster processing
Expand All @@ -22,7 +22,7 @@ impl FeeCalculator {
}

/// Governs the fee rate for the cluster
#[derive(Debug, Clone)]
#[derive(Debug, Clone, Copy)]
pub struct FeeRateGovernor {
/// The current cost of a signature
pub lamports_per_signature: u64,
Expand Down Expand Up @@ -74,7 +74,7 @@ impl FeeRateGovernor {
}

/// Fees sysvar
#[derive(Debug)]
#[derive(Debug, Default, Copy, Clone)]
pub struct Fees {
/// Fee calculator for processing transactions
pub fee_calculator: FeeCalculator,
Expand Down
5 changes: 3 additions & 2 deletions sdk/pinocchio/src/sysvars/instructions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ pub const INSTRUCTIONS_ID: Pubkey = [
0xc1, 0x24, 0xc6, 0x8f, 0x21, 0x56, 0x75, 0xa5, 0xdb, 0xba, 0xcb, 0x5f, 0x08, 0x00, 0x00, 0x00,
];

#[derive(Debug, Copy, Clone)]
pub struct Instructions<T>
where
T: Deref<Target = [u8]>,
Expand Down Expand Up @@ -125,7 +126,7 @@ impl<'a> TryFrom<&'a AccountInfo> for Instructions<Ref<'a, [u8]>> {
}

#[repr(C)]
#[derive(Clone, PartialEq, Eq)]
#[derive(Clone, PartialEq, Eq, Debug)]
pub struct IntrospectedInstruction<'a> {
pub raw: *const u8,
pub marker: PhantomData<&'a [u8]>,
Expand Down Expand Up @@ -212,7 +213,7 @@ const IS_SIGNER: u8 = 0b00000001;
const IS_WRITABLE: u8 = 0b00000010;

#[repr(C)]
#[derive(Clone, PartialEq, Eq)]
#[derive(Clone, PartialEq, Eq, Debug, Copy)]
pub struct IntrospectedAccountMeta {
/// Account flags:
/// * bit `0`: signer
Expand Down
2 changes: 1 addition & 1 deletion sdk/pinocchio/src/sysvars/rent.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ pub const ACCOUNT_STORAGE_OVERHEAD: u64 = 128;

/// Rent sysvar data
#[repr(C)]
#[derive(Clone, Debug)]
#[derive(Clone, Debug, Default, Copy)]
pub struct Rent {
/// Rental rate in lamports per byte-year
pub lamports_per_byte_year: u64,
Expand Down
1 change: 1 addition & 0 deletions sdk/pinocchio/src/sysvars/slot_hashes/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ pub struct SlotHashEntry {
const _: [(); 1] = [(); mem::align_of::<SlotHashEntry>()];

/// `SlotHashes` provides read-only, zero-copy access to `SlotHashes` sysvar bytes.
#[derive(Debug)]
pub struct SlotHashes<T: Deref<Target = [u8]>> {
data: T,
}
Expand Down