astreum 0.3.16__py3-none-any.whl → 0.3.46__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.
Files changed (60) hide show
  1. astreum/__init__.py +1 -2
  2. astreum/communication/__init__.py +15 -11
  3. astreum/communication/difficulty.py +39 -0
  4. astreum/communication/disconnect.py +57 -0
  5. astreum/communication/handlers/handshake.py +105 -62
  6. astreum/communication/handlers/object_request.py +179 -149
  7. astreum/communication/handlers/object_response.py +7 -1
  8. astreum/communication/handlers/ping.py +9 -0
  9. astreum/communication/handlers/route_request.py +7 -1
  10. astreum/communication/handlers/route_response.py +7 -1
  11. astreum/communication/incoming_queue.py +96 -0
  12. astreum/communication/message_pow.py +36 -0
  13. astreum/communication/models/peer.py +4 -0
  14. astreum/communication/models/ping.py +27 -6
  15. astreum/communication/models/route.py +4 -0
  16. astreum/communication/{start.py → node.py} +10 -11
  17. astreum/communication/outgoing_queue.py +108 -0
  18. astreum/communication/processors/incoming.py +110 -37
  19. astreum/communication/processors/outgoing.py +35 -2
  20. astreum/communication/processors/peer.py +133 -58
  21. astreum/communication/setup.py +272 -113
  22. astreum/communication/util.py +14 -0
  23. astreum/node.py +99 -92
  24. astreum/storage/actions/get.py +79 -48
  25. astreum/storage/actions/set.py +171 -156
  26. astreum/storage/providers.py +24 -0
  27. astreum/storage/setup.py +23 -22
  28. astreum/utils/config.py +234 -45
  29. astreum/utils/logging.py +1 -1
  30. astreum/{consensus → validation}/__init__.py +0 -4
  31. astreum/validation/constants.py +2 -0
  32. astreum/{consensus → validation}/genesis.py +4 -6
  33. astreum/validation/models/block.py +544 -0
  34. astreum/validation/models/fork.py +511 -0
  35. astreum/{consensus → validation}/models/receipt.py +17 -4
  36. astreum/{consensus → validation}/models/transaction.py +45 -3
  37. astreum/validation/node.py +190 -0
  38. astreum/{consensus → validation}/validator.py +1 -1
  39. astreum/validation/workers/__init__.py +8 -0
  40. astreum/{consensus → validation}/workers/validation.py +360 -333
  41. astreum/verification/__init__.py +4 -0
  42. astreum/{consensus/workers/discovery.py → verification/discover.py} +1 -1
  43. astreum/verification/node.py +61 -0
  44. astreum/verification/worker.py +183 -0
  45. {astreum-0.3.16.dist-info → astreum-0.3.46.dist-info}/METADATA +43 -9
  46. astreum-0.3.46.dist-info/RECORD +79 -0
  47. astreum/consensus/models/block.py +0 -364
  48. astreum/consensus/models/chain.py +0 -66
  49. astreum/consensus/models/fork.py +0 -100
  50. astreum/consensus/setup.py +0 -83
  51. astreum/consensus/start.py +0 -67
  52. astreum/consensus/workers/__init__.py +0 -9
  53. astreum/consensus/workers/verify.py +0 -90
  54. astreum-0.3.16.dist-info/RECORD +0 -72
  55. /astreum/{consensus → validation}/models/__init__.py +0 -0
  56. /astreum/{consensus → validation}/models/account.py +0 -0
  57. /astreum/{consensus → validation}/models/accounts.py +0 -0
  58. {astreum-0.3.16.dist-info → astreum-0.3.46.dist-info}/WHEEL +0 -0
  59. {astreum-0.3.16.dist-info → astreum-0.3.46.dist-info}/licenses/LICENSE +0 -0
  60. {astreum-0.3.16.dist-info → astreum-0.3.46.dist-info}/top_level.txt +0 -0
