fb_fuel_checkpoint

Function fb_fuel_checkpoint 

Source
pub fn fb_fuel_checkpoint(amount: i64) -> i32
Expand description

Phase 48.13 W2b mock implementation of fb_fuel_checkpoint.

Consults the per-thread WorkerSlot’s shared_fuel_pool and performs a CAS-loop decrement that mirrors the wasmtime runtime behavior in fabricbiosd’s shared-memory dispatcher. The mock does not actually consume host-side native fuel — it only tracks the logical pool state — but the success/failure semantics match the real runtime so SDK and program tests can exercise pool exhaustion deterministically.

Returns:

  • amount == 00 (silent no-op, matches spec)
  • amount < 0-1 (programmer error, matches spec)
  • No pool installed (V1 worker simulation, or no slot) → -1
  • Pool exhausted (pool < amount) → -1
  • Successful debit → 0