docs: correct STATIC_ACCOUNT_DATA doc comment#325
docs: correct STATIC_ACCOUNT_DATA doc comment#325alnoki wants to merge 1 commit intoanza-xyz:mainfrom
STATIC_ACCOUNT_DATA doc comment#325Conversation
STATIC_ACCOUNT_DATA doc commentSTATIC_ACCOUNT_DATA doc comment
febo
left a comment
There was a problem hiding this comment.
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.
@febo I am confused by your comment, since rent epoch is indeed serialized into the input buffer and the doc comment says 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,
} |
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. |
Currently, the
STATIC_ACCOUNT_DATAdoc comment is technically wrong since the static size of an account in the input buffer also includes theu64rent epoch field.Correct the existing description, and add a clarifying comment regarding the nature of serialization order