Docs / Guides

Input ranges

By default every argument ranges over its whole type. When a bug only exists in a narrow, meaningful region, declare it with a doc-comment line above the function:

fe
/// Vesting never releases more than the grant.
/// fuzzloom: start in 1668464000..=1700000000
pub fn prop_vested_never_exceeds_total(_ total: u128, start: u64) -> bool uses (clock: Clock) {
    vested(total, start) <= total
}
  • ..= includes the upper end and .. excludes it. Values are written in the argument's type, in decimal or hex, and may contain underscores (1_000_000).
  • The range applies everywhere: the campaign, abort recovery, mutation campaigns and differential digests. Shrinking stops at the lower end of the range instead of at zero.
  • Signed arguments: the range must be centred on zero, -k..=k or -(k+1)..=k. Signed values are stored zigzag-encoded (0, -1, 1, -2, 2, ...), and only such ranges are one contiguous block. A range like 10..=20 on an i64 is rejected with that explanation rather than silently approximated.
  • Any malformed annotation skips the target with the reason, so a typo never widens a range without you noticing:
text
  skip  prop_x  src/lib.fe:9  the range of "amount" does not fit u8
  skip  prop_y  src/lib.fe:14 the annotation names "amout", which is not an argument

In examples/token-ledger, this annotation turns a vesting overflow that 10,000 uniform inputs never reach into a failure at the first input.

Edit this page on GitHub