astreum 0.2.42__py3-none-any.whl → 0.2.43__py3-none-any.whl

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.

@@ -33,7 +33,7 @@ class Account:
33
33
 
34
34
  @classmethod
35
35
  def from_atom(cls, node: Any, account_id: bytes) -> "Account":
36
- storage_get = node._local_get
36
+ storage_get = node.storage_get
37
37
 
38
38
  type_atom = storage_get(account_id)
39
39
  if type_atom is None or type_atom.data != b"account":
@@ -186,9 +186,9 @@ class Block:
186
186
  if callable(source):
187
187
  storage_get = source
188
188
  else:
189
- storage_get = getattr(source, "_local_get", None)
189
+ storage_get = source.storage_get
190
190
  if not callable(storage_get):
191
- raise TypeError("Block.from_atom requires a node with '_local_get' or a callable storage getter")
191
+ raise TypeError("Block.from_atom requires a node with 'storage_get' or a callable storage getter")
192
192
  # 1) Expect main list
193
193
  main_typ = storage_get(block_id)
194
194
  if main_typ is None or main_typ.data != b"list":
@@ -76,7 +76,7 @@ class Transaction:
76
76
  node: Any,
77
77
  transaction_id: bytes,
78
78
  ) -> Transaction:
79
- storage_get = node._local_get
79
+ storage_get = node.storage_get
80
80
  if not callable(storage_get):
81
81
  raise NotImplementedError("node does not expose a storage getter")
82
82
 
@@ -204,7 +204,7 @@ def apply_transaction(node: Any, block: object, transaction_hash: bytes) -> None
204
204
 
205
205
  block.accounts.set_account(address=recipient_account)
206
206
 
207
- block.transactions.append(transaction)
207
+ block.transactions.append(transaction_hash)
208
208
 
