astreum 0.2.10__tar.gz → 0.2.11__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.

Files changed (28) hide show
  1. {astreum-0.2.10/src/astreum.egg-info → astreum-0.2.11}/PKG-INFO +1 -1
  2. {astreum-0.2.10 → astreum-0.2.11}/pyproject.toml +1 -1
  3. astreum-0.2.11/src/astreum/utils/__init__.py +0 -0
  4. astreum-0.2.11/src/astreum/utils/patricia.py +45 -0
  5. {astreum-0.2.10 → astreum-0.2.11/src/astreum.egg-info}/PKG-INFO +1 -1
  6. {astreum-0.2.10 → astreum-0.2.11}/src/astreum.egg-info/SOURCES.txt +2 -0
  7. {astreum-0.2.10 → astreum-0.2.11}/LICENSE +0 -0
  8. {astreum-0.2.10 → astreum-0.2.11}/README.md +0 -0
  9. {astreum-0.2.10 → astreum-0.2.11}/setup.cfg +0 -0
  10. {astreum-0.2.10 → astreum-0.2.11}/src/astreum/__init__.py +0 -0
  11. {astreum-0.2.10 → astreum-0.2.11}/src/astreum/_node/__init__.py +0 -0
  12. {astreum-0.2.10 → astreum-0.2.11}/src/astreum/_node/storage/__init__.py +0 -0
  13. {astreum-0.2.10 → astreum-0.2.11}/src/astreum/_node/storage/merkle.py +0 -0
  14. {astreum-0.2.10 → astreum-0.2.11}/src/astreum/_node/storage/patricia.py +0 -0
  15. {astreum-0.2.10 → astreum-0.2.11}/src/astreum/crypto/__init__.py +0 -0
  16. {astreum-0.2.10 → astreum-0.2.11}/src/astreum/crypto/ed25519.py +0 -0
  17. {astreum-0.2.10 → astreum-0.2.11}/src/astreum/crypto/quadratic_form.py +0 -0
  18. {astreum-0.2.10 → astreum-0.2.11}/src/astreum/crypto/wesolowski.py +0 -0
  19. {astreum-0.2.10 → astreum-0.2.11}/src/astreum/crypto/x25519.py +0 -0
  20. {astreum-0.2.10 → astreum-0.2.11}/src/astreum/format.py +0 -0
  21. {astreum-0.2.10 → astreum-0.2.11}/src/astreum/lispeum/__init__.py +0 -0
  22. {astreum-0.2.10 → astreum-0.2.11}/src/astreum/lispeum/parser.py +0 -0
  23. {astreum-0.2.10 → astreum-0.2.11}/src/astreum/lispeum/tokenizer.py +0 -0
  24. {astreum-0.2.10 → astreum-0.2.11}/src/astreum/node.py +0 -0
  25. {astreum-0.2.10 → astreum-0.2.11}/src/astreum.egg-info/dependency_links.txt +0 -0
  26. {astreum-0.2.10 → astreum-0.2.11}/src/astreum.egg-info/requires.txt +0 -0
  27. {astreum-0.2.10 → astreum-0.2.11}/src/astreum.egg-info/top_level.txt +0 -0
  28. {astreum-0.2.10 → astreum-0.2.11}/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.10
3
+ Version: 0.2.11
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
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "astreum"
3
- version = "0.2.10"
3
+ version = "0.2.11"
4
4
  authors = [
5
5
  { name="Roy R. O. Okello", email="roy@stelar.xyz" },
6
6
  ]
File without changes
@@ -0,0 +1,45 @@
1
+ import blake3
2
+ from typing import Callable, Dict, List, Optional
3
+ from astreum import format
4
+
5
+ EMPTY_HASH = b"\x00" * 32
6
+
7
+ class PatriciaNode:
8
+ def __init__(
9
+ self,
10
+ key_len: int,
11
+ key_bits: bytes,
12
+ value: bytes,
13
+ children: List[bytes]|None = None
14
+ ):
15
+ self.key_len = key_len
16
+ self.key_bits = key_bits
17
+ self.value = value
18
+ self.children = children
19
+ self._hash: bytes | None = None
20
+
21
+ def to_bytes(self) -> bytes:
22
+ key_field = bytes([self.key_len]) + self.key_bits
23
+ return format.encode([key_field, self.value, self.children])
24
+
25
+ @classmethod
26
+ def from_bytes(cls, blob: bytes) -> "PatriciaNode":
27
+ key_field, value, children = format.decode(blob)
28
+ key_len = key_field[0]
29
+ key_bits = key_field[1:]
30
+ return cls(key_len, key_bits, value, children)
31
+
32
+ def hash(self) -> bytes:
33
+ if self._hash is None:
34
+ self._hash = blake3.blake3(self.to_bytes()).digest()
35
+ return self._hash
36
+
37
+ class PatriciaTrie:
38
+ def __init__(
39
+ self,
40
+ node_get: Callable[[bytes], Optional[bytes]],
41
+ root_hash: Optional[bytes] = None,
42
+ ) -> None:
43
+ self._node_get = node_get
44
+ self.nodes: Dict[bytes, bytes] = {}
45
+ self.root_hash: Optional[bytes] = root_hash
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: astreum
3
- Version: 0.2.10
3
+ Version: 0.2.11
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
@@ -21,4 +21,6 @@ src/astreum/crypto/x25519.py
21
21
  src/astreum/lispeum/__init__.py
22
22
  src/astreum/lispeum/parser.py
23
23
  src/astreum/lispeum/tokenizer.py
24
+ src/astreum/utils/__init__.py
25
+ src/astreum/utils/patricia.py
24
26
  tests/test_node_machine.py
File without changes
File without changes
File without changes
File without changes
File without changes