Skip to content

docs: correct STATIC_ACCOUNT_DATA doc comment#325

Closed
alnoki wants to merge 1 commit intoanza-xyz:mainfrom
alnoki:mention-rent-epoch
Closed

docs: correct STATIC_ACCOUNT_DATA doc comment#325
alnoki wants to merge 1 commit intoanza-xyz:mainfrom
alnoki:mention-rent-epoch

Conversation

@alnoki
Copy link

@alnoki alnoki commented Feb 4, 2026

Currently, the STATIC_ACCOUNT_DATA doc comment is technically wrong since the static size of an account in the input buffer also includes the u64 rent epoch field.

Correct the existing description, and add a clarifying comment regarding the nature of serialization order

@alnoki alnoki changed the title doc: correct STATIC_ACCOUNT_DATA doc comment docs: correct STATIC_ACCOUNT_DATA doc comment Feb 4, 2026
@alnoki
Copy link
Author

alnoki commented Feb 4, 2026

@febo

Copy link
Collaborator

@febo febo left a comment

Choose a reason for hiding this comment

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

Not sure about this change. A RuntimeAccount does not have a rent epoch field, so the comment is accurate in that sense. Also, rent epoch is deprecated.

@alnoki
Copy link
Author

alnoki commented Feb 24, 2026

A RuntimeAccount does not have a rent epoch field

@febo I am confused by your comment, since rent epoch is indeed serialized into the input buffer and the doc comment says The "static" size of an account in the input buffer

Since rent epoch is included in the input buffer, it's required for deriving accurate offsets like in the below example (if rent epoch is excluded, ASM programs using offsets derived from the input buffer exhibit undefined behavior):

use pinocchio::RuntimeAccount as RuntimeAccountHeader;

#[repr(C)]
pub struct RuntimeAccount<const DATA_SIZE: usize> {
    pub header: RuntimeAccountHeader,
    pub data: [u8; DATA_SIZE],
    pub rent_epoch: u64,
}

type EmptyRuntimeAccount = RuntimeAccount<{ runtime_data_size(data::DATA_LEN_ZERO as usize) }>;

#[repr(C, packed)]
/// Input buffer header for all instructions.
pub struct InputBufferHeader {
    pub n_accounts: u64,
    pub user: EmptyRuntimeAccount,
    pub tree_header: RuntimeAccountHeader,
}

@febo
Copy link
Collaborator

febo commented Feb 24, 2026

Since rent epoch is included in the input buffer, it's required for deriving accurate offsets like in the below example (if rent epoch is excluded, ASM programs using offsets derived from the input buffer exhibit undefined behavior):

I meant that the constant only refers to the account size and rent epoch is not part of it. Additionally, before rent epoch there are also padding bytes. Since rent epoch is deprecated, it can be considered padding. I think it will be confusing to refer to rent epoch going forwards, it is a concept that does not exist.

Another PR is adding a detailed description of what is in the input buffer.

@alnoki
Copy link
Author

alnoki commented Feb 27, 2026

@alnoki alnoki closed this Feb 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants