Skip to main content

Module cheatcode_environment

Module cheatcode_environment 

Source
Expand description

Finds raw environment reads whose values can cross a Foundry environment mutation.

A bounded source-level interpreter follows scalar locals, tuple assignments, internal calls, and modifier placeholders. An environment setter marks matching live origins; a subsequent use reports the original read. Reads on both sides of a mutation are also reported because a compiler may reuse the earlier read. Branches retain separate states, and return, revert, break, and continue stop the corresponding path. External calls are not inlined: the callee has a separate EVM frame and its return data is already materialized. Differing helper return values and conditional-expression values are discarded instead of combining components from mutually exclusive outcomes.

This analysis runs before optimization and never changes executable code. Cheatcodes are recognized by their resolved signature and constant receiver address, including local aliases and helper arguments, rather than by a variable or interface name. Getter results carry no raw-read origin. Heap/storage aliases, indirect calls, low-level cheatcode calls, recursion, and paths beyond the explicit analysis limits are not modeled. This is a source warning, not a proof of a particular optimizer’s scheduling decisions.

StructsΒ§

Checker πŸ”’
Mutation πŸ”’
Read πŸ”’
State πŸ”’
Value πŸ”’

EnumsΒ§

Environment πŸ”’
Flow πŸ”’
Scalar πŸ”’
Exact unsigned and boolean locals used to prune exhausted loops and constant branches.

ConstantsΒ§

CHEATCODE_ADDRESS πŸ”’
MAX_CALL_DEPTH πŸ”’
MAX_LOOP_ITERATIONS πŸ”’
MAX_PATHS πŸ”’
MAX_STEPS πŸ”’

StaticsΒ§

ENVIRONMENT_READ_ACROSS_MUTATION