Skip to content

Commit

Permalink
fix event tape too
Browse files Browse the repository at this point in the history
  • Loading branch information
codeblooded1729 committed Jun 17, 2024
1 parent aacbed1 commit 85b8f11
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions sdk/src/common/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use {
call_tape_read, event_tape_read, ioread_private, ioread_public, self_prog_id_tape_read,
},
rkyv::rancor::{Panic, Strategy},
rkyv::util::AlignedVec,
std::collections::BTreeSet,
};
#[cfg(not(target_os = "mozakvm"))]
Expand Down Expand Up @@ -99,8 +100,6 @@ pub(crate) static mut SYSTEM_TAPE: Lazy<SystemTape> = Lazy::new(|| {
/// This function deliberately leaks the backing buffer for the storage of the
/// returned call tape.
fn populate_call_tape(self_prog_id: ProgramIdentifier) -> CallTapeType {
use rkyv::util::AlignedVec;

let mut len_bytes = [0; 4];
call_tape_read(&mut len_bytes);
let len: usize = u32::from_le_bytes(len_bytes).try_into().unwrap();
Expand Down Expand Up @@ -144,7 +143,10 @@ fn populate_event_tape(self_prog_id: ProgramIdentifier) -> EventTapeType {
event_tape_read(&mut len_bytes);

let len: usize = u32::from_le_bytes(len_bytes).try_into().unwrap();
let buf: &'static mut Vec<u8> = Box::leak(Box::new(vec![0; len]));
let buf: &'static mut AlignedVec = Box::leak(Box::new(AlignedVec::with_capacity(len)));
unsafe {
buf.set_len(len);
}
event_tape_read(buf);

let canonical_ordered_temporal_hints =
Expand Down

0 comments on commit 85b8f11

Please sign in to comment.