Repository: lambdaclass/cairo-vm (language: rust)

Issue:
Document ResourceTracker trait
Add documentation to the ResourceTracker trait explaining what each function should do.
We need to add this, since in case, any developer wants to create a new HintProcessorLogic with execute_hint_extensive, they should implement it


Discussion / hints:

Fix patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 64620c5850..4fa43f44d3 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -2,6 +2,8 @@
 
 #### Upcoming Changes
 
+* feat: Add doc + default impl for ResourceTracker trait [#1576] (https://github.com/lambdaclass/cairo-vm/pull/1576)
+
 * feat: Add `air_private_input` flag to `cairo1-run` [#1559] (https://github.com/lambdaclass/cairo-vm/pull/1559)
 
 * feat: Add `args` flag to `cairo1-run` [#15551] (https://github.com/lambdaclass/cairo-vm/pull/15551)
diff --git a/vm/src/vm/runners/cairo_runner.rs b/vm/src/vm/runners/cairo_runner.rs
index 11cc89dc3c..2aa7362b12 100644
--- a/vm/src/vm/runners/cairo_runner.rs
+++ b/vm/src/vm/runners/cairo_runner.rs
@@ -88,14 +88,26 @@ pub struct RunResources {
     n_steps: Option<usize>,
 }
 
+/// 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](cairo_vm::hint_processor::builtin_hint_processor::builtin_hint_processor_definition::BuiltinHintProcessor)
 pub trait ResourceTracker {
-    fn consumed(&self) -> bool;
-
-    fn consume_step(&mut self);
-
-    fn get_n_steps(&self) -> Option<usize>;
-
-    fn run_resources(&self) -> &RunResources;
+    /// Returns true if there are no more steps left to run
+    fn consumed(&self) -> bool {
+        false
+    }
+    /// Subtracts 1 step from the available steps
+    fn consume_step(&mut self) {}
+    /// Returns the available steps for the run
+    fn get_n_steps(&self) -> Option<usize> {
+        None
+    }
+    /// Returns a reference to the available resources
+    fn run_resources(&self) -> &RunResources {
+        &RunResources { n_steps: None }
+    }
 }
 
 impl RunResources {


Test patch: