rename transaction object

pull/404/head
Joran Honig 6 years ago
parent 0c18e4dc38
commit a886e7784c
  1. 18
      mythril/laser/ethereum/instructions.py
  2. 4
      mythril/laser/ethereum/svm.py
  3. 16
      mythril/laser/ethereum/transaction.py

@ -13,7 +13,7 @@ from mythril.laser.ethereum import util
from mythril.laser.ethereum.call import get_call_parameters from mythril.laser.ethereum.call import get_call_parameters
from mythril.laser.ethereum.state import GlobalState, MachineState, Environment, CalldataType from mythril.laser.ethereum.state import GlobalState, MachineState, Environment, CalldataType
import mythril.laser.ethereum.natives as natives import mythril.laser.ethereum.natives as natives
from mythril.laser.ethereum.transaction import CallTransaction, TransactionEndSignal, TransactionStartSignal from mythril.laser.ethereum.transaction import MessageCallTransaction, TransactionEndSignal, TransactionStartSignal
TT256 = 2 ** 256 TT256 = 2 ** 256
TT256M1 = 2 ** 256 - 1 TT256M1 = 2 ** 256 - 1
@ -907,14 +907,14 @@ class Instruction:
# TODO: maybe use BitVec here constrained to 1 # TODO: maybe use BitVec here constrained to 1
return [global_state] return [global_state]
transaction = CallTransaction(global_state.world_state, transaction = MessageCallTransaction(global_state.world_state,
callee_account, callee_account,
BitVecVal(int(environment.active_account.address, 16), 256), BitVecVal(int(environment.active_account.address, 16), 256),
call_data, call_data,
environment.gasprice, environment.gasprice,
value, value,
environment.origin, environment.origin,
call_data_type) call_data_type)
raise TransactionStartSignal(transaction, self.op_code) raise TransactionStartSignal(transaction, self.op_code)
@instruction @instruction

@ -1,7 +1,7 @@
from z3 import BitVec from z3 import BitVec
import logging import logging
from mythril.laser.ethereum.state import GlobalState, Environment, CalldataType, Account, WorldState from mythril.laser.ethereum.state import GlobalState, Environment, CalldataType, Account, WorldState
from mythril.laser.ethereum.transaction import CallTransaction, TransactionStartSignal, TransactionEndSignal from mythril.laser.ethereum.transaction import MessageCallTransaction, TransactionStartSignal, TransactionEndSignal
from mythril.laser.ethereum.instructions import Instruction from mythril.laser.ethereum.instructions import Instruction
from mythril.laser.ethereum.cfg import NodeFlags, Node, Edge, JumpType from mythril.laser.ethereum.cfg import NodeFlags, Node, Edge, JumpType
from mythril.laser.ethereum.strategy.basic import DepthFirstSearchStrategy from mythril.laser.ethereum.strategy.basic import DepthFirstSearchStrategy
@ -233,7 +233,7 @@ class LaserEVM:
for open_world_state in open_states: for open_world_state in open_states:
transaction = CallTransaction( transaction = MessageCallTransaction(
open_world_state, open_world_state,
open_world_state[callee_address], open_world_state[callee_address],
caller, caller,

@ -18,7 +18,7 @@ class TransactionStartSignal(Exception):
self.op_code = op_code self.op_code = op_code
class CallTransaction: class MessageCallTransaction:
""" Transaction object models an transaction""" """ Transaction object models an transaction"""
def __init__(self, def __init__(self,
world_state, world_state,
@ -66,17 +66,3 @@ class CallTransaction:
raise TransactionEndSignal(global_state) raise TransactionEndSignal(global_state)
class Transaction:
def __init__(self):
self.open_states = None
@property
def has_ran(self):
return self.open_states is not None
def run(self, open_world_states, evm):
raise NotImplementedError()

Loading…
Cancel
Save