@@ -1,90 +0,0 @@
1
- from __future__ import annotations
2
-
3
- import time
4
- from queue import Empty
5
- from typing import Any, Set
6
-
7
- from ..models.fork import Fork
8
-
9
-
10
- def _process_peers_latest_block(
11
- node: Any, latest_block_hash: bytes, peer_ids: Set[Any]
12
- ) -> None:
13
- """Assign peers to the fork that matches their reported head."""
14
- node.logger.debug(
15
- "Processing %d peers reporting block %s",
16
- len(peer_ids),
17
- latest_block_hash.hex() if isinstance(latest_block_hash, (bytes, bytearray)) else latest_block_hash,
18
- )
19
- new_fork = Fork(head=latest_block_hash)
20
-
21
- current_fork_heads = {
22
- fk.head for fk in node.forks.values() if fk.head != latest_block_hash
23
- }
24
-
25
- new_fork.validate(storage_get=node.storage_get, stop_heads=current_fork_heads)
26
-
27
- if new_fork.validated_upto and new_fork.validated_upto in node.forks:
28
- ref = node.forks[new_fork.validated_upto]
29
- if getattr(ref, "malicious_block_hash", None):
30
- node.logger.warning(
31
- "Skipping fork from block %s referencing malicious fork %s",
32
- latest_block_hash.hex() if isinstance(latest_block_hash, (bytes, bytearray)) else latest_block_hash,
33
- new_fork.validated_upto.hex() if isinstance(new_fork.validated_upto, (bytes, bytearray)) else new_fork.validated_upto,
34
- )
35
- return
36
- new_fork.root = ref.root
37
- new_fork.validated_upto = ref.validated_upto
38
- new_fork.chain_fork_position = ref.chain_fork_position
39
-
40
- for peer_id in peer_ids:
41
- new_fork.add_peer(peer_id)
42
- for head, fork in list(node.forks.items()):
43
- if head != latest_block_hash:
44
- fork.remove_peer(peer_id)
45
-
46
- node.forks[latest_block_hash] = new_fork
47
- node.logger.debug(
48
- "Fork %s now has %d peers (total forks %d)",
49
- latest_block_hash.hex() if isinstance(latest_block_hash, (bytes, bytearray)) else latest_block_hash,
50
- len(new_fork.peers),
51
- len(node.forks),
52
- )
53
-
54
-
55
- def make_verify_worker(node: Any):
56
- """Build the verify worker bound to the given node."""
57
-
58
- def _verify_worker() -> None:
59
- node.logger.info("Verify worker started")
60
- stop = node._validation_stop_event
61
- while not stop.is_set():
62
- batch: list[tuple[bytes, Set[Any]]] = []
63
- try:
64
- while True:
65
- latest_b, peers = node._validation_verify_queue.get_nowait()
66
- batch.append((latest_b, peers))
67
- except Empty:
68
- pass
69
-
70
- if not batch:
71
- node.logger.debug("Verify queue empty; sleeping")
72
- time.sleep(0.1)
73
- continue
74
-
75
- for latest_b, peers in batch:
76
- try:
77
- _process_peers_latest_block(node, latest_b, peers)
78
- node.logger.debug(
79
- "Updated forks from block %s for %d peers",
80
- latest_b.hex() if isinstance(latest_b, (bytes, bytearray)) else latest_b,
81
- len(peers),
82
- )
83
- except Exception:
84
- latest_hex = (
85
- latest_b.hex() if isinstance(latest_b, (bytes, bytearray)) else latest_b
86
- )
87
- node.logger.exception("Failed processing verification batch for %s", latest_hex)
88
- node.logger.info("Verify worker stopped")
89
-
90
- return _verify_worker
@@ -1,72 +0,0 @@
1
- astreum/__init__.py,sha256=ohPOPq9IdKln63LvbLR6HwWjMnvInelwlW-FXRFXa2M,370
2
- astreum/node.py,sha256=Rl4SdsA5olkgY33Q_d8XpKQfECKvqfTN_Y2FkCx6uE0,2852
3
- astreum/communication/__init__.py,sha256=wNxzsAk8Fol9cGMPuVvY4etrrMqn3SjZq1dE82kFrxw,228
4
- astreum/communication/setup.py,sha256=tDf4koYu04u_iOCeuvYyTaJaxQm6-yIGkedXCoWjT8w,5876
5
- astreum/communication/start.py,sha256=wxL1cgChebhnaeEaY9flS6qybo_cFW2-tcRvjLxC8Hw,1823
6
- astreum/communication/util.py,sha256=fS3u3giOOXmvN0_reb0oIaXsFESHAWz-bbAuzdzdGQ4,1575
7
- astreum/communication/handlers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
- astreum/communication/handlers/handshake.py,sha256=LZLW06tufhiLAW0k1yC8n6wvTPT5VaUAvncHl8fm5n8,1910
9
- astreum/communication/handlers/object_request.py,sha256=n_ThJomdYXm6HPfkLMmCqRxO58xPCUOHXf1ddmG-OC8,7163
10
- astreum/communication/handlers/object_response.py,sha256=X5MfYxd_b4SfKq3129Fi29ZfLynWNRyhGuoISiMHy20,3959
11
- astreum/communication/handlers/ping.py,sha256=2fVynfVIsbWHtf7lpM6fTYWmeG0I1WSU3tmgCh9di7A,916
12
- astreum/communication/handlers/route_request.py,sha256=KrucRgiM_oFNmwt93bRzNpeVHFATq3uhlNjGJIvzu-c,2477
13
- astreum/communication/handlers/route_response.py,sha256=ZUKyXPpZzpVYKBgygMIlPjcmjrxi0s8M3COFfY5aO4A,1744
14
- astreum/communication/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
15
- astreum/communication/models/message.py,sha256=2qln_PpKkVEoPdSGeQxUWAFxcEsHB-lz7dzTAsO94HU,4485
16
- astreum/communication/models/peer.py,sha256=834UyyErBGbZs4dxe_SWz3gnRGnvFyc-7XQPrdNvDFE,1669
17
- astreum/communication/models/ping.py,sha256=u_DQTZJsbMdYiDDqjdZDsLaN5na2m9WZjVeEM3zq9_Y,955
18
- astreum/communication/models/route.py,sha256=NdmnI1J1wFs2pkm6W0Kv-29JeqGiHcKlw4-esT5ZFLA,3797
19
- astreum/communication/processors/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
20
- astreum/communication/processors/incoming.py,sha256=10l6Az-Ul_2BvYpTXgPiL9bL0te1q3GB3aET0JednKE,3325
21
- astreum/communication/processors/outgoing.py,sha256=09nAeTzvo3jGWl3SLgIQr8vfmO_IvdDqSG7_ZKThYPk,593
22
- astreum/communication/processors/peer.py,sha256=1P_-F1stJtXCPI3vlDtLcsQpQRTQQl1dNyJBDeFRGP4,2129
23
- astreum/consensus/__init__.py,sha256=VZR_NyGSD5VvZp3toD2zpdYwFDLBIcckeVZXFPlruuU,425
24
- astreum/consensus/genesis.py,sha256=RI9AzQFmDTgNFuiiTmW2dDiGcURIUGmThdRpxWrUOBk,1962
25
- astreum/consensus/setup.py,sha256=lrEapfpJXKqw4iwST11-tqPAI2VW2h3H6Ue4JDAtrP4,3142
26
- astreum/consensus/start.py,sha256=DM45Pw6JL5rew-KpcspINguH43ZUHr4v99tXjYqaEkE,2551
27
- astreum/consensus/validator.py,sha256=Jj9_ndZ358yAqVzQpLyjr4lkBjdCscAYoqAi-Ja3Qoo,3871
28
- astreum/consensus/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
29
- astreum/consensus/models/account.py,sha256=3QcT59QUZynysLSbiywidFYVzYJ3LR6qia7JwXOwn4I,2690
30
- astreum/consensus/models/accounts.py,sha256=iUMs6LvmMea-gxd6-ujkFjqhWmuW1cl9XTWGXQkpLys,2388
31
- astreum/consensus/models/block.py,sha256=nNtw9TbEAF1mIEfgJr1fuswcZ0B63SVnuBANqJ5Zaac,13531
32
- astreum/consensus/models/chain.py,sha256=SIIDFSYbag76kTUNwnuJ2_zyuhFsvT7n5HgrVTxBrvE,2797
33
- astreum/consensus/models/fork.py,sha256=IbXRB93bUg2k3q3oQ9dOPzozV-rY-TEDFjYrw-WBymE,3859
34
- astreum/consensus/models/receipt.py,sha256=KjKKjYp_LnP2zkX1FLIwD_4hqKV1b2TPfp43tY701q4,3336
35
- astreum/consensus/models/transaction.py,sha256=AYa1Q-BaYW3mkOv1e3WbvDFEsYamKMiFrja-eO2zU_Y,7475
36
- astreum/consensus/workers/__init__.py,sha256=bS5FjbevbIR5FHbVGnT4Jli17VIld_5auemRw4CaHFU,278
37
- astreum/consensus/workers/discovery.py,sha256=u6HyxamMVJjYnPFPa_U95I2pN9UzHRQ-LOa7YYZT808,2453
38
- astreum/consensus/workers/validation.py,sha256=geHcKaTUIbCnYvAHj9xTbiSMQTpvH6kJ4O5b5sCFUwk,14540
39
- astreum/consensus/workers/verify.py,sha256=tBBrAHH8Xcg3uopmQSjT6iuZd1s-9FkLnJ_JgeW5HdU,3423
40
- astreum/crypto/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
41
- astreum/crypto/chacha20poly1305.py,sha256=01VtLx_bdJC86ifQeTA494ZdKbPM2MswDTLmAs9bl8c,2479
42
- astreum/crypto/ed25519.py,sha256=FRnvlN0kZlxn4j-sJKl-C9tqiz_0z4LZyXLj3KIj1TQ,1760
43
- astreum/crypto/quadratic_form.py,sha256=pJgbORey2NTWbQNhdyvrjy_6yjORudQ67jBz2ScHptg,4037
44
- astreum/crypto/wesolowski.py,sha256=SUgGXW3Id07dJtWzDcs4dluIhjqbRWQ8YWjn_mK78AQ,4092
45
- astreum/crypto/x25519.py,sha256=i29v4BmwKRcbz9E7NKqFDQyxzFtJUqN0St9jd7GS1uA,1137
46
- astreum/machine/__init__.py,sha256=TjWf9RlGuOGbCqdjJKidh8W4pCzUoLpi3FgutssEGoQ,479
47
- astreum/machine/parser.py,sha256=Z_Y0Sax0rPh8JcIo19-iNDQoc5GTdGQkmfFyLpCB4bw,1757
48
- astreum/machine/tokenizer.py,sha256=6wPqR_D3h5BEvR78XKtD45ouy77RZBbz4Yh4jHSmN4o,2394
49
- astreum/machine/evaluations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
50
- astreum/machine/evaluations/high_evaluation.py,sha256=cqYudR9WAdVz9dURDyuQhZsuhWbmjbdw9x3UxDEYpPI,9971
51
- astreum/machine/evaluations/low_evaluation.py,sha256=_93r6DKkCwnaOKmVGSp8JBlUPZpKrA1GECqVnwLb9es,10370
52
- astreum/machine/evaluations/script_evaluation.py,sha256=eWouYUwTYzaqUyXqEe-lAJFIluW0gMeCDdXqle88oWw,864
53
- astreum/machine/models/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
54
- astreum/machine/models/environment.py,sha256=WjP6GRX_8e0-BAhzRLvQ6fYtKQEVR0LZi7DZNZS0TSE,1019
55
- astreum/machine/models/expression.py,sha256=yYr9ktk-NWPL4EXwHz7ePvr9eNvfSBQe3yzRUz06yas,7675
56
- astreum/machine/models/meter.py,sha256=5q2PFW7_jmgKVM1-vwE4RRjMfPEthUA4iu1CwR-Axws,505
57
- astreum/storage/__init__.py,sha256=Flk6WXT2xGFHWWJiZHK3O5OpjoLTOFMqqIiJTtD58kY,111
58
- astreum/storage/requests.py,sha256=q_rxG_k7POth93HmsUTCLSyNw-4EdFqqNExhIwm7Q0g,818
59
- astreum/storage/setup.py,sha256=fnDZCxVskOAPDl-oTwq-iLiRCD3CKHOEgI4LALNJQWI,612
60
- astreum/storage/actions/get.py,sha256=yf1HMYPMxRXTbZbSoe8JI6C4eWkcbScFQj-nGozBsCQ,6845
61
- astreum/storage/actions/set.py,sha256=8MvlZS3MFvLc-apDb6mucxt1JBxw82lxMVoa0sTvdo8,5751
62
- astreum/storage/models/atom.py,sha256=FY_bgtoju59Yo7TL1DTFTr9_pRMNBuH6-u59D6bz2fc,3163
63
- astreum/storage/models/trie.py,sha256=Bn3ssPGI7YGS4iUH5ESvpG1NE6Ljx2Xo7wkEpQhjKUY,17587
64
- astreum/utils/bytes.py,sha256=9QTWC2JCdwWLB5R2mPtmjPro0IUzE58DL3uEul4AheE,846
65
- astreum/utils/config.py,sha256=MASHeLYzaPHG8Z6vLUd14vRH9JByfAL05tvgZWKrhNM,2517
66
- astreum/utils/integer.py,sha256=iQt-klWOYVghu_NOT341MmHbOle4FDT3by4PNKNXscg,736
67
- astreum/utils/logging.py,sha256=mRDtWSCj8vKt58WGKLNSkK9Oa0graNVSoS8URby4Q9g,6684
68
- astreum-0.3.16.dist-info/licenses/LICENSE,sha256=gYBvRDP-cPLmTyJhvZ346QkrYW_eleke4Z2Yyyu43eQ,1089
69
- astreum-0.3.16.dist-info/METADATA,sha256=X6_Ea1a8-C-7At3YvK1OjeUsuqh0zmE1SoeUjJaB7qk,7767
70
- astreum-0.3.16.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
71
- astreum-0.3.16.dist-info/top_level.txt,sha256=1EG1GmkOk3NPmUA98FZNdKouhRyget-KiFiMk0i2Uz0,8
72
- astreum-0.3.16.dist-info/RECORD,,
File without changes
File without changes
File without changes