pub struct CallNode { /* private fields */ }
Expand description
A Call node describes a function call such that the callee is executed in a different execution context from the currently executing code.
A call node can be of two types:
- A simple call: the callee is executed in the new user context.
- A syscall: the callee is executed in the root context.
Implementations§
Source§impl CallNode
Constants
impl CallNode
Constants
Sourcepub const CALL_DOMAIN: Felt
pub const CALL_DOMAIN: Felt
The domain of the call block (used for control block hashing).
Sourcepub const SYSCALL_DOMAIN: Felt
pub const SYSCALL_DOMAIN: Felt
The domain of the syscall block (used for control block hashing).
Source§impl CallNode
Constructors
impl CallNode
Constructors
Sourcepub fn new(
callee: MastNodeId,
mast_forest: &MastForest,
) -> Result<Self, MastForestError>
pub fn new( callee: MastNodeId, mast_forest: &MastForest, ) -> Result<Self, MastForestError>
Returns a new CallNode
instantiated with the specified callee.
Sourcepub fn new_unsafe(callee: MastNodeId, digest: Word) -> Self
pub fn new_unsafe(callee: MastNodeId, digest: Word) -> Self
Returns a new CallNode
from values that are assumed to be correct.
Should only be used when the source of the inputs is trusted (e.g. deserialization).
Sourcepub fn new_syscall(
callee: MastNodeId,
mast_forest: &MastForest,
) -> Result<Self, MastForestError>
pub fn new_syscall( callee: MastNodeId, mast_forest: &MastForest, ) -> Result<Self, MastForestError>
Returns a new CallNode
instantiated with the specified callee and marked as a kernel
call.
Sourcepub fn new_syscall_unsafe(callee: MastNodeId, digest: Word) -> Self
pub fn new_syscall_unsafe(callee: MastNodeId, digest: Word) -> Self
Returns a new syscall CallNode
from values that are assumed to be correct.
Should only be used when the source of the inputs is trusted (e.g. deserialization).
Source§impl CallNode
Public accessors
impl CallNode
Public accessors
Sourcepub fn digest(&self) -> Word
pub fn digest(&self) -> Word
Returns a commitment to this Call node.
The commitment is computed as a hash of the callee and an empty word ([ZERO; 4]) in the domain defined by either Self::CALL_DOMAIN or Self::SYSCALL_DOMAIN, depending on whether the node represents a simple call or a syscall - i.e.,:
Hasher::merge_in_domain(&[callee_digest, Word::default()], CallNode::CALL_DOMAIN);
or
Hasher::merge_in_domain(&[callee_digest, Word::default()], CallNode::SYSCALL_DOMAIN);
Sourcepub fn callee(&self) -> MastNodeId
pub fn callee(&self) -> MastNodeId
Returns the ID of the node to be invoked by this call node.
Sourcepub fn is_syscall(&self) -> bool
pub fn is_syscall(&self) -> bool
Returns true if this call node represents a syscall.
Sourcepub fn before_enter(&self) -> &[DecoratorId]
pub fn before_enter(&self) -> &[DecoratorId]
Returns the decorators to be executed before this node is executed.
Sourcepub fn after_exit(&self) -> &[DecoratorId]
pub fn after_exit(&self) -> &[DecoratorId]
Returns the decorators to be executed after this node is executed.
Source§impl CallNode
Mutators
impl CallNode
Mutators
pub fn remap_children(&self, remapping: &Remapping) -> Self
Sourcepub fn append_before_enter(&mut self, decorator_ids: &[DecoratorId])
pub fn append_before_enter(&mut self, decorator_ids: &[DecoratorId])
Sets the list of decorators to be executed before this node.
Sourcepub fn append_after_exit(&mut self, decorator_ids: &[DecoratorId])
pub fn append_after_exit(&mut self, decorator_ids: &[DecoratorId])
Sets the list of decorators to be executed after this node.
Sourcepub fn remove_decorators(&mut self)
pub fn remove_decorators(&mut self)
Removes all decorators from this node.
Trait Implementations§
Source§impl MastNodeExt for CallNode
impl MastNodeExt for CallNode
Source§fn decorators(&self) -> impl Iterator<Item = (usize, DecoratorId)>
fn decorators(&self) -> impl Iterator<Item = (usize, DecoratorId)>
Source§fn get_assembly_op<'m>(
&self,
mast_forest: &'m MastForest,
target_op_idx: Option<usize>,
) -> Option<&'m AssemblyOp>
fn get_assembly_op<'m>( &self, mast_forest: &'m MastForest, target_op_idx: Option<usize>, ) -> Option<&'m AssemblyOp>
AssemblyOp
associated with this node and operation (if provided), if any. Read more