Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.

Commit 179b406

Browse files
ripatel-fdriptl
andauthored
runtime: make {Stored,Account}Meta repr(C) (#30027)
Co-authored-by: Richard Patel <[email protected]>
1 parent 04a6a63 commit 179b406

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

runtime/src/append_vec.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,29 +148,31 @@ impl<'a: 'b, 'b, T: ReadableAccount + Sync + 'b, U: StorableAccounts<'a, T>, V:
148148
/// This struct will be backed by mmaped and snapshotted data files.
149149
/// So the data layout must be stable and consistent across the entire cluster!
150150
#[derive(Clone, PartialEq, Eq, Debug)]
151+
#[repr(C)]
151152
pub struct StoredMeta {
152153
/// global write version
153154
/// This will be made completely obsolete such that we stop storing it.
154155
/// We will not support multiple append vecs per slot anymore, so this concept is no longer necessary.
155156
/// Order of stores of an account to an append vec will determine 'latest' account data per pubkey.
156157
pub write_version_obsolete: StoredMetaWriteVersion,
158+
pub data_len: u64,
157159
/// key for the account
158160
pub pubkey: Pubkey,
159-
pub data_len: u64,
160161
}
161162

162163
/// This struct will be backed by mmaped and snapshotted data files.
163164
/// So the data layout must be stable and consistent across the entire cluster!
164165
#[derive(Serialize, Deserialize, Clone, Debug, Default, Eq, PartialEq)]
166+
#[repr(C)]
165167
pub struct AccountMeta {
166168
/// lamports in the account
167169
pub lamports: u64,
170+
/// the epoch at which this account will next owe rent
171+
pub rent_epoch: Epoch,
168172
/// the program that owns this account. If executable, the program that loads this account.
169173
pub owner: Pubkey,
170174
/// this account's data contains a loaded program (and is now read-only)
171175
pub executable: bool,
172-
/// the epoch at which this account will next owe rent
173-
pub rent_epoch: Epoch,
174176
}
175177

176178
impl<'a, T: ReadableAccount> From<&'a T> for AccountMeta {

0 commit comments

Comments
 (0)