209
209
  receipt = Receipt(
210
210
  transaction_hash=bytes(transaction_hash),
@@ -17,7 +17,7 @@ def _process_peers_latest_block(
17
17
  fk.head for fk in node.forks.values() if fk.head != latest_block_hash
18
18
  }
19
19
 
20
- new_fork.validate(storage_get=node._local_get, stop_heads=current_fork_heads)
20
+ new_fork.validate(storage_get=node.storage_get, stop_heads=current_fork_heads)
21
21
 
22
22
  if new_fork.validated_upto and new_fork.validated_upto in node.forks:
23
23
  ref = node.forks[new_fork.validated_upto]
astreum/_node.py CHANGED
@@ -25,9 +25,9 @@ class Node:
25
25
  communication_setup(node=self, config=config)
26
26
  except Exception:
27
27
  pass
28
- try:
29
- from astreum._consensus import consensus_setup # type: ignore
30
- consensus_setup(node=self)
28
+ try:
29
+ from astreum._consensus import consensus_setup # type: ignore
30
+ consensus_setup(node=self)
31
31
  except Exception:
32
32
  pass
33
33
 
@@ -56,3 +56,15 @@ class Node:
56
56
  def _local_set(self, key: bytes, value: Atom) -> None:
57
57
  with self.in_memory_storage_lock:
58
58
  self.in_memory_storage[key] = value
59
+
60
+ def _network_get(self, key: bytes) -> Optional[Atom]:
61
+ # locate storage provider
62
+ # query storage provider
63
+ return None
64
+
65
+ def storage_get(self, key: bytes) -> Optional[Atom]:
66
+ """Retrieve an Atom by checking local storage first, then the network."""
67
+ atom = self._local_get(key)
68
+ if atom is not None:
69
+ return atom
70
+ return self._network_get(key)
@@ -87,7 +87,7 @@ class PatriciaNode:
87
87
  hops = 0
88
88
 
89
89
  while current != ZERO32 and hops < 4:
90
- atom = node._local_get(current)
90
+ atom = node.storage_get(current)
91
91
  if atom is None:
92
92
  raise ValueError("missing atom while decoding Patricia node")
93
93
  entries.append(atom.data)
@@ -163,7 +163,7 @@ class PatriciaTrie:
163
163
  if cached is not None:
164
164
  return cached
165
165
 
166
- if storage_node._local_get(h) is None:
166
+ if storage_node.storage_get(h) is None:
167
167
  return None
168
168
 
169
169
  pat_node = PatriciaNode.from_atoms(storage_node, h)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: astreum
3
- Version: 0.2.42
3
+ Version: 0.2.43
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,5 +1,5 @@
1
1
  astreum/__init__.py,sha256=9tzA27B_eG5wRF1SAWJIV7xTmCcR1QFc123b_cvFOa4,345
2
- astreum/_node.py,sha256=3fpfULVs3MrPBR-ymlvPyuZMi8lv0a8JBnxPb2oFOTU,2214
2
+ astreum/_node.py,sha256=Nyb4NZWWDjfCcIgljWIDAGyX5QTMr1lwBirnWzg13hQ,2642
3
3
  astreum/format.py,sha256=X4tG5GGPweNCE54bHYkLFiuLTbmpy5upO_s1Cef-MGA,2711
4
4
  astreum/node.py,sha256=MmlK3jaANTMB3ZAxR8IaSc82OS9meJmVawYIVURADbg,39689
5
5
  astreum/_communication/__init__.py,sha256=XJui0yOcfAur4HKt-8sSRlwB-MSU1rchkuOAY-nKDOE,207
@@ -10,19 +10,19 @@ astreum/_communication/route.py,sha256=fbVXY0xF3O-k7dY9TuCsr6_XxD3m7Cb9ugVacQZ6G
10
10
  astreum/_communication/setup.py,sha256=TzXpc8dajV31BJhHQMMcb5UdaFrxb1xlYSj58vc_5mg,9072
11
11
  astreum/_communication/util.py,sha256=bJ3td3naDzmCelAJQpLwiDMoRBkijQl9YLROjsWyOrI,1256
12
12
  astreum/_consensus/__init__.py,sha256=gOCpvnIeO17CGjUGr0odaKNvGEggmDRXfT5IuyrYtcM,376
13
- astreum/_consensus/account.py,sha256=XCBWRapmFMrLCzz0wLtuuIaDRyNN9IKyOGc4dEl8W0s,3294
13
+ astreum/_consensus/account.py,sha256=ClMB1e07ky5Wf7BwR4yhEjTSaWK2wiCmpvzio9AsZAY,3295
14
14
  astreum/_consensus/accounts.py,sha256=zGq2BCMJPtD_lzcj4jqMzB2Foc3ptxXSPhc9zypB1T0,1106
15
- astreum/_consensus/block.py,sha256=v6U2y8br9PVKGn0Q8fLVOtEODlXayPtEd_Wqprem_TU,12358
15
+ astreum/_consensus/block.py,sha256=HybdVcV1D9f1wUE9XeFRnCGF9HH8YI1bgo-y1h-RS5o,12342
16
16
  astreum/_consensus/chain.py,sha256=WwUeLrdg7uj--ZsUxse6xFlzO2QeQQggyKSL49KhfU0,2768
17
17
  astreum/_consensus/fork.py,sha256=dK5DtT9hWCj_rQs6MS1c1bcGBbkgVTBPIOudYbqS9vw,3825
18
18
  astreum/_consensus/genesis.py,sha256=oED7AHw0fPJgMu0OmhbbikJcbItw_bxVBVU8RlB2rJM,4766
19
19
  astreum/_consensus/receipt.py,sha256=GPLspqVJHnyBr1cKmBoClsJyeEUecYmg3_acz4L4rRo,6031
20
20
  astreum/_consensus/setup.py,sha256=agwqfOemdLqE0Z1zrPV2XHVmZ9sAxp8Bh4k6e2u-t8w,2385
21
- astreum/_consensus/transaction.py,sha256=VRp06ExbjAebiPcTZEX7PH-zwjzy4CLcf5kclyooL1k,7475
21
+ astreum/_consensus/transaction.py,sha256=q9r0nQzB_67dV-9cIThCzpiJkTojP--8QENPOKxN5yw,7481
22
22
  astreum/_consensus/workers/__init__.py,sha256=bS5FjbevbIR5FHbVGnT4Jli17VIld_5auemRw4CaHFU,278
23
23
  astreum/_consensus/workers/discovery.py,sha256=X1yjKGjLSApMJ9mgWbnc7N21ALD09khDf-in-M45Mis,1683
24
24
  astreum/_consensus/workers/validation.py,sha256=WcHLOs2NLMTrJpErghBXWeW2aqtX3-xGPo-HcySdEZ8,4814
25
- astreum/_consensus/workers/verify.py,sha256=uqmf2UICj_eBFeGDpGyzKQLtz9qeCbOtz5euwNqkZmw,1924
25
+ astreum/_consensus/workers/verify.py,sha256=wNkfh5qMARew79B-yyGL2UiExaSoGpOIq0fXUkDzpdw,1925
26
26
  astreum/_lispeum/__init__.py,sha256=LAy2Z-gBBQlByBHRGUKaaQrOB7QzFEEyGRtInmwTpfU,304
27
27
  astreum/_lispeum/environment.py,sha256=pJ0rjp9GoQxHhDiPIVei0jP7dZ_Pznso2O_tpp94-Ik,328
28
28
  astreum/_lispeum/expression.py,sha256=io8tbCer_1TJee77yRbcNI5q-DPFGa8xZiC80tGvRRQ,1063
@@ -33,7 +33,7 @@ astreum/_lispeum/parser.py,sha256=WOW3sSZWkIzPEy3fYTyl0lrtkMxHL9zRrNSYztPDemQ,22
33
33
  astreum/_lispeum/tokenizer.py,sha256=P68uIj4aPKzjuCJ85jfzRi67QztpuXIOC1vvLQueBI4,552
34
34
  astreum/_storage/__init__.py,sha256=EmKZNAZmo3UVE3ekOOuckwFnBVjpa0Sy8Oxg72Lgdxc,53
35
35
  astreum/_storage/atom.py,sha256=YFjvfMhniInch13iaKGpw4CCxxgyWonniryb-Rfse4A,4177
36
- astreum/_storage/patricia.py,sha256=Eh8AO2_J8WCai4kyuML_0Jb_zntgGlq-VPljnSjss10,14851
36
+ astreum/_storage/patricia.py,sha256=7kvhW8RJWZ_EOHjNgEHue2E60FeQfJaKWtLIbM-6G2E,14853
37
37
  astreum/crypto/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
38
38
  astreum/crypto/ed25519.py,sha256=FRnvlN0kZlxn4j-sJKl-C9tqiz_0z4LZyXLj3KIj1TQ,1760
39
39
  astreum/crypto/quadratic_form.py,sha256=pJgbORey2NTWbQNhdyvrjy_6yjORudQ67jBz2ScHptg,4037
@@ -47,8 +47,8 @@ astreum/storage/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
47
47
  astreum/storage/object.py,sha256=knFlvw_tpcC4twSu1DGNpHX31wlANN8E5dgEqIfU--Q,2041
48
48
  astreum/storage/setup.py,sha256=1-9ztEFI_BvRDvAA0lAn4mFya8iq65THTArlj--M3Hg,626
49
49
  astreum/utils/integer.py,sha256=iQt-klWOYVghu_NOT341MmHbOle4FDT3by4PNKNXscg,736
50
- astreum-0.2.42.dist-info/licenses/LICENSE,sha256=gYBvRDP-cPLmTyJhvZ346QkrYW_eleke4Z2Yyyu43eQ,1089
51
- astreum-0.2.42.dist-info/METADATA,sha256=xb_Bi75R1izIliHmHZQiJ93TxWPn6l9Z9EiN4IqVTAc,6181
52
- astreum-0.2.42.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
53
- astreum-0.2.42.dist-info/top_level.txt,sha256=1EG1GmkOk3NPmUA98FZNdKouhRyget-KiFiMk0i2Uz0,8
54
- astreum-0.2.42.dist-info/RECORD,,
50
+ astreum-0.2.43.dist-info/licenses/LICENSE,sha256=gYBvRDP-cPLmTyJhvZ346QkrYW_eleke4Z2Yyyu43eQ,1089
51
+ astreum-0.2.43.dist-info/METADATA,sha256=IjEYvHsaHI08xcD8hrZ5Pn9EZmwEPTNErSTqmv18t7Q,6181
52
+ astreum-0.2.43.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
53
+ astreum-0.2.43.dist-info/top_level.txt,sha256=1EG1GmkOk3NPmUA98FZNdKouhRyget-KiFiMk0i2Uz0,8
54
+ astreum-0.2.43.dist-info/RECORD,,