Undescribed Horrific Abuse, One Victim & Survivor of Many
gmkarl at gmail.com
Sat Nov 12 15:48:43 PST 2022
This is its test data. It wrote these random bytes into the tree, and
verifies that they come back right.
> [(9, 9, 0, 45), (9, 18, 45, 39), (3, 21, 84, 13), (1, 22, 97, 1), (1,
> 23, 98, 8), (-1, b'j\xf1p>\xf3\xba', 106, 6)]
This looks like the tree index after the final write. The tuples are
edges linking to older indices (subtrees). The final component is the
most recent data, and some metadata regarding it.
> Traceback (most recent call last):
> File "/shared/src/flat_tree/test.py", line 43, in <module>
This is the test file.
> cmp = b''.join(iterate(index, 0, index.byte_count))
Okay, insid the outer test file, it is iterating over an index, the
range being the entire data, and joining the bytes together. On line
So it hasn't compared the data yet: it's inside the function that returns it.
> File "/shared/src/flat_tree/test.py", line 30, in iterate
> data = b''.join(iterate(subindex, adjusted_start,
> min(adjusted_end, subsize - adjusted_start)))
Looks like the iterate function is local to the test file, and it
looks like it calls itself recursively. I'm vaguely remembering that
the library presently just generates indices and doesn't provide much
of an interface to them.
So here it is doing a recursive call. Given the call up the stack is
in the main file body, this is likely iterating at one level below the
It would be appropriate to know the values of the parameters passed to
the function here.
> File "/shared/src/flat_tree/test.py", line 34, in iterate
> assert len(data) == subleafcount
Now it's _still_ inside the iterate function in the main file, and an
assertion is failing.
And now I have helpful information: this assertion must be failing
regarding data in the second row of the tree. This helps me so much as
before I had no context for the failure.
len(data) == subleafcount implies that data is a list of all the trees
below the tree. So it likely already performed a depth-first
enumeration of every child of this node, and is preparing to return
out to the parent call.
Time to visit it in pdb.
More information about the cypherpunks