astreum 0.2.19__tar.gz → 0.2.20__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of astreum might be problematic. Click here for more details.
- {astreum-0.2.19/src/astreum.egg-info → astreum-0.2.20}/PKG-INFO +1 -1
- {astreum-0.2.19 → astreum-0.2.20}/pyproject.toml +1 -1
- {astreum-0.2.19 → astreum-0.2.20}/src/astreum/models/patricia.py +19 -3
- {astreum-0.2.19 → astreum-0.2.20/src/astreum.egg-info}/PKG-INFO +1 -1
- {astreum-0.2.19 → astreum-0.2.20}/LICENSE +0 -0
- {astreum-0.2.19 → astreum-0.2.20}/README.md +0 -0
- {astreum-0.2.19 → astreum-0.2.20}/setup.cfg +0 -0
- {astreum-0.2.19 → astreum-0.2.20}/src/astreum/__init__.py +0 -0
- {astreum-0.2.19 → astreum-0.2.20}/src/astreum/crypto/__init__.py +0 -0
- {astreum-0.2.19 → astreum-0.2.20}/src/astreum/crypto/ed25519.py +0 -0
- {astreum-0.2.19 → astreum-0.2.20}/src/astreum/crypto/quadratic_form.py +0 -0
- {astreum-0.2.19 → astreum-0.2.20}/src/astreum/crypto/wesolowski.py +0 -0
- {astreum-0.2.19 → astreum-0.2.20}/src/astreum/crypto/x25519.py +0 -0
- {astreum-0.2.19 → astreum-0.2.20}/src/astreum/format.py +0 -0
- {astreum-0.2.19 → astreum-0.2.20}/src/astreum/lispeum/__init__.py +0 -0
- {astreum-0.2.19 → astreum-0.2.20}/src/astreum/lispeum/parser.py +0 -0
- {astreum-0.2.19 → astreum-0.2.20}/src/astreum/lispeum/tokenizer.py +0 -0
- {astreum-0.2.19 → astreum-0.2.20}/src/astreum/models/__init__.py +0 -0
- {astreum-0.2.19 → astreum-0.2.20}/src/astreum/models/account.py +0 -0
- {astreum-0.2.19 → astreum-0.2.20}/src/astreum/models/block.py +0 -0
- {astreum-0.2.19 → astreum-0.2.20}/src/astreum/models/merkle.py +0 -0
- {astreum-0.2.19 → astreum-0.2.20}/src/astreum/models/transaction.py +0 -0
- {astreum-0.2.19 → astreum-0.2.20}/src/astreum/node.py +0 -0
- {astreum-0.2.19 → astreum-0.2.20}/src/astreum.egg-info/SOURCES.txt +0 -0
- {astreum-0.2.19 → astreum-0.2.20}/src/astreum.egg-info/dependency_links.txt +0 -0
- {astreum-0.2.19 → astreum-0.2.20}/src/astreum.egg-info/requires.txt +0 -0
- {astreum-0.2.19 → astreum-0.2.20}/src/astreum.egg-info/top_level.txt +0 -0
- {astreum-0.2.19 → astreum-0.2.20}/tests/test_node_machine.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: astreum
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.20
|
|
4
4
|
Summary: Python library to interact with the Astreum blockchain and its Lispeum virtual machine.
|
|
5
5
|
Author-email: "Roy R. O. Okello" <roy@stelar.xyz>
|
|
6
6
|
Project-URL: Homepage, https://github.com/astreum/lib
|
|
@@ -195,9 +195,12 @@ class PatriciaTrie:
|
|
|
195
195
|
|
|
196
196
|
# 4.3 – matched entire key → update value
|
|
197
197
|
if key_pos == total_bits:
|
|
198
|
-
|
|
198
|
+
old_hash = node.hash()
|
|
199
199
|
node.value = value
|
|
200
|
+
self._invalidate_hash(node)
|
|
200
201
|
new_hash = node.hash()
|
|
202
|
+
if new_hash != old_hash:
|
|
203
|
+
self.nodes.pop(old_hash, None)
|
|
201
204
|
self.nodes[new_hash] = node
|
|
202
205
|
self._bubble(stack, new_hash)
|
|
203
206
|
return
|
|
@@ -233,12 +236,12 @@ class PatriciaTrie:
|
|
|
233
236
|
value: bytes,
|
|
234
237
|
stack: List[Tuple[PatriciaNode, bytes, int]],
|
|
235
238
|
) -> None:
|
|
236
|
-
# key_pos points to routing bit; leaf stores the rest after that bit
|
|
237
239
|
tail_len = len(key) * 8 - (key_pos + 1)
|
|
238
240
|
tail_bits, tail_len = self._bit_slice(key, key_pos + 1, tail_len)
|
|
239
241
|
leaf = self._make_node(tail_bits, tail_len, value, None, None)
|
|
240
242
|
|
|
241
|
-
|
|
243
|
+
old_parent_hash = parent.hash()
|
|
244
|
+
|
|
242
245
|
if dir_bit:
|
|
243
246
|
parent.child_1 = leaf.hash()
|
|
244
247
|
else:
|
|
@@ -246,9 +249,12 @@ class PatriciaTrie:
|
|
|
246
249
|
|
|
247
250
|
self._invalidate_hash(parent)
|
|
248
251
|
new_parent_hash = parent.hash()
|
|
252
|
+
if new_parent_hash != old_parent_hash:
|
|
253
|
+
self.nodes.pop(old_parent_hash, None)
|
|
249
254
|
self.nodes[new_parent_hash] = parent
|
|
250
255
|
self._bubble(stack, new_parent_hash)
|
|
251
256
|
|
|
257
|
+
|
|
252
258
|
def _split_and_insert(
|
|
253
259
|
self,
|
|
254
260
|
node: PatriciaNode,
|
|
@@ -277,10 +283,14 @@ class PatriciaTrie:
|
|
|
277
283
|
lcp + 1, # start *after* divergence bit
|
|
278
284
|
node.key_len - lcp - 1 # may be zero
|
|
279
285
|
)
|
|
286
|
+
old_node_hash = node.hash()
|
|
287
|
+
|
|
280
288
|
node.key = old_suffix_bits
|
|
281
289
|
node.key_len = old_suffix_len
|
|
282
290
|
self._invalidate_hash(node)
|
|
283
291
|
new_node_hash = node.hash()
|
|
292
|
+
if new_node_hash != old_node_hash:
|
|
293
|
+
self.nodes.pop(old_node_hash, None)
|
|
284
294
|
self.nodes[new_node_hash] = node
|
|
285
295
|
|
|
286
296
|
# ➍—new leaf for the key being inserted (unchanged)
|
|
@@ -341,15 +351,21 @@ class PatriciaTrie:
|
|
|
341
351
|
"""
|
|
342
352
|
while stack:
|
|
343
353
|
parent, old_hash, dir_bit = stack.pop()
|
|
354
|
+
|
|
344
355
|
if dir_bit == 0:
|
|
345
356
|
parent.child_0 = new_hash
|
|
346
357
|
else:
|
|
347
358
|
parent.child_1 = new_hash
|
|
359
|
+
|
|
348
360
|
self._invalidate_hash(parent)
|
|
349
361
|
new_hash = parent.hash()
|
|
362
|
+
if new_hash != old_hash:
|
|
363
|
+
self.nodes.pop(old_hash, None)
|
|
350
364
|
self.nodes[new_hash] = parent
|
|
365
|
+
|
|
351
366
|
self.root_hash = new_hash
|
|
352
367
|
|
|
368
|
+
|
|
353
369
|
def _bit_slice(
|
|
354
370
|
self,
|
|
355
371
|
buf: bytes,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: astreum
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.20
|
|
4
4
|
Summary: Python library to interact with the Astreum blockchain and its Lispeum virtual machine.
|
|
5
5
|
Author-email: "Roy R. O. Okello" <roy@stelar.xyz>
|
|
6
6
|
Project-URL: Homepage, https://github.com/astreum/lib
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|