-
Notifications
You must be signed in to change notification settings - Fork 39
Vandal Static Analysis Library — Datalog Relations
The following relations are defined by the Vandal static analysis library (datalog/lib/vandal.dl) and may be used when writing new Datalog specifications.
-
callResult(var:Variable, stmt:Statement)
-
var
is a register variable in which the return value of a instruction is stored.
-
-
checkedCallStateUpdate(callStmt:Statement)
-
callStmt
is a statement whose return value is written to storage.
-
-
checkedCallThrows(callStmt:Statement)
-
callStmt
is a statement whose return value is used to conditionally execute a instruction.
-
-
conditionVar(var: Variable, stmt:Statement)
-
var
is a register variable whose value is used as the condition instmt
, which is either a or instruction.
-
-
controls(x:Statement, y:Statement)
-
x
is a conditional jump controlling the execution of the program branch containing statementy
.
-
-
controlsWith(x:Statement, y:Statement, cond:Variable)
- Identical to
controls
, except thatcond
is the register variable used in the or instruction.
- Identical to
-
depends(x:Variable, y:Variable)
- Computation of the value stored in register variable
x
depends on the value stored iny
. Transitive relation.
- Computation of the value stored in register variable
-
unaryArith(opcode:Opcode)
-
opcode
is the mnemonic of an instruction that accepts exactly one argument.
-
-
binArith(opcode:Opcode)
-
opcode
is the mnemonic of an instruction that accepts exactly two arguments.
-
-
ternArith(opcode:Opcode)
-
opcode
is the mnemonic of an instruction that accepts exactly three arguments.
-
-
distinctArgs2(stmt:Statement, op1:Variable, op2:Variable)
-
stmt
is abinArith
statement with two distinct register variables as arguments:op1
andop2
.
-
-
distinctArgs3(stmt:Statement, op1:Variable, op2:Variable, op3:Variable)
-
stmt
is aternArith
statement with three distinct register variables as arguments:op1
,op2
, andop3
.
-
-
twoDistinctArgs3(stmt:Statement, op1:Variable, op2:Variable)
-
stmt
is aternArith
statement with at least two distinct register variables as arguments:op1
andop2
.
-
-
fromCallValue(var:Variable)
-
var
is a register variable that stores a value derived from the return value of a statement.
-
-
gasResult(var:Variable, stmt:Statement)
-
var
is a register variable that stores the return value ofstmt
, which is a statement.
-
-
gassy(stmt:Statement, var:Variable)
-
stmt
is a statement with register variablevar
passed as an argument. The value stored invar
depends on the return value of some statement.
-
-
inaccessible(stmt:Statement)
-
stmt
is either unreachable from the program entry point, or its program path is conditioned upon a value that is independent from program input.
-
-
isThrow(stmt:Statement)
-
stmt
is either a or statement.
-
-
manipulableAddress(var:Variable)
-
var
is a register variable with a runtime value that is either constant, comes directly from program input, or whose computation is dependent on program input.
-
-
nonConstManipulable(var:Variable)
- Same as
manipulableAddress
, except that the value stored invar
is non-constant.
- Same as
-
originResult(var:Variable, stmt:Statement)
-
var
is a register variable that stores the return valuestmt
, which is an statement.
-
-
protectedByLoc(protectedStmt:Statement, sLoc:Value)
-
protectedStmt
is a statement whose execution is controlled by a mutex-like structure. The lock/unlock state of the mutex persists in storage, at storage indexsLoc
, a constant value.
-
-
reaches(p:Statement, q:Statement)
- A path exists from statement
p
to statementq
in the program’s control-flow graph.
- A path exists from statement
-
runtimeKnowable(opcode:Opcode)
-
opcode
is the mnemonic of an instruction that reads from the metadata of the currently executing Ethereum transaction and/or message call.
-
-
stateReadResult(var:Variable, stmt:Statement)
-
var
is a register variable that stores the return value ofstmt
, an statement (i.e. value read from storage).
-
-
stateWriteUse(var:Variable, stmt:Statement)
- The value stored in register variable
var
is written to storage by the statementstmt
.
- The value stored in register variable
-
usedInStateOrCond(var:Variable, stmt:Statement)
- Disjunction of the
conditionVar
andstateWriteUse
relations.
- Disjunction of the