Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.
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
7 changes: 7 additions & 0 deletions Cargo.lock

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

9 changes: 8 additions & 1 deletion instruction-padding/program/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,18 @@ test-sbf = []

[dependencies]
num_enum = "0.7.3"
solana-program = "2.1.0"
solana-account-info = "2.1.0"
solana-cpi = "2.1.0"
solana-instruction = { version = "2.1.0", features = ["std"] }
solana-program-entrypoint = "2.1.0"
solana-program-error = "2.1.0"
solana-pubkey = "2.1.0"

[dev-dependencies]
solana-program = "2.1.0"
solana-program-test = "2.1.0"
solana-sdk = "2.1.0"
static_assertions = "1.1.0"

[lib]
crate-type = ["cdylib", "lib"]
Expand Down
6 changes: 4 additions & 2 deletions instruction-padding/program/src/entrypoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@

#![cfg(not(feature = "no-entrypoint"))]

use solana_program::{account_info::AccountInfo, entrypoint::ProgramResult, pubkey::Pubkey};
use {
solana_account_info::AccountInfo, solana_program_error::ProgramResult, solana_pubkey::Pubkey,
};

solana_program::entrypoint!(process_instruction);
solana_program_entrypoint::entrypoint!(process_instruction);
fn process_instruction(
program_id: &Pubkey,
accounts: &[AccountInfo],
Expand Down
23 changes: 17 additions & 6 deletions instruction-padding/program/src/instruction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,26 @@
use {
num_enum::{IntoPrimitive, TryFromPrimitive},
solana_program::{
instruction::{AccountMeta, Instruction},
program_error::ProgramError,
pubkey::Pubkey,
syscalls::{MAX_CPI_ACCOUNT_INFOS, MAX_CPI_INSTRUCTION_DATA_LEN},
},
solana_instruction::{AccountMeta, Instruction},
solana_program_error::ProgramError,
solana_pubkey::Pubkey,
std::{convert::TryInto, mem::size_of},
};

const MAX_CPI_ACCOUNT_INFOS: usize = 128;
const MAX_CPI_INSTRUCTION_DATA_LEN: u64 = 10 * 1024;

#[cfg(test)]
static_assertions::const_assert_eq!(
MAX_CPI_ACCOUNT_INFOS,
solana_program::syscalls::MAX_CPI_ACCOUNT_INFOS
);
#[cfg(test)]
static_assertions::const_assert_eq!(
MAX_CPI_INSTRUCTION_DATA_LEN,
solana_program::syscalls::MAX_CPI_INSTRUCTION_DATA_LEN
);
Comment on lines +14 to +23
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!


/// Instructions supported by the padding program, which takes in additional
/// account data or accounts and does nothing with them. It's meant for testing
/// larger transactions with bench-tps.
Expand Down
7 changes: 5 additions & 2 deletions instruction-padding/program/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@ mod entrypoint;
pub mod instruction;
pub mod processor;

pub use solana_program;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Breaking change, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah oops! I thought I pushed up the latest change, which re-exports the new solana crates. But yes, this is otherwise breaking

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess if it's a breaking change anyway, do we want to still have the re-exports? Or should we just do away with them?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It can't hurt in case someone needs to access it

solana_program::declare_id!("iXpADd6AW1k5FaaXum5qHbSqyd7TtoN6AD7suVa83MF");
pub use {
solana_account_info, solana_cpi, solana_instruction, solana_program_entrypoint,
solana_program_error, solana_pubkey,
};
solana_pubkey::declare_id!("iXpADd6AW1k5FaaXum5qHbSqyd7TtoN6AD7suVa83MF");
13 changes: 5 additions & 8 deletions instruction-padding/program/src/processor.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,10 @@
use {
crate::instruction::{PadInstruction, WrapData},
solana_program::{
account_info::AccountInfo,
entrypoint::ProgramResult,
instruction::{AccountMeta, Instruction},
program::invoke,
program_error::ProgramError,
pubkey::Pubkey,
},
solana_account_info::AccountInfo,
solana_cpi::invoke,
solana_instruction::{AccountMeta, Instruction},
solana_program_error::{ProgramError, ProgramResult},
solana_pubkey::Pubkey,
std::convert::TryInto,
};

Expand Down