Skip to content

Commit

Permalink
[TieredStorage] Include executable field into AccountMetaFlags
Browse files Browse the repository at this point in the history
  • Loading branch information
yhchiang-sol committed Jan 12, 2024
1 parent 98a2873 commit dd93c7e
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion accounts-db/src/tiered_storage/meta.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ pub struct AccountMetaFlags {
pub has_rent_epoch: bool,
/// whether the account meta has account hash
pub has_account_hash: bool,
/// whether the account is executable
pub executable: bool,
/// the reserved bits.
reserved: B30,
reserved: B29,
}

// Ensure there are no implicit padding bytes
Expand Down Expand Up @@ -90,6 +92,7 @@ impl AccountMetaFlags {
let mut flags = AccountMetaFlags::default();
flags.set_has_rent_epoch(optional_fields.rent_epoch.is_some());
flags.set_has_account_hash(optional_fields.account_hash.is_some());
flags.set_executable(false);
flags
}
}
Expand Down Expand Up @@ -177,12 +180,20 @@ pub mod tests {

assert!(flags.has_rent_epoch());
assert!(!flags.has_account_hash());
assert!(!flags.executable());
verify_flags_serialization(&flags);

flags.set_has_account_hash(true);

assert!(flags.has_rent_epoch());
assert!(flags.has_account_hash());
assert!(!flags.executable());
verify_flags_serialization(&flags);

flags.set_executable(true);
assert!(flags.has_rent_epoch());
assert!(flags.has_account_hash());
assert!(flags.executable());
verify_flags_serialization(&flags);

// make sure the reserved bits are untouched.
Expand Down

0 comments on commit dd93c7e

Please sign in to comment.