Skip to content

Commit e4524e9

Browse files
committed
loader-v4-interface: update header state as per SIMD-0176
1 parent c14ab07 commit e4524e9

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

loader-v4-interface/src/state.rs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use solana_pubkey::Pubkey;
22

3-
#[repr(u64)]
3+
#[repr(u32)]
44
#[cfg_attr(feature = "frozen-abi", derive(solana_frozen_abi_macro::AbiExample))]
55
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
66
pub enum LoaderV4Status {
@@ -17,13 +17,14 @@ pub enum LoaderV4Status {
1717
#[cfg_attr(feature = "frozen-abi", derive(solana_frozen_abi_macro::AbiExample))]
1818
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
1919
pub struct LoaderV4State {
20-
/// Slot in which the program was last deployed, retracted or initialized.
21-
pub slot: u64,
22-
/// Address of signer which can send program management instructions when the status is not finalized.
23-
/// Otherwise a forwarding to the next version of the finalized program.
24-
pub authority_address_or_next_version: Pubkey,
2520
/// Deployment status.
2621
pub status: LoaderV4Status,
22+
/// Length of the executable in bytes.
23+
pub executable_length: u32,
24+
/// Slot in which the program was last deployed, retracted or initialized.
25+
pub slot: u64,
26+
/// Address of signer which can send program management instructions.
27+
pub authority_address: Pubkey,
2728
// The raw program data follows this serialized structure in the
2829
// account's data.
2930
}
@@ -41,12 +42,10 @@ mod tests {
4142

4243
#[test]
4344
fn test_layout() {
44-
assert_eq!(offset_of!(LoaderV4State, slot), 0x00);
45-
assert_eq!(
46-
offset_of!(LoaderV4State, authority_address_or_next_version),
47-
0x08
48-
);
49-
assert_eq!(offset_of!(LoaderV4State, status), 0x28);
45+
assert_eq!(offset_of!(LoaderV4State, status), 0x00);
46+
assert_eq!(offset_of!(LoaderV4State, executable_length), 0x04);
47+
assert_eq!(offset_of!(LoaderV4State, slot), 0x08);
48+
assert_eq!(offset_of!(LoaderV4State, authority_address), 0x10);
5049
assert_eq!(LoaderV4State::program_data_offset(), 0x30);
5150
}
5251
}

0 commit comments

Comments
 (0)