Returns a list of all previous instructions/arguments/variables of the current node in the current data flow graph and outside of this.
The extended_backward_df() function is an inter-procedural analysis function. This means that the function operates recursively and returns instruction/argument/variable across the contract's functions.
The function returns the derived classes from Point, such as Argument, Var, Instruction.
Query Example
from glider import*defquery():#fetch an instruction instructions =Instructions().with_callee_function_name('verify').exec(1)for points in instructions[0].extended_backward_df():print(points.source_code())# return the list of previous instructions of the current instructionreturn instructions
Output
"root":{4 items"contract":string"0x8a93bc8ed29da1b090265137a9d201ebf1154626""contract_name":string"METAANIxKPP""sol_function":solidityfunction_verify(bytes32 leaf,bytes32[] memory proof)internalviewreturns (bool) {return MerkleProof.verify(proof, allowListRoot, leaf); }"sol_instruction":solidityreturn MerkleProof.verify(proof, allowListRoot, leaf)}"root":{1 item"print_output":[15 items0:string"bytes32[] proof"1:string"address account"2:string"uint256 amount"3:string"address account"4:string"return MerkleProof.verify(proof, allowListRoot, leaf)"5:string"address account"6:string"uint256 amount"7:string"bytes32[] proof"8:string"_verify(_leaf(account, amount), proof)"9:string"bytes32 leaf"10:string"require(checkredeem( account , amount , proof ) > 0 , "account is not in allowlist")"11:string"require(checkredeem( account , amount , proof ) > 0 , "account is not in allowlist")"12:string"bytes32[] proof"13:string"bytes32[] proof"14:string"uint256 amount"]}
For the same contract, this query showcases that the return list elements are type-casted from Point:
from glider import*defquery():#fetch an instruction instructions =Instructions().with_callee_function_name('verify').exec(1)for points in instructions[0].extended_backward_df():ifisinstance(points, Argument):print("Argument name: "+ points.name)# return the list of previous instructions of the current instructionreturn instructions