Skip to content
This repository was archived by the owner on May 23, 2023. It is now read-only.

Commit 5217294

Browse files
committed
merged
2 parents 2e53bf3 + 1ae8ed2 commit 5217294

21 files changed

+646
-188
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,4 @@ pyethereum/todo.txt
2525
pyethereum/monkeypatch.py
2626
.eggs
2727
.cache
28+
.env

.travis.yml

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
language: python
2-
python: 3.5
2+
python: 2.7
33
sudo: required
44
dist: trusty
55
env:
6-
matrix:
7-
- TOX_ENV=py27
8-
- TOX_ENV=py34
9-
- TOX_ENV=py35
6+
#matrix:
7+
#- TOX_ENV=py27
8+
#- TOX_ENV=py34
9+
#- TOX_ENV=py35
1010
global:
1111
- COVERAGE_APPEND="--append"
1212
- secure: cKbIgpTJ1yjKLBxpCEiT6IH7NShDWZUE+BvnrAfc+ujCsR6LyLJcKxFQmKnWryJCqg7fp82Ep2bF2oDKzanAROar2xDY1SFGbai42seYMaFCw53YPGJ6u3VNCcfT0rN9BWgE7el/m4fjcD6CRsZYKArNNJbMX8csRt3uXXCFLso=
@@ -26,12 +26,19 @@ install:
2626
- travis_retry pip install setuptools --upgrade
2727
- travis_retry pip install tox
2828
- travis_retry pip install coverage
29+
- travis_retry pip install flake8
30+
- travis_retry python setup.py install
31+
- travis_retry pip install -r dev_requirements.txt
2932
script:
30-
- if [ -d .tox/$TOX_ENV/ ]; then cd .tox/$TOX_ENV && coverage erase; fi;
31-
- tox -e $TOX_ENV -- --ignore ethereum/tests/test_vm.py --ignore ethereum/tests/test_state.py
32-
- tox -e $TOX_ENV -- ethereum/tests/test_vm.py
33-
- tox -e $TOX_ENV -- ethereum/tests/test_state.py
34-
- coverage report --show-missing
33+
- make lint-minimal
34+
- make test-minimal
35+
# XXX: For now we're only performing minimal CI checks as most tests are
36+
# broken. Tests will be individually added here as they're fixed.
37+
#- if [ -d .tox/$TOX_ENV/ ]; then cd .tox/$TOX_ENV && coverage erase; fi;
38+
#- tox -e $TOX_ENV -- --ignore ethereum/tests/test_vm.py --ignore ethereum/tests/test_state.py
39+
#- tox -e $TOX_ENV -- ethereum/tests/test_vm.py
40+
#- tox -e $TOX_ENV -- ethereum/tests/test_state.py
41+
#- coverage report --show-missing
3542
after_success:
3643
- travis_retry pip install coveralls
3744
- cd .tox/$TOX_ENV && coveralls

Makefile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,15 @@ clean-test:
3939
lint:
4040
flake8 ethereum tests --ignore=E501
4141

42+
lint-minimal:
43+
python -m flake8 --ignore=F401,F841,F811 --select=F --exclude=todo,experimental,ethash.py,ethash_utils.py ethereum
44+
4245
test:
4346
py.test --tb=no ethereum/tests/
4447

48+
test-minimal:
49+
py.test ethereum/tests/test_abi.py ethereum/tests/test_bloom.py ethereum/tests/test_chain.py ethereum/tests/test_compress.py ethereum/tests/test_db.py ethereum/tests/test_difficulty.py ethereum/tests/test_opcodes.py ethereum/tests/test_trie_next_prev.py ethereum/tests/test_utils.py
50+
4551
testnovm:
4652
py.test --tb=no ethereum/tests/ --ignore=ethereum/tests/test_vm.py
4753

ethereum/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242

4343
# ########### endversion ##################
4444

45-
'''from ethereum import utils
45+
"""from ethereum import utils
4646
from ethereum import trie
4747
from ethereum import securetrie
4848
from ethereum import blocks
@@ -51,4 +51,4 @@
5151
from ethereum import tester
5252
from ethereum import abi
5353
from ethereum import keys
54-
from ethereum import ethash'''
54+
from ethereum import ethash"""

ethereum/abi.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ def event_id(name, encode_types):
135135

136136

137137
def decint(n, signed=False): # pylint: disable=invalid-name,too-many-branches
138-
''' Decode an unsigned/signed integer. '''
138+
""" Decode an unsigned/signed integer. """
139139

140140
if isinstance(n, str):
141141
n = utils.to_string(n)
@@ -185,7 +185,7 @@ def decint(n, signed=False): # pylint: disable=invalid-name,too-many-branches
185185

186186

187187
def encode_single(typ, arg): # pylint: disable=too-many-return-statements,too-many-branches,too-many-statements,too-many-locals
188-
''' Encode `arg` as `typ`.
188+
""" Encode `arg` as `typ`.
189189
190190
`arg` will be encoded in a best effort manner, were necessary the function
191191
will try to correctly define the underlying binary representation (ie.
@@ -223,7 +223,7 @@ def encode_single(typ, arg): # pylint: disable=too-many-return-statements,too-m
223223
Note:
224224
This function don't work with array types, for that use the `enc`
225225
function.
226-
'''
226+
"""
227227
base, sub, _ = typ
228228

229229
if base == 'uint':

ethereum/block.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import rlp
22
from ethereum.utils import normalize_address, hash32, trie_root, \
3-
big_endian_int, address, int256, encode_hex, encode_int, sha3
3+
big_endian_int, address, int256, encode_hex, decode_hex, encode_int, sha3
44
from rlp.sedes import big_endian_int, Binary, binary, CountableList
55
from ethereum import utils
66
from ethereum import trie

ethereum/experimental/pruning_trie.py

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,9 @@ def unpack_to_nibbles(bindata):
168168

169169

170170
def starts_with(full, part):
171-
''' test whether the items in the part is
171+
""" test whether the items in the part is
172172
the leading items of the full
173-
'''
173+
"""
174174
if len(full) < len(part):
175175
return False
176176
return full[:len(part)] == part
@@ -200,11 +200,11 @@ def transient_trie_exception(*args):
200200
class Trie(object):
201201

202202
def __init__(self, db, root_hash=BLANK_ROOT, transient=False):
203-
'''it also present a dictionary like interface
203+
"""it also present a dictionary like interface
204204
205205
:param db key value database
206206
:root: blank or trie node in form of [key, value] or [v0,v1..v15,v]
207-
'''
207+
"""
208208
self.db = db # Pass in a database object directly
209209
self.transient = transient
210210
if self.transient:
@@ -215,11 +215,11 @@ def __init__(self, db, root_hash=BLANK_ROOT, transient=False):
215215
self.journal = []
216216

217217
# def __init__(self, dbfile, root_hash=BLANK_ROOT):
218-
# '''it also present a dictionary like interface
218+
# """it also present a dictionary like interface
219219

220220
# :param dbfile: key value database
221221
# :root: blank or trie node in form of [key, value] or [v0,v1..v15,v]
222-
# '''
222+
# """
223223
# if isinstance(dbfile, str):
224224
# dbfile = os.path.abspath(dbfile)
225225
# self.db = DB(dbfile)
@@ -251,8 +251,8 @@ def spv_storing(self, node):
251251

252252
@property
253253
def root_hash(self):
254-
'''always empty or a 32 bytes string
255-
'''
254+
"""always empty or a 32 bytes string
255+
"""
256256
return self.get_root_hash()
257257

258258
def get_root_hash(self):
@@ -311,8 +311,8 @@ def all_nodes(self, node=None):
311311
# return o
312312

313313
def clear(self):
314-
''' clear all tree data
315-
'''
314+
""" clear all tree data
315+
"""
316316
self._delete_child_storage(self.root_node)
317317
self._delete_node_storage(self.root_node)
318318
self.root_node = BLANK_NODE
@@ -349,11 +349,11 @@ def _decode_to_node(self, encoded):
349349
return o
350350

351351
def _get_node_type(self, node):
352-
''' get node type and content
352+
""" get node type and content
353353
354354
:param node: node in form of list, or BLANK_NODE
355355
:return: node type
356-
'''
356+
"""
357357
if node == BLANK_NODE:
358358
return NODE_TYPE_BLANK
359359

@@ -603,9 +603,9 @@ def prev(self, key):
603603
return nibbles_to_bin(o) if o else None
604604

605605
def _delete_node_storage(self, node, is_root=False):
606-
'''delete storage
606+
"""delete storage
607607
:param node: node in form of list, or BLANK_NODE
608-
'''
608+
"""
609609
if node == BLANK_NODE:
610610
return
611611
# assert isinstance(node, list)
@@ -645,8 +645,8 @@ def _delete(self, node, key):
645645

646646
def _normalize_branch_node(self, node):
647647
# sys.stderr.write('nbn\n')
648-
'''node should have only one item changed
649-
'''
648+
"""node should have only one item changed
649+
"""
650650
not_blank_items_count = sum(1 for x in range(17) if node[x])
651651
assert not_blank_items_count >= 1
652652

@@ -772,9 +772,9 @@ def _delete_kv_node(self, node, key):
772772
assert False
773773

774774
def delete(self, key):
775-
'''
775+
"""
776776
:param key: a string with length of [0, 32]
777-
'''
777+
"""
778778
if not is_string(key):
779779
raise Exception("Key must be string")
780780

@@ -808,10 +808,10 @@ def clear_all(self, node=None):
808808
self.clear_all(self._decode_to_node(node[i]))
809809

810810
def _get_size(self, node):
811-
'''Get counts of (key, value) stored in this and the descendant nodes
811+
"""Get counts of (key, value) stored in this and the descendant nodes
812812
813813
:param node: node in form of list, or BLANK_NODE
814-
'''
814+
"""
815815
if node == BLANK_NODE:
816816
return 0
817817

@@ -830,15 +830,15 @@ def _get_size(self, node):
830830
return sum(sizes)
831831

832832
def _to_dict(self, node):
833-
'''convert (key, value) stored in this and the descendant nodes
833+
"""convert (key, value) stored in this and the descendant nodes
834834
to dict items.
835835
836836
:param node: node in form of list, or BLANK_NODE
837837
838838
.. note::
839839
840840
Here key is in full form, rather than key of the individual node
841-
'''
841+
"""
842842
if node == BLANK_NODE:
843843
return {}
844844

@@ -894,12 +894,12 @@ def iter_branch(self):
894894
yield key, value
895895

896896
def _iter_branch(self, node):
897-
'''yield (key, value) stored in this and the descendant nodes
897+
"""yield (key, value) stored in this and the descendant nodes
898898
:param node: node in form of list, or BLANK_NODE
899899
900900
.. note::
901901
Here key is in full form, rather than key of the individual node
902-
'''
902+
"""
903903
if node == BLANK_NODE:
904904
raise StopIteration
905905

@@ -949,10 +949,10 @@ def __contains__(self, key):
949949
return self.get(key) != BLANK_NODE
950950

951951
def update(self, key, value):
952-
'''
952+
"""
953953
:param key: a string
954954
:value: a string
955-
'''
955+
"""
956956
if not is_string(key):
957957
raise Exception("Key must be string")
958958

ethereum/fastvm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ def vm_execute(ext, msg, code):
231231

232232
# Invalid operation; can only come at the end of a chunk
233233
if ops[-1][0] == 'INVALID':
234-
return vm_exception('INVALID OP', opcode=opcode)
234+
return vm_exception('INVALID OP', opcode=ops[-1][1])
235235

236236
for op, opcode, pushval in ops:
237237

ethereum/hybrid_casper/consensus.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
from ethereum import utils
2+
13
# Update block variables into the state
24
def update_block_env_variables(state, block):
35
state.timestamp = block.header.timestamp

0 commit comments

Comments
 (0)