|
8 | 8 | solana_sbpf::{
|
9 | 9 | aligned_memory::{AlignedMemory, Pod},
|
10 | 10 | ebpf::{HOST_ALIGN, MM_INPUT_START},
|
11 |
| - memory_region::{MemoryRegion, MemoryState}, |
| 11 | + memory_region::MemoryRegion, |
12 | 12 | },
|
13 | 13 | solana_sdk_ids::bpf_loader_deprecated,
|
14 | 14 | solana_system_interface::MAX_PERMITTED_DATA_LENGTH,
|
@@ -102,16 +102,16 @@ impl Serializer {
|
102 | 102 | self.push_region();
|
103 | 103 | let vaddr = self.vaddr;
|
104 | 104 | if !account.get_data().is_empty() {
|
105 |
| - let region = match account_data_region_memory_state(account) { |
106 |
| - MemoryState::Readable => { |
107 |
| - MemoryRegion::new_readonly(account.get_data(), self.vaddr) |
108 |
| - } |
109 |
| - MemoryState::Writable => { |
110 |
| - MemoryRegion::new_writable(account.get_data_mut()?, self.vaddr) |
111 |
| - } |
112 |
| - MemoryState::Cow(region_index) => { |
113 |
| - MemoryRegion::new_cow(account.get_data(), self.vaddr, region_index) |
114 |
| - } |
| 105 | + let region = if account.can_data_be_changed().is_err() { |
| 106 | + MemoryRegion::new_readonly(account.get_data(), self.vaddr) |
| 107 | + } else if account.is_shared() { |
| 108 | + MemoryRegion::new_cow( |
| 109 | + account.get_data(), |
| 110 | + self.vaddr, |
| 111 | + account.get_index_in_transaction() as u64, |
| 112 | + ) |
| 113 | + } else { |
| 114 | + MemoryRegion::new_writable(account.get_data_mut()?, self.vaddr) |
115 | 115 | };
|
116 | 116 | self.vaddr += region.len;
|
117 | 117 | self.regions.push(region);
|
@@ -607,18 +607,6 @@ fn deserialize_parameters_aligned<I: IntoIterator<Item = usize>>(
|
607 | 607 | Ok(())
|
608 | 608 | }
|
609 | 609 |
|
610 |
| -pub fn account_data_region_memory_state(account: &BorrowedAccount<'_>) -> MemoryState { |
611 |
| - if account.can_data_be_changed().is_ok() { |
612 |
| - if account.is_shared() { |
613 |
| - MemoryState::Cow(account.get_index_in_transaction() as u64) |
614 |
| - } else { |
615 |
| - MemoryState::Writable |
616 |
| - } |
617 |
| - } else { |
618 |
| - MemoryState::Readable |
619 |
| - } |
620 |
| -} |
621 |
| - |
622 | 610 | #[cfg(test)]
|
623 | 611 | #[allow(clippy::indexing_slicing)]
|
624 | 612 | mod tests {
|
|
0 commit comments