Skip to content

Commit 3e9af52

Browse files
committed
Move NON_DUP_MARKER const
1 parent aedc379 commit 3e9af52

File tree

6 files changed

+10
-9
lines changed

6 files changed

+10
-9
lines changed

sdk/pinocchio/src/account_info.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -834,7 +834,7 @@ impl<T: ?Sized> Drop for RefMut<'_, T> {
834834
mod tests {
835835
use core::mem::{size_of, MaybeUninit};
836836

837-
use crate::NON_DUP_MARKER as NOT_BORROWED;
837+
use crate::entrypoint::NON_DUP_MARKER as NOT_BORROWED;
838838

839839
use super::*;
840840

sdk/pinocchio/src/entrypoint/lazy.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
44
use crate::{
55
account_info::{Account, AccountInfo},
6-
entrypoint::STATIC_ACCOUNT_DATA,
6+
entrypoint::{NON_DUP_MARKER, STATIC_ACCOUNT_DATA},
77
program_error::ProgramError,
88
pubkey::Pubkey,
9-
BPF_ALIGN_OF_U128, NON_DUP_MARKER,
9+
BPF_ALIGN_OF_U128,
1010
};
1111

1212
/// Declare the lazy program entrypoint.

sdk/pinocchio/src/entrypoint/mod.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use core::{
1919
use crate::{
2020
account_info::{Account, AccountInfo, MAX_PERMITTED_DATA_INCREASE},
2121
pubkey::Pubkey,
22-
BPF_ALIGN_OF_U128, MAX_TX_ACCOUNTS, NON_DUP_MARKER,
22+
BPF_ALIGN_OF_U128, MAX_TX_ACCOUNTS,
2323
};
2424

2525
/// Start address of the memory region used for program heap.
@@ -39,6 +39,9 @@ pub type ProgramResult = super::ProgramResult;
3939
/// Return value for a successful program execution.
4040
pub const SUCCESS: u64 = super::SUCCESS;
4141

42+
/// Value used to indicate that a serialized account is not a duplicate.
43+
pub const NON_DUP_MARKER: u8 = u8::MAX;
44+
4245
/// The "static" size of an account in the input buffer.
4346
///
4447
/// This is the size of the account header plus the maximum permitted data increase.

sdk/pinocchio/src/lib.rs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -256,9 +256,6 @@ pub const MAX_TX_ACCOUNTS: usize = (u8::MAX - 1) as usize;
256256
/// for some host machines.
257257
const BPF_ALIGN_OF_U128: usize = 8;
258258

259-
/// Value used to indicate that a serialized account is not a duplicate.
260-
const NON_DUP_MARKER: u8 = u8::MAX;
261-
262259
/// Return value for a successful program execution.
263260
pub const SUCCESS: u64 = 0;
264261

sdk/pinocchio/src/sysvars/slot_hashes/test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ fn test_from_account_info_constructor() {
424424
ptr::write(
425425
header_ptr,
426426
AccountLayout {
427-
borrow_state: crate::NON_DUP_MARKER,
427+
borrow_state: crate::entrypoint::NON_DUP_MARKER,
428428
is_signer: 0,
429429
is_writable: 0,
430430
executable: 0,

sdk/pinocchio/src/sysvars/slot_hashes/test_edge.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ use super::test_utils::{build_slot_hashes_bytes as raw_slot_hashes, make_account
55
#[test]
66
fn test_wrong_key_from_account_info() {
77
let bytes = raw_slot_hashes(0, &[]);
8-
let (info, _backing) = unsafe { make_account_info([1u8; 32], &bytes, crate::NON_DUP_MARKER) };
8+
let (info, _backing) =
9+
unsafe { make_account_info([1u8; 32], &bytes, crate::entrypoint::NON_DUP_MARKER) };
910
assert!(matches!(
1011
SlotHashes::from_account_info(&info),
1112
Err(ProgramError::InvalidArgument)

0 commit comments

Comments
 (0)