Skip to content

Commit ce93756

Browse files
Add comments to the No*InContext error paths
Signed-off-by: Jacinta Ferrant <jacinta@stackslabs.com>
1 parent 9bc47c3 commit ce93756

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

clarity/src/vm/variables.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,14 @@ pub fn lookup_reserved_variable(
5858
{
5959
match variable {
6060
NativeVariables::TxSender => {
61+
// This `NoSenderInContext` is **unreachable** in standard Clarity VM execution.
62+
// - Every function call (public, private, or trait) is executed with a valid caller context.
6163
let sender = env.sender.clone().ok_or(RuntimeError::NoSenderInContext)?;
6264
Ok(Some(Value::Principal(sender)))
6365
}
6466
NativeVariables::ContractCaller => {
67+
// This `NoCallerInContext` is **unreachable** in standard Clarity VM execution.
68+
// - Every on-chain transaction and contract-call has a well-defined sender.
6569
let caller = env.caller.clone().ok_or(RuntimeError::NoCallerInContext)?;
6670
Ok(Some(Value::Principal(caller)))
6771
}

0 commit comments

Comments
 (0)