Skip to main content

Module strategies

Module strategies 

Source

ModulesΒ§

calldata πŸ”’
int πŸ”’
invariants πŸ”’
literals πŸ”’
mutators πŸ”’
param πŸ”’
state πŸ”’
tx πŸ”’
uint πŸ”’

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).
EvmFuzzState
Immutable fuzz dictionary seed used by parallel stateless fuzz workers.
FuzzState
Worker-local fuzz state.
IntStrategy
Value tree for signed ints (up to int256). The strategy combines 3 different strategies, each assigned a specific weight:
LiteralMaps
LiteralsCollector
LiteralsDictionary
TxGenerator
Concrete generator for stateless and invariant transactions.
UintStrategy
Value tree for unsigned ints (up to uint256). The strategy combines 3 different strategies, each assigned a specific weight:

TraitsΒ§

BoundMutator
Mutator that bounds the current value of an uint or int in the given range. The mutated value is always different from the current value.
DictionaryRead πŸ”’

FunctionsΒ§

constrain_enum_value πŸ”’
Constrains enum leaves in a decoded value to the range declared by its Solidity type.
fuzz_calldata
Given a function, it returns a strategy which generates valid calldata for that function’s input types, following declared test fixtures.
fuzz_calldata_from_state πŸ”’
Given a function and some state, it returns a strategy which generated valid calldata for the given function’s input types, based on state taken from the EVM.
fuzz_msg_value
Returns a proptest strategy for generating random msg.value for payable functions.
fuzz_param
Given a parameter type, returns a strategy for generating values for that type.
fuzz_param_from_state πŸ”’
Given a parameter type, returns a strategy for generating values for that type, given some EVM fuzz state.
fuzz_param_with_fixtures
Given a parameter type and configured fixtures for param name, returns a strategy for generating values for that type.
generate_msg_value
Generates a msg.value for payable functions using TestRunner’s RNG (corpus mutation path).
mutate_param_value πŸ”’
Mutates the current value of the given parameter type and value.
override_call_strat
Given a target address, we generate random calldata.