|
|
|
@ -10,7 +10,7 @@ import mythril.laser.ethereum.util as util |
|
|
|
|
from mythril.laser.ethereum import natives |
|
|
|
|
from mythril.laser.ethereum.instruction_data import calculate_native_gas |
|
|
|
|
from mythril.laser.ethereum.state.account import Account |
|
|
|
|
from mythril.laser.ethereum.natives import PRECOMPILE_COUNT |
|
|
|
|
from mythril.laser.ethereum.natives import PRECOMPILE_COUNT, PRECOMPILE_FUNCTIONS |
|
|
|
|
from mythril.laser.ethereum.state.calldata import ( |
|
|
|
|
BaseCalldata, |
|
|
|
|
SymbolicCalldata, |
|
|
|
@ -249,11 +249,10 @@ def native_call( |
|
|
|
|
log.debug("CALL with symbolic start or offset not supported") |
|
|
|
|
return [global_state] |
|
|
|
|
|
|
|
|
|
contract_list = ["ecrecover", "sha256", "ripemd160", "identity"] |
|
|
|
|
call_address_int = int(callee_address, 16) |
|
|
|
|
native_gas_min, native_gas_max = calculate_native_gas( |
|
|
|
|
global_state.mstate.calculate_extension_size(mem_out_start, mem_out_sz), |
|
|
|
|
contract_list[call_address_int - 1], |
|
|
|
|
PRECOMPILE_FUNCTIONS[call_address_int - 1].__name__, |
|
|
|
|
) |
|
|
|
|
global_state.mstate.min_gas_used += native_gas_min |
|
|
|
|
global_state.mstate.max_gas_used += native_gas_max |
|
|
|
@ -263,7 +262,11 @@ def native_call( |
|
|
|
|
except natives.NativeContractException: |
|
|
|
|
for i in range(mem_out_sz): |
|
|
|
|
global_state.mstate.memory[mem_out_start + i] = global_state.new_bitvec( |
|
|
|
|
contract_list[call_address_int - 1] + "(" + str(call_data) + ")", 8 |
|
|
|
|
PRECOMPILE_FUNCTIONS[call_address_int - 1].__name__ |
|
|
|
|
+ "(" |
|
|
|
|
+ str(call_data) |
|
|
|
|
+ ")", |
|
|
|
|
8, |
|
|
|
|
) |
|
|
|
|
return [global_state] |
|
|
|
|
|
|
|
|
|