Skip to content

Commit

Permalink
add comments explaining already_failed situation
Browse files Browse the repository at this point in the history
  • Loading branch information
joonazan committed Jun 10, 2024
1 parent 56b35bc commit f01ee0e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/instruction_handlers/far_call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ fn far_call<const CALLING_MODE: u8, const IS_STATIC: bool, const IS_SHARD: bool>
abi.is_constructor_call,
);

// calldata has to be constructed even if we already know we will panic because
// overflowing start + length makes the heap resize even when already panicking.
let already_failed = decommit_result.is_none() || IS_SHARD && abi.shard_id != 0;

let calldata = get_far_call_calldata(raw_abi, raw_abi_is_pointer, vm, already_failed)?;
Expand Down Expand Up @@ -165,6 +167,10 @@ pub(crate) fn get_far_call_arguments(abi: U256) -> FarCallABI {
}
}

/// Forms a new fat pointer or narrows an existing one, as dictated by the ABI.
///
/// This function needs to be called even if we already know we will panic because
/// overflowing start + length makes the heap resize even when already panicking.
pub(crate) fn get_far_call_calldata(
raw_abi: U256,
is_pointer: bool,
Expand Down

0 comments on commit f01ee0e

Please sign in to comment.