pub trait ExecTracker<J: Jet> {
// Provided method
fn visit_node(
&mut self,
_node: &RedeemNode<J>,
_input: FrameIter<'_>,
_output: NodeOutput<'_>,
) { ... }
}Expand description
An object which can be used to introspect the execution of the Bit Machine.
If this tracker records accesses to the left and right children of Case nodes, you
may want to also implement PruneTracker so that this data can be used by
RedeemNode::prune_with_tracker to prune the program. The most straightforward
way to do this is to embed a SetTracker in your tracker and forward all the trait
methods to that.
Provided Methods§
Sourcefn visit_node(
&mut self,
_node: &RedeemNode<J>,
_input: FrameIter<'_>,
_output: NodeOutput<'_>,
)
fn visit_node( &mut self, _node: &RedeemNode<J>, _input: FrameIter<'_>, _output: NodeOutput<'_>, )
Called immediately after a specific node of the program is executed, but before its children are executed.
More precisely, this iterates through the through the Simplicity program tree in
pre ordering. That is, for the program comp iden unit the nodes will be visited
in the order comp, iden, unit.
This method can be used for logging, to track left or right accesses of the children of a
Case node (to do this, call input.peek_bit(); false means left and true means right),
to extract debug information (which may be embedded in the hidden CMR in AssertL
and AssertR nodes, depending how the program was constructed), and so on.
The provided arguments are:
nodeis the node which was just visited.inputis an iterator over the read frame when the node’s execution began- for terminal nodes (
witness,unit,idenand jets),outputis an iterator the write frame after the node has executed. SeeNodeOutputfor more information.