|
|
@ -13,6 +13,7 @@ from z3 import ( |
|
|
|
Concat, |
|
|
|
Concat, |
|
|
|
ULT, |
|
|
|
ULT, |
|
|
|
UGT, |
|
|
|
UGT, |
|
|
|
|
|
|
|
BitVecRef, |
|
|
|
BitVecNumRef, |
|
|
|
BitVecNumRef, |
|
|
|
Not, |
|
|
|
Not, |
|
|
|
is_false, |
|
|
|
is_false, |
|
|
@ -83,6 +84,8 @@ class StateTransition(object): |
|
|
|
@staticmethod |
|
|
|
@staticmethod |
|
|
|
def check_gas_usage_limit(global_state: GlobalState): |
|
|
|
def check_gas_usage_limit(global_state: GlobalState): |
|
|
|
global_state.mstate.check_gas() |
|
|
|
global_state.mstate.check_gas() |
|
|
|
|
|
|
|
if type(global_state.current_transaction.gas_limit) == BitVecRef: |
|
|
|
|
|
|
|
return |
|
|
|
if ( |
|
|
|
if ( |
|
|
|
global_state.mstate.min_gas_used |
|
|
|
global_state.mstate.min_gas_used |
|
|
|
>= global_state.current_transaction.gas_limit |
|
|
|
>= global_state.current_transaction.gas_limit |
|
|
@ -1139,6 +1142,7 @@ class Instruction: |
|
|
|
|
|
|
|
|
|
|
|
@StateTransition() |
|
|
|
@StateTransition() |
|
|
|
def gas_(self, global_state: GlobalState) -> List[GlobalState]: |
|
|
|
def gas_(self, global_state: GlobalState) -> List[GlobalState]: |
|
|
|
|
|
|
|
# TODO: Push a Constrained variable which lies between min gas and max gas |
|
|
|
global_state.mstate.stack.append(global_state.new_bitvec("gas", 256)) |
|
|
|
global_state.mstate.stack.append(global_state.new_bitvec("gas", 256)) |
|
|
|
return [global_state] |
|
|
|
return [global_state] |
|
|
|
|
|
|
|
|
|
|
|