Skip to content

Commit

Permalink
do not serialize executable accounts
Browse files Browse the repository at this point in the history
  • Loading branch information
seanyoung committed Dec 5, 2023
1 parent 45aa8c2 commit dd47f23
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions programs/bpf_loader/src/serialization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -335,8 +335,13 @@ fn serialize_parameters_unaligned(
s.write::<u8>(account.is_writable() as u8);
let vm_key_addr = s.write_all(account.get_key().as_ref());
let vm_lamports_addr = s.write::<u64>(account.get_lamports().to_le());
s.write::<u64>((account.get_data().len() as u64).to_le());
let vm_data_addr = s.write_account(&mut account)?;
let vm_data_addr = if account.is_executable() {
s.write::<u64>(0u64.to_le());
0
} else {
s.write::<u64>((account.get_data().len() as u64).to_le());
s.write_account(&mut account)?
};
let vm_owner_addr = s.write_all(account.get_owner().as_ref());
s.write::<u8>(account.is_executable() as u8);
s.write::<u64>((account.get_rent_epoch()).to_le());
Expand Down Expand Up @@ -471,8 +476,13 @@ fn serialize_parameters_aligned(
let vm_key_addr = s.write_all(borrowed_account.get_key().as_ref());
let vm_owner_addr = s.write_all(borrowed_account.get_owner().as_ref());
let vm_lamports_addr = s.write::<u64>(borrowed_account.get_lamports().to_le());
s.write::<u64>((borrowed_account.get_data().len() as u64).to_le());
let vm_data_addr = s.write_account(&mut borrowed_account)?;
let vm_data_addr = if borrowed_account.is_executable() {
s.write::<u64>(0u64.to_le());
0
} else {
s.write::<u64>((borrowed_account.get_data().len() as u64).to_le());
s.write_account(&mut borrowed_account)?
};
s.write::<u64>((borrowed_account.get_rent_epoch()).to_le());
accounts_metadata.push(SerializedAccountMetadata {
original_data_len: borrowed_account.get_data().len(),
Expand Down

0 comments on commit dd47f23

Please sign in to comment.