Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: reduce max cpi data size to packet size #2997

Closed
wants to merge 1 commit into from
Closed
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
2 changes: 1 addition & 1 deletion programs/sbf/tests/programs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -960,7 +960,7 @@ fn test_program_sbf_invoke_sanity() {
format!("Program log: invoke {program_lang} program"),
"Program log: Test max instruction data len exceeded".into(),
"skip".into(), // don't compare compute consumption logs
format!("Program {invoke_program_id} failed: Invoked an instruction with data that is too large (10241 > 10240)"),
format!("Program {invoke_program_id} failed: Invoked an instruction with data that is too large (1233 > 1232)"),
]),
);

Expand Down
8 changes: 4 additions & 4 deletions sdk/program/src/syscalls/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ mod definitions;
#[cfg(target_os = "solana")]
pub use definitions::*;

/// Maximum CPI instruction data size. 10 KiB was chosen to ensure that CPI
/// instructions are not more limited than transaction instructions if the size
/// of transactions is doubled in the future.
pub const MAX_CPI_INSTRUCTION_DATA_LEN: u64 = 10 * 1024;
/// Maximum CPI instruction data size. 1232 bytes was chosen so that CPI
/// instructions are limited similarly to transaction instructions
/// and use the same limit as `program_utils::limited_deserialize`.
pub const MAX_CPI_INSTRUCTION_DATA_LEN: u64 = 1232;

/// Maximum CPI instruction accounts. 255 was chosen to ensure that instruction
/// accounts are always within the maximum instruction account limit for SBF
Expand Down
8 changes: 4 additions & 4 deletions sdk/sbf/c/inc/sol/cpi.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ extern "C" {
#endif

/**
* Maximum CPI instruction data size. 10 KiB was chosen to ensure that CPI
* instructions are not more limited than transaction instructions if the size
* of transactions is doubled in the future.
* Maximum CPI instruction data size. 1232 bytes was chosen so that CPI
* instructions are limited similarly to transaction instructions
* and use the same limit as `program_utils::limited_deserialize`.
*/
static const uint64_t MAX_CPI_INSTRUCTION_DATA_LEN = 10240;
static const uint64_t MAX_CPI_INSTRUCTION_DATA_LEN = 1232;

/**
* Maximum CPI instruction accounts. 255 was chosen to ensure that instruction
Expand Down
8 changes: 4 additions & 4 deletions sdk/sbf/c/inc/sol/inc/cpi.inc
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ extern "C" {
#endif

/**
* Maximum CPI instruction data size. 10 KiB was chosen to ensure that CPI
* instructions are not more limited than transaction instructions if the size
* of transactions is doubled in the future.
* Maximum CPI instruction data size. 1232 bytes was chosen so that CPI
* instructions are limited similarly to transaction instructions
* and use the same limit as `program_utils::limited_deserialize`.
*/
static const uint64_t MAX_CPI_INSTRUCTION_DATA_LEN = 10240;
static const uint64_t MAX_CPI_INSTRUCTION_DATA_LEN = 1232;

/**
* Maximum CPI instruction accounts. 255 was chosen to ensure that instruction
Expand Down
Loading