Skip to main content

Module literals

Module literals 

Source

StructsΒ§

EnumBounds
Maps Solidity enum definitions to their variant counts, used to constrain fuzzed enum inputs to valid values (the ABI encodes enums as uint8 without carrying the variant count).
EnumBoundsCollector πŸ”’
AST visitor that records enum variant counts, tracking the enclosing contract to build fully-qualified keys.
LiteralMaps
LiteralsCollector
LiteralsDictionary

EnumsΒ§

Num πŸ”’
A folded constant value. Opportunistic 256-bit heuristic, not a Solidity-correct folder.

ConstantsΒ§

MAX_FOLD_DEPTH πŸ”’
Maximum nesting depth LiteralsCollector::eval recurses into, to bound stack usage.

FunctionsΒ§

apply_bin πŸ”’
Applies a binary operator to two folded numeric values, carrying the result width so narrow operands produce in-range results.
can_fit_int πŸ”’
Checks if a signed integer value can fit in intN type.
can_fit_uint πŸ”’
Checks if an unsigned integer value can fit in uintN type.
cast_num πŸ”’
Reinterprets a folded value for an elementary type cast used inside a larger expression, applying the target width so truncation and sign-extension are correct (e.g. int256(uint256(type(uint256).max)) -> -1).
cast_to_bytes πŸ”’
Casts a folded value to bytesN, keeping the value right-aligned in Num::Bytes.
checked_arith πŸ”’
Resolves a default-checked unsigned arithmetic result.
combine_width πŸ”’
Combines the widths of two operands: an untyped operand (None) inherits the other’s width; two explicit widths pick the wider.
lit_bytes πŸ”’
Extracts the raw bytes of a string, unicode, or hex string literal argument, borrowing them directly from the interner to avoid allocating (and re-hashing) on every fold.
low_bits πŸ”’
Returns the low bits of value, zeroing everything above.
shift_amount πŸ”’
Returns the shift amount as a usize, or None if it is >= 256 (which shifts out all bits).
sign_extend πŸ”’
Sign-extends the low width bits of raw to a full 256-bit two’s-complement value.
signed_pow πŸ”’
Folds a signed base ** exp, returning None on a negative exponent or a magnitude that doesn’t fit the signed range (overflow ~ compile error).
single_arg πŸ”’
Returns the single positional argument of a call, if it has exactly one.
type_min_max πŸ”’
Folds type(uintN).max, type(intN).min, and type(intN).max (and type(uintN).min == 0).