~/bend-docscommunity

bolt/rules/suspicious/fuel.bend fails

raw source on the hub · import 0x729eecea86ea5a2cdba3a2856a313bca/bolt/rules/suspicious/fuel.bend as Fuel

rule fuel: a call to a def of the same file passes a Nat literal (1000n) where that def takes its fuel (a parameter named fuel, gas, steps or budget, or starting with fuel). The fuel-0 arm returns what it has, so input past the literal comes out cut short, with no error (a JSON printer that stopped at 1000 tasks). Inside a law, the checker unrolls the fixed fuel and hangs. Derive the fuel from the input's size (Nat.mul(size, 4n)) or take it as a parameter. A def's own calls are exempt: its step passes fuel - 1, not a literal.

7 imports
import Base
import ../../src.bend as Src
import ../../../lazy/lazy.bend as Lazy
import ../../finding.bend as F
import ../../../syntax/lex.bend as Lex
import ../../../syntax/tree.bend as Tree
import ../../../syntax/bind.bend as Bind