This repository was archived by the owner on Feb 14, 2025. It is now read-only.
This repository was archived by the owner on Feb 14, 2025. It is now read-only.
Check return value of [must-check-caller-address] #57
Open
Description
[must-check-caller-address] finds the calls to get_caller_address
and warns the user about it.
Ideally, this rule should NOT emit any warning if the user checks the return value. E.g.:
let (address) = get_caller_address()
if address == 0: # returned values is compared to 0
return () # Could be any other code
end
The above code should NOT emit a warning, as the return value of get_valler_address
is checked against 0.
A second example of code that should not emit a warning would be the usage of assert_not_zero
:
let (address) = get_caller_address()
assert_not_zero(address)
Indeed, address will be compared (asserted) to 0
.
An example of code that SHOULD emit a warning would be:
let (address) = get_caller_address()
call_contract(contract_address=address, ...)
Indeed, the return value is NOT checked against 0.
Metadata
Metadata
Assignees
Labels
No labels