Formatting, remove unused imports & function

pull/358/head
Bernhard Mueller 6 years ago
parent 725ee8fac6
commit 23bf26299b
  1. 4
      mythril/disassembler/disassembly.py
  2. 13
      mythril/ether/ethcontract.py
  3. 11
      mythril/leveldb/client.py

@ -1,4 +1,4 @@
from mythril.ether import asm,util
from mythril.ether import asm, util
from mythril.support.signatures import SignatureDb
import logging
@ -38,7 +38,7 @@ class Disassembly(object):
func_name = "_function_" + func_hash
try:
offset = self.instruction_list[i+2]['argument']
offset = self.instruction_list[i + 2]['argument']
jump_target = int(offset, 16)
self.func_to_addr[func_name] = jump_target

@ -70,16 +70,3 @@ class ETHContract(persistent.Persistent):
continue
return eval(str_eval.strip())
class InstanceList(persistent.Persistent):
def __init__(self):
self.addresses = []
self.balances = []
pass
def add(self, address, balance=0):
self.addresses.append(address)
self.balances.append(balance)
self._p_changed = True

@ -1,13 +1,11 @@
import plyvel
import binascii
import rlp
import hashlib
import logging
from ethereum import utils
from ethereum.block import BlockHeader, Block
from mythril.leveldb.state import State, Account
from mythril.leveldb.state import State
from mythril.leveldb.eth_db import ETH_DB
from mythril.ether.ethcontract import ETHContract, InstanceList
from mythril.ether.ethcontract import ETHContract
# Per https://github.com/ethereum/go-ethereum/blob/master/core/database_util.go
# prefixes and suffixes for keys in geth
@ -16,7 +14,8 @@ bodyPrefix = b'b' # bodyPrefix + num (uint64 big endian) + hash -> block b
numSuffix = b'n' # headerPrefix + num (uint64 big endian) + numSuffix -> hash
blockHashPrefix = b'H' # blockHashPrefix + hash -> num (uint64 big endian)
# known geth keys
headHeaderKey = b'LastBlock' # head (latest) header hash
headHeaderKey = b'LastBlock' # head (latest) header hash
def _formatBlockNumber(number):
'''
@ -24,12 +23,14 @@ def _formatBlockNumber(number):
'''
return utils.zpad(utils.int_to_big_endian(number), 8)
def _encode_hex(v):
'''
encodes hash as hex
'''
return '0x' + utils.encode_hex(v)
class EthLevelDB(object):
'''
Go-Ethereum LevelDB client class

Loading…
Cancel
Save