Trait cairo_vm::vm::runners::cairo_runner::ResourceTracker

source ·
pub trait ResourceTracker {
    // Provided methods
    fn consumed(&self) -> bool { ... }
    fn consume_step(&mut self) { ... }
    fn get_n_steps(&self) -> Option<usize> { ... }
    fn run_resources(&self) -> &RunResources { ... }
}
Expand description

This trait is in charge of overseeing the VM’s step usage in contexts where a limited amount of steps are available for a single execution (which may or not involve other executions taking place in the duration of it ). This is mostly used in the context of starknet, where contracts can call other contracts while sharing the same step limit. For the general use case, the default implementation can be used, which ignores resource tracking altogether For an example on how to implement this trait for its intended purpose check out BuiltinHintProcessor

Provided Methods§

source

fn consumed(&self) -> bool

Returns true if there are no more steps left to run

source

fn consume_step(&mut self)

Subtracts 1 step from the available steps

source

fn get_n_steps(&self) -> Option<usize>

Returns the available steps for the run

source

fn run_resources(&self) -> &RunResources

Returns a reference to the available resources

Implementors§