Expand description
Shared, side-effect-free HIR probes reused by Solidity lints.
ModulesΒ§
- access_
control π - Access-control guard detection: whether a function dominates its body with a check comparing the caller against contract state, and which state that check depends on.
- exprs π
- Expression-shape probes over Solar HIR (and a few AST-level ones).
- helper_
cache π - modifier_
outcome π - Control-flow summary of modifier bodies with respect to the
_placeholder. - stmts π
- Statement-shape probes over Solar HIR.
- types π
- Type probes using Solarβs type-checker results.
StructsΒ§
- Helper
Analysis Cache - Bounded memo table for lint analyses that inline internal helper calls.
- Outcome
- Summary of how control flow can leave a statement or block without having executed the
placeholder (
_) or reverted.
ConstantsΒ§
- DEFAULT_
HELPER_ ANALYSIS_ CACHE_ LIMIT - OPENZEPPELIN_
ROOTS - Package-root directory names of the OpenZeppelin distributions (npm scope and git submodules).
FunctionsΒ§
- access_
check_ polarity Some(true)whenexprholding means the caller is authorized,Some(false)when it means the caller is not authorized,Nonewhenexpris not an access check. An access check readsmsg.sender/tx.origin(directly, throughaliasesor through a helper) and state (directly or through a helper).- address_
call_ receiver - Receiver of
<expr>.{call,delegatecall,transfer,send}(value-bearing sinks), including the.call{value: x}(...)option form. - any_
subexpr - True if
predholds forexpror any of its sub-expressions. - arg_
for_ param - The argument bound to
paramoffunction_idinargs, positional or named. - ast_
bool_ literal - AST-level boolean literal, through parens.
- block_
outcome - branch_
always_ exits - True when executing
stmtprovably prevents control from continuing past it:return,revert,selfdestruct,require(false, ..)/assert(false), a block containing any such statement, anifwhose both arms exit, atrywhose every clause exits, or ado-whilewhose body exits withoutbreak/continue. - callee_
no_ arg_ returns - True when
calleenames a zero-parameter function whose body returns an expression matchingpred. - cast_
type - The elementary type an explicit cast head
T(...)converts to. - count_
placeholders - Number of
_placeholders instmts, recursing into nested control flow. - dispatched_
function - The function an internal call made from within
contract_iddispatches to: a virtual call resolves to the most derived override,super.fto the next base implementation, and a qualifiedBase.fto that declaration exactly.Nonefor external and unresolved callees. - do_
while_ user_ stmts - Strips the trailing
if (cond) break;that lowersdo { ... } while (cond);. - expr_
is_ address - True when
exprβs type-checked static type isaddress/address payable. - expr_
reads_ sender - Whether
exprreadsmsg.sender/tx.origin, one ofaliases, or calls a user function that reads the sender. - expr_
state_ vars - State variables read by
expr, following calls into user functions. - for_
each_ child - Calls
fon every direct sub-expression ofexpr, in evaluation order. - for_
each_ lhs_ var - Calls
ffor each resolved variable at the root of an lvalue, peeling index/slice/member/payable/unary/delete wrappers and tuple destructuring. - function_
no_ arg_ returns - True when
fidtakes no parameters and its body isreturn e;ornamedRet = e;(optionally followed by a barereturn;) withpred(e). - function_
reads_ sender - Whether the body of
func_idreadsmsg.sender/tx.origin, following calls. - function_
state_ vars - State variables read by the body of
func_id, following calls into user functions. - guard_
vars - State variables the access checks of
func_idand its modifiers (up to_) depend on. - has_
access_ guard - Whether
func_idchecks the caller before its_placeholder (anywhere for functions): a guardingif, arequire/asserton an access check, or a call into a function that does. Bodyless declarations (interface functions, virtual modifiers) fall back to a name heuristic. - has_
side_ effect - True if evaluating
exprperforms an assignment,deleteor increment/decrement. - is_
address_ cast address(...)/address payable(...)cast head.- is_
address_ like_ cast address(...)orIFoo(...)cast head.- is_
address_ self address(this),payable(this),IFoo(this),IFoo(address(this)), or barethis.- is_
address_ type - True if
vidis typed asaddress/address payable. - is_
break_ stmt break, possibly wrapped in single-statement blocks.- is_
builtin - True if
exprresolves to the given builtin name. - is_
call_ with_ gas_ limit - True if a HIR call carries an explicit
gas:option. - is_
contract_ cast IFoo(...)contract / interface cast head.- is_
elementary - True if
idβs elementary type matches the given ABI string. - is_
exit_ call revert(...),selfdestruct(...),require(false, ...)orassert(false).- is_
literal_ false - The boolean literal
false. - is_
literal_ zero - The integer literal
0. - is_
loop_ termination_ if if (...) break;as synthesized by thedo-whilelowering.- is_
low_ level_ call - AST-level:
target.call(...),.delegatecall(...),.staticcall(...), with or without{value: x}options. - is_
msg_ sender msg.sender.- is_
protected - True when the function or one of its modifiers contains a dominating access check.
- is_
require_ or_ assert - True if
calleeresolves to the builtinrequireorassert. - is_
revert_ call revert(...),revert Err(...)-style builtin revert call (any form).- is_
sender_ member msg.senderortx.origin.- is_
zero_ value - A literal zero/false or an elementary cast or arithmetic negation of one.
- lhs_
local_ var - The local (non-state) variable a bare identifier refers to.
- looks_
like_ access_ control - A function whose name marks it as an access check (
auth,onlyOwner,_checkRole, β¦) and that returns nothing, so calling it for its effect is meaningful. - loop_
stmts - The statements of one loop iteration: the body followed by the
forupdate, if any. - loop_
update - The
forupdate statement of a loop, which runs after every iteration. - modifier_
prefix - The statements a modifier runs before its unique
_;, when that placeholder is reached unconditionally.Nonefor non-modifiers, bodiless modifiers and conditional placeholders. - modifiers_
and_ self - The modifiers of
func_idthat resolve to functions, followed byfunc_iditself. - receiver_
contract_ id - Static contract type of a method-call receiver or direct contract/library reference.
- referenced_
item - The item a bare identifier refers to, if any.
- runtime_
entry_ points - The functions reachable through the runtime dispatch of a most-derived contract: its
interface functions plus the inherited
fallback/receive, if any. - source_
in_ package - True if the source file of
source_idlives under one of the given package-root directory names (matched as whole, case-insensitive path components). - state_
lhs_ vars - State variables written by an lvalue: peels index/slice/member/payable/unary/delete wrappers and tuple destructuring. Duplicates are removed.
- stmt_
expr - The expression directly owned by
stmt(nested statements excluded). - stmts_
before_ placeholder - Collects the statements executed before the first placeholder of a modifier body, following
nested blocks. Returns
Nonewhen the placeholder is not reached unconditionally (e.g. it is inside anif, loop ortry). - stmts_
break_ or_ continue break/continuetargeting the current loop (nested loops shadow them).- tuple_
elems - The elements of a tuple expression (through parens).
- ty_
contract_ id - The contract a type denotes, through references and
type(C). - ty_
is_ address address/address payableafter peeling references.- underlying_
var - The variable a bare identifier refers to, looking through parens,
payable(...)and address-like casts (address(x),IFoo(x)). - unique
- The only element of
iter, orNonewhen it has zero or several. - var_
is_ address_ like address/address payableor a contract/interface type.- visit_
stmts - Runs
fon every statement ofstmtsand their nested statements (pre-order) until it breaks. - write_
target - The lvalue written by an assignment,
deleteor increment/decrement expression.