Skip to content

Commit

Permalink
move MAX_PERMITTED_DATA_INCREASE to account-info crate
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinheavey committed Sep 24, 2024
1 parent a35840c commit 773906e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
4 changes: 2 additions & 2 deletions sdk/account-info/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ use {
};
pub mod debug_account_data;

// inline from solana_program::entrypoint
const MAX_PERMITTED_DATA_INCREASE: usize = 1_024 * 10;
/// Maximum number of bytes a program may add to an account during a single realloc
pub const MAX_PERMITTED_DATA_INCREASE: usize = 1_024 * 10;

/// Account information
#[derive(Clone)]
Expand Down
6 changes: 1 addition & 5 deletions sdk/program/src/entrypoint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
//! [`bpf_loader`]: crate::bpf_loader
extern crate alloc;
pub use solana_program_error::ProgramResult;
use {
crate::{account_info::AccountInfo, pubkey::Pubkey},
alloc::vec::Vec,
Expand All @@ -18,6 +17,7 @@ use {
slice::{from_raw_parts, from_raw_parts_mut},
},
};
pub use {solana_account_info::MAX_PERMITTED_DATA_INCREASE, solana_program_error::ProgramResult};

/// User implemented function to process an instruction
///
Expand Down Expand Up @@ -310,10 +310,6 @@ unsafe impl std::alloc::GlobalAlloc for BumpAllocator {
}
}

// WARNING: if this is changed, the duplicate definition in solana_account_info must also be changed
/// Maximum number of bytes a program may add to an account during a single realloc
pub const MAX_PERMITTED_DATA_INCREASE: usize = 1_024 * 10;

/// `assert_eq(std::mem::align_of::<u128>(), 8)` is true for BPF but not for some host machines
pub const BPF_ALIGN_OF_U128: usize = 8;

Expand Down

0 comments on commit 773906e

Please sign in to comment.