Skip to content

Instantly share code, notes, and snippets.

@pipermerriam
Created April 26, 2018 15:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pipermerriam/bf3a360b896f75be39b363495821a8aa to your computer and use it in GitHub Desktop.
Save pipermerriam/bf3a360b896f75be39b363495821a8aa to your computer and use it in GitHub Desktop.
________________________________ test_trie_sync ________________________________
 @given(random=strategies.randoms())
> @settings(max_examples=10)
 def test_trie_sync(random):
f = <function given.<locals>.run_test_with_generator.<locals>.wrapped_test at 0x00007fea84b0d6a0>
tests/test_sync.py:18:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
.tox/pypy3-rlp1/site-packages/hypothesis/core.py:525: in wrapped_test
 print_example=True, is_final=True
.tox/pypy3-rlp1/site-packages/hypothesis/executors.py:58: in default_new_style_executor
 return function(data)
.tox/pypy3-rlp1/site-packages/hypothesis/core.py:112: in run
 return test(*args, **kwargs)
tests/test_sync.py:29: in test_trie_sync
 scheduler.process(results)
trie/sync.py:180: in process
 references, leaves = self.get_children(request)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <trie.sync.HexaryTrieSync object at 0x00007fea7f461d38>
request = SyncRequest(0xf92ca2f82692a47ed4891445b4524f06847783e85a7a11b84364cbb76e0dc199, depth=2)
 def get_children(self, request):
 """Return all children of the node retrieved by the given request.
 
 :rtype: A two-tuple with one list containing the children that reference other nodes and
 another containing the leaf children.
 """
 node = decode_node(request.data)
 node_type = get_node_type(node)
 references = []
 leaves = []
 if node_type == NODE_TYPE_LEAF:
 leaves.append(node[1])
 elif node_type == NODE_TYPE_EXTENSION:
 depth = request.depth + len(node[0])
 references.append((depth, node[1]))
 elif node_type == NODE_TYPE_BRANCH:
 depth = request.depth + 1
 for item in node[:16]:
 if is_blank_node(item):
 continue
 
 # In a branch, the first 16 items are either a node whose RLP-encoded
 # representation is under 32 bytes or a reference to another node.
 if len(item) == 2:
 if get_node_type(item) != NODE_TYPE_LEAF:
> raise UnexpectedNodeType("Expected a node of type leaf, but got %s" % item)
E trie.exceptions.UnexpectedNodeType: Expected a node of type leaf, but got [b'\x1a', [b'', b'', b'', b'', b'', b'', b'', b'', b'', [b':f\x95', b'\x04\x9f'], b'', b'', b'', b'', b'', b'', b'F\xbe']]
depth = 3
item = [b'\x1a', [b'', b'', b'', b'', b'', b'', ...]]
leaves = []
node = [b'', b"?\xd3\x16\x87\x1a\xa4oiy\xdcc\x0f\x95u\xdb\xd4OrF\xe0\xd0\n^#\x85\x8b\x9b\x19'\xdd\xc4j", b'\xa4\xde[\xa0\xef\xbc\xc4\xd7\xa7\xc5\x02\xf4,\xd2\xf0\xb8el\x9f\xd9Z+\xa8\xd44{O}\xdcQE\x95', b'', b'', b'', ...]
node_type = 3
references = [(3, b"?\xd3\x16\x87\x1a\xa4oiy\xdcc\x0f\x95u\xdb\xd4OrF\xe0\xd0\n^#\x85\x8b\x9b\x19'\xdd\xc4j"), (3, b'\xa4\xde[\xa0\...2\xc4\x84O\xc1'), (3, b'\xcf\xfa\x94,W\xe1\xb6\x07\x11\xd4\xd3\x12\xc2Ay\x8d\x8e\xdd\x0e{5\x08hk\x8a0\x18\xf18T\xf2x')]
request = SyncRequest(0xf92ca2f82692a47ed4891445b4524f06847783e85a7a11b84364cbb76e0dc199, depth=2)
self = <trie.sync.HexaryTrieSync object at 0x00007fea7f461d38>
trie/sync.py:141: UnexpectedNodeType
---------------------------------- Hypothesis ----------------------------------
Falsifying example: test_trie_sync(random=RandomWithSeed(37968))
==================== 1 failed, 887 passed in 36.20 seconds =====================
ERROR: InvocationError for command '/home/travis/build/ethereum/py-trie/.tox/pypy3-rlp1/bin/py.test tests' (exited with code 1)
___________________________________ summary ____________________________________
ERROR: pypy3-rlp1: commands failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment