zexus 1.6.8 → 1.7.2
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.
- package/README.md +12 -5
- package/package.json +1 -1
- package/src/__init__.py +7 -0
- package/src/zexus/__init__.py +1 -1
- package/src/zexus/__pycache__/__init__.cpython-312.pyc +0 -0
- package/src/zexus/__pycache__/capability_system.cpython-312.pyc +0 -0
- package/src/zexus/__pycache__/debug_sanitizer.cpython-312.pyc +0 -0
- package/src/zexus/__pycache__/environment.cpython-312.pyc +0 -0
- package/src/zexus/__pycache__/error_reporter.cpython-312.pyc +0 -0
- package/src/zexus/__pycache__/input_validation.cpython-312.pyc +0 -0
- package/src/zexus/__pycache__/lexer.cpython-312.pyc +0 -0
- package/src/zexus/__pycache__/module_cache.cpython-312.pyc +0 -0
- package/src/zexus/__pycache__/module_manager.cpython-312.pyc +0 -0
- package/src/zexus/__pycache__/object.cpython-312.pyc +0 -0
- package/src/zexus/__pycache__/security.cpython-312.pyc +0 -0
- package/src/zexus/__pycache__/security_enforcement.cpython-312.pyc +0 -0
- package/src/zexus/__pycache__/syntax_validator.cpython-312.pyc +0 -0
- package/src/zexus/__pycache__/zexus_ast.cpython-312.pyc +0 -0
- package/src/zexus/__pycache__/zexus_token.cpython-312.pyc +0 -0
- package/src/zexus/access_control_system/__pycache__/__init__.cpython-312.pyc +0 -0
- package/src/zexus/access_control_system/__pycache__/access_control.cpython-312.pyc +0 -0
- package/src/zexus/advanced_types.py +17 -2
- package/src/zexus/blockchain/__init__.py +411 -0
- package/src/zexus/blockchain/accelerator.py +1160 -0
- package/src/zexus/blockchain/chain.py +660 -0
- package/src/zexus/blockchain/consensus.py +821 -0
- package/src/zexus/blockchain/contract_vm.py +1019 -0
- package/src/zexus/blockchain/crypto.py +79 -14
- package/src/zexus/blockchain/events.py +526 -0
- package/src/zexus/blockchain/loadtest.py +721 -0
- package/src/zexus/blockchain/monitoring.py +350 -0
- package/src/zexus/blockchain/mpt.py +716 -0
- package/src/zexus/blockchain/multichain.py +951 -0
- package/src/zexus/blockchain/multiprocess_executor.py +338 -0
- package/src/zexus/blockchain/network.py +886 -0
- package/src/zexus/blockchain/node.py +666 -0
- package/src/zexus/blockchain/rpc.py +1203 -0
- package/src/zexus/blockchain/rust_bridge.py +421 -0
- package/src/zexus/blockchain/storage.py +423 -0
- package/src/zexus/blockchain/tokens.py +750 -0
- package/src/zexus/blockchain/upgradeable.py +1004 -0
- package/src/zexus/blockchain/verification.py +1602 -0
- package/src/zexus/blockchain/wallet.py +621 -0
- package/src/zexus/capability_system.py +184 -9
- package/src/zexus/cli/__pycache__/main.cpython-312.pyc +0 -0
- package/src/zexus/cli/main.py +383 -34
- package/src/zexus/cli/zpm.py +1 -1
- package/src/zexus/compiler/__pycache__/bytecode.cpython-312.pyc +0 -0
- package/src/zexus/compiler/__pycache__/lexer.cpython-312.pyc +0 -0
- package/src/zexus/compiler/__pycache__/parser.cpython-312.pyc +0 -0
- package/src/zexus/compiler/__pycache__/semantic.cpython-312.pyc +0 -0
- package/src/zexus/compiler/__pycache__/zexus_ast.cpython-312.pyc +0 -0
- package/src/zexus/compiler/bytecode.py +124 -7
- package/src/zexus/compiler/compat_runtime.py +6 -2
- package/src/zexus/compiler/lexer.py +16 -5
- package/src/zexus/compiler/parser.py +108 -7
- package/src/zexus/compiler/semantic.py +18 -19
- package/src/zexus/compiler/zexus_ast.py +26 -1
- package/src/zexus/concurrency_system.py +79 -0
- package/src/zexus/config.py +54 -0
- package/src/zexus/crypto_bridge.py +244 -8
- package/src/zexus/dap/__init__.py +10 -0
- package/src/zexus/dap/__main__.py +4 -0
- package/src/zexus/dap/dap_server.py +391 -0
- package/src/zexus/dap/debug_engine.py +298 -0
- package/src/zexus/environment.py +112 -9
- package/src/zexus/evaluator/__pycache__/bytecode_compiler.cpython-312.pyc +0 -0
- package/src/zexus/evaluator/__pycache__/core.cpython-312.pyc +0 -0
- package/src/zexus/evaluator/__pycache__/expressions.cpython-312.pyc +0 -0
- package/src/zexus/evaluator/__pycache__/functions.cpython-312.pyc +0 -0
- package/src/zexus/evaluator/__pycache__/resource_limiter.cpython-312.pyc +0 -0
- package/src/zexus/evaluator/__pycache__/statements.cpython-312.pyc +0 -0
- package/src/zexus/evaluator/__pycache__/unified_execution.cpython-312.pyc +0 -0
- package/src/zexus/evaluator/__pycache__/utils.cpython-312.pyc +0 -0
- package/src/zexus/evaluator/bytecode_compiler.py +457 -37
- package/src/zexus/evaluator/core.py +644 -50
- package/src/zexus/evaluator/expressions.py +358 -62
- package/src/zexus/evaluator/functions.py +458 -20
- package/src/zexus/evaluator/resource_limiter.py +4 -4
- package/src/zexus/evaluator/statements.py +774 -122
- package/src/zexus/evaluator/unified_execution.py +573 -72
- package/src/zexus/evaluator/utils.py +14 -2
- package/src/zexus/evaluator_original.py +1 -1
- package/src/zexus/event_loop.py +186 -0
- package/src/zexus/lexer.py +742 -458
- package/src/zexus/lsp/__init__.py +1 -1
- package/src/zexus/lsp/definition_provider.py +163 -9
- package/src/zexus/lsp/server.py +22 -8
- package/src/zexus/lsp/symbol_provider.py +182 -9
- package/src/zexus/module_cache.py +239 -9
- package/src/zexus/module_manager.py +129 -1
- package/src/zexus/object.py +76 -6
- package/src/zexus/parser/__pycache__/parser.cpython-312.pyc +0 -0
- package/src/zexus/parser/__pycache__/strategy_context.cpython-312.pyc +0 -0
- package/src/zexus/parser/__pycache__/strategy_structural.cpython-312.pyc +0 -0
- package/src/zexus/parser/parser.py +1349 -408
- package/src/zexus/parser/strategy_context.py +755 -58
- package/src/zexus/parser/strategy_structural.py +121 -21
- package/src/zexus/persistence.py +15 -1
- package/src/zexus/renderer/__init__.py +61 -0
- package/src/zexus/renderer/__pycache__/__init__.cpython-312.pyc +0 -0
- package/src/zexus/renderer/__pycache__/backend.cpython-312.pyc +0 -0
- package/src/zexus/renderer/__pycache__/canvas.cpython-312.pyc +0 -0
- package/src/zexus/renderer/__pycache__/color_system.cpython-312.pyc +0 -0
- package/src/zexus/renderer/__pycache__/layout.cpython-312.pyc +0 -0
- package/src/zexus/renderer/__pycache__/main_renderer.cpython-312.pyc +0 -0
- package/src/zexus/renderer/__pycache__/painter.cpython-312.pyc +0 -0
- package/src/zexus/renderer/backend.py +261 -0
- package/src/zexus/renderer/canvas.py +78 -0
- package/src/zexus/renderer/color_system.py +201 -0
- package/src/zexus/renderer/graphics.py +31 -0
- package/src/zexus/renderer/layout.py +222 -0
- package/src/zexus/renderer/main_renderer.py +66 -0
- package/src/zexus/renderer/painter.py +30 -0
- package/src/zexus/renderer/tk_backend.py +208 -0
- package/src/zexus/renderer/web_backend.py +260 -0
- package/src/zexus/runtime/__init__.py +10 -2
- package/src/zexus/runtime/__pycache__/__init__.cpython-312.pyc +0 -0
- package/src/zexus/runtime/__pycache__/async_runtime.cpython-312.pyc +0 -0
- package/src/zexus/runtime/__pycache__/load_manager.cpython-312.pyc +0 -0
- package/src/zexus/runtime/file_flags.py +137 -0
- package/src/zexus/runtime/load_manager.py +368 -0
- package/src/zexus/safety/__pycache__/__init__.cpython-312.pyc +0 -0
- package/src/zexus/safety/__pycache__/memory_safety.cpython-312.pyc +0 -0
- package/src/zexus/security.py +424 -34
- package/src/zexus/stdlib/fs.py +23 -18
- package/src/zexus/stdlib/http.py +289 -186
- package/src/zexus/stdlib/sockets.py +207 -163
- package/src/zexus/stdlib/websockets.py +282 -0
- package/src/zexus/stdlib_integration.py +369 -2
- package/src/zexus/strategy_recovery.py +6 -3
- package/src/zexus/type_checker.py +423 -0
- package/src/zexus/virtual_filesystem.py +189 -2
- package/src/zexus/vm/__init__.py +113 -3
- package/src/zexus/vm/__pycache__/async_optimizer.cpython-312.pyc +0 -0
- package/src/zexus/vm/__pycache__/bytecode.cpython-312.pyc +0 -0
- package/src/zexus/vm/__pycache__/bytecode_converter.cpython-312.pyc +0 -0
- package/src/zexus/vm/__pycache__/cache.cpython-312.pyc +0 -0
- package/src/zexus/vm/__pycache__/compiler.cpython-312.pyc +0 -0
- package/src/zexus/vm/__pycache__/gas_metering.cpython-312.pyc +0 -0
- package/src/zexus/vm/__pycache__/jit.cpython-312.pyc +0 -0
- package/src/zexus/vm/__pycache__/parallel_vm.cpython-312.pyc +0 -0
- package/src/zexus/vm/__pycache__/vm.cpython-312.pyc +0 -0
- package/src/zexus/vm/async_optimizer.py +80 -6
- package/src/zexus/vm/binary_bytecode.py +659 -0
- package/src/zexus/vm/bytecode.py +59 -11
- package/src/zexus/vm/bytecode_converter.py +26 -12
- package/src/zexus/vm/cabi.c +1985 -0
- package/src/zexus/vm/cabi.cpython-312-x86_64-linux-gnu.so +0 -0
- package/src/zexus/vm/cabi.h +127 -0
- package/src/zexus/vm/cache.py +561 -17
- package/src/zexus/vm/compiler.py +818 -51
- package/src/zexus/vm/fastops.c +15743 -0
- package/src/zexus/vm/fastops.cpython-312-x86_64-linux-gnu.so +0 -0
- package/src/zexus/vm/fastops.pyx +288 -0
- package/src/zexus/vm/gas_metering.py +50 -9
- package/src/zexus/vm/jit.py +364 -20
- package/src/zexus/vm/native_jit_backend.py +1816 -0
- package/src/zexus/vm/native_runtime.cpp +1388 -0
- package/src/zexus/vm/native_runtime.cpython-312-x86_64-linux-gnu.so +0 -0
- package/src/zexus/vm/optimizer.py +161 -11
- package/src/zexus/vm/parallel_vm.py +140 -45
- package/src/zexus/vm/peephole_optimizer.py +82 -4
- package/src/zexus/vm/profiler.py +38 -18
- package/src/zexus/vm/register_allocator.py +16 -5
- package/src/zexus/vm/register_vm.py +8 -5
- package/src/zexus/vm/vm.py +3581 -531
- package/src/zexus/vm/wasm_compiler.py +658 -0
- package/src/zexus/zexus_ast.py +137 -11
- package/src/zexus/zexus_token.py +16 -5
- package/src/zexus/zpm/installer.py +55 -15
- package/src/zexus/zpm/package_manager.py +1 -1
- package/src/zexus/zpm/registry.py +257 -28
- package/src/zexus.egg-info/PKG-INFO +16 -6
- package/src/zexus.egg-info/SOURCES.txt +129 -17
- package/src/zexus.egg-info/entry_points.txt +1 -0
- package/src/zexus.egg-info/requires.txt +4 -0
package/README.md
CHANGED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
|
|
3
3
|
<div align="center">
|
|
4
4
|
|
|
5
|
-

|
|
6
6
|
[](LICENSE)
|
|
7
7
|
[](https://python.org)
|
|
8
8
|
[](https://github.com/Zaidux/zexus-interpreter)
|
|
9
9
|
|
|
10
10
|
**A modern, security-first programming language with built-in blockchain support, VM-accelerated execution, advanced memory management, and policy-as-code**
|
|
11
11
|
|
|
12
|
-
[What's New](#-whats-new-in-
|
|
12
|
+
[What's New](#-whats-new-in-v171) • [Features](#-key-features) • [Installation](#-installation) • [Quick Start](#-quick-start) • [Keywords](#-complete-keyword-reference) • [Documentation](#-documentation) • [Examples](#-examples) • [Troubleshooting](#-getting-help--troubleshooting)
|
|
13
13
|
|
|
14
14
|
</div>
|
|
15
15
|
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
## 📋 Table of Contents
|
|
19
19
|
|
|
20
20
|
- [What is Zexus?](#-what-is-zexus)
|
|
21
|
-
- [What's New](#-whats-new-in-
|
|
21
|
+
- [What's New](#-whats-new-in-v171)
|
|
22
22
|
- [Key Features](#-key-features)
|
|
23
23
|
- [VM-Accelerated Performance](#-vm-accelerated-performance-new)
|
|
24
24
|
- [Security & Policy-as-Code](#-security--policy-as-code--verify-enhanced)
|
|
@@ -67,9 +67,16 @@ Zexus is a next-generation, general-purpose programming language designed for se
|
|
|
67
67
|
|
|
68
68
|
---
|
|
69
69
|
|
|
70
|
-
## 🎉 What's New in v1.
|
|
70
|
+
## 🎉 What's New in v1.7.2
|
|
71
71
|
|
|
72
|
-
### Latest Features (v1.
|
|
72
|
+
### Latest Features (v1.7.2)
|
|
73
|
+
|
|
74
|
+
✅ **FIND Keyword** - Declarative project search that resolves exact module paths with scope filtering and smart suggestions
|
|
75
|
+
✅ **LOAD Keyword & Manager** - Provider-aware configuration loader with built-in ENV, JSON, and YAML support plus caching
|
|
76
|
+
✅ **VM + Bytecode Support** - FIND/LOAD now compile to bytecode with helper bridges so scripts run identically in the VM and interpreter
|
|
77
|
+
✅ **Targeted Test Coverage** - Added regression tests that exercise both interpreter and VM paths for FIND/LOAD workflows
|
|
78
|
+
|
|
79
|
+
### Previous Features (v1.6.3)
|
|
73
80
|
|
|
74
81
|
✅ **Complete Database Ecosystem** - Production-ready database drivers
|
|
75
82
|
✅ **4 Database Drivers** - SQLite, PostgreSQL, MySQL, MongoDB fully tested
|
package/package.json
CHANGED
package/src/__init__.py
ADDED
package/src/zexus/__init__.py
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -32,10 +32,25 @@ class TypeParameter:
|
|
|
32
32
|
return self.name == other.name
|
|
33
33
|
|
|
34
34
|
def satisfies_bounds(self, type_spec: 'TypeSpec') -> bool:
|
|
35
|
-
"""Check if type satisfies bounds.
|
|
35
|
+
"""Check if type satisfies bounds.
|
|
36
|
+
|
|
37
|
+
Verifies that type_spec is compatible with all upper bounds
|
|
38
|
+
defined on this type parameter.
|
|
39
|
+
"""
|
|
36
40
|
if not self.bounds:
|
|
37
41
|
return True
|
|
38
|
-
|
|
42
|
+
for bound in self.bounds:
|
|
43
|
+
# If both are AdvancedTypeSpec, use structural compatibility
|
|
44
|
+
if hasattr(type_spec, 'is_assignable_to') and hasattr(bound, 'is_assignable_to'):
|
|
45
|
+
if not type_spec.is_assignable_to(bound):
|
|
46
|
+
return False
|
|
47
|
+
# If both have base_type, compare base types
|
|
48
|
+
elif hasattr(type_spec, 'base_type') and hasattr(bound, 'base_type'):
|
|
49
|
+
if type_spec.base_type != bound.base_type:
|
|
50
|
+
return False
|
|
51
|
+
# String-based comparison fallback
|
|
52
|
+
elif str(type_spec) != str(bound):
|
|
53
|
+
return False
|
|
39
54
|
return True
|
|
40
55
|
|
|
41
56
|
|
|
@@ -9,6 +9,10 @@ Features:
|
|
|
9
9
|
- Gas tracking and execution limits
|
|
10
10
|
- Cryptographic primitives (hashing, signatures)
|
|
11
11
|
- Smart contract execution environment
|
|
12
|
+
- Real blockchain: chain, blocks, mempool
|
|
13
|
+
- P2P networking with peer discovery
|
|
14
|
+
- Pluggable consensus (PoW, PoA, PoS)
|
|
15
|
+
- Full node with mining and sync
|
|
12
16
|
"""
|
|
13
17
|
|
|
14
18
|
from .ledger import Ledger, LedgerManager, get_ledger_manager
|
|
@@ -19,6 +23,170 @@ from .transaction import (
|
|
|
19
23
|
)
|
|
20
24
|
from .crypto import CryptoPlugin, register_crypto_builtins
|
|
21
25
|
|
|
26
|
+
# Real blockchain infrastructure
|
|
27
|
+
from .chain import (
|
|
28
|
+
Block, BlockHeader, Transaction as ChainTransaction,
|
|
29
|
+
TransactionReceipt, Chain, Mempool
|
|
30
|
+
)
|
|
31
|
+
from .storage import (
|
|
32
|
+
StorageBackend, SQLiteBackend, LevelDBBackend, RocksDBBackend,
|
|
33
|
+
MemoryBackend, get_storage_backend, register_backend,
|
|
34
|
+
)
|
|
35
|
+
from .network import P2PNetwork, Message, MessageType, PeerInfo, PeerReputationManager
|
|
36
|
+
from .consensus import (
|
|
37
|
+
ConsensusEngine, ProofOfWork, ProofOfAuthority, ProofOfStake,
|
|
38
|
+
BFTConsensus, BFTMessage, BFTPhase, BFTRoundState,
|
|
39
|
+
create_consensus
|
|
40
|
+
)
|
|
41
|
+
from .node import BlockchainNode, NodeConfig
|
|
42
|
+
|
|
43
|
+
# JSON-RPC server (optional — requires aiohttp)
|
|
44
|
+
try:
|
|
45
|
+
from .rpc import RPCServer, RPCError, RPCErrorCode, RPCMethodRegistry
|
|
46
|
+
_RPC_AVAILABLE = True
|
|
47
|
+
except ImportError:
|
|
48
|
+
_RPC_AVAILABLE = False
|
|
49
|
+
|
|
50
|
+
# Contract VM bridge (connects VM opcodes to real chain state)
|
|
51
|
+
try:
|
|
52
|
+
from .contract_vm import ContractVM, ContractExecutionReceipt, ContractStateAdapter
|
|
53
|
+
_CONTRACT_VM_AVAILABLE = True
|
|
54
|
+
except ImportError:
|
|
55
|
+
_CONTRACT_VM_AVAILABLE = False
|
|
56
|
+
|
|
57
|
+
# Multichain / cross-chain bridge infrastructure
|
|
58
|
+
try:
|
|
59
|
+
from .multichain import (
|
|
60
|
+
ChainRouter,
|
|
61
|
+
BridgeRelay,
|
|
62
|
+
BridgeContract,
|
|
63
|
+
CrossChainMessage,
|
|
64
|
+
MerkleProofEngine,
|
|
65
|
+
MessageStatus,
|
|
66
|
+
)
|
|
67
|
+
_MULTICHAIN_AVAILABLE = True
|
|
68
|
+
except ImportError:
|
|
69
|
+
_MULTICHAIN_AVAILABLE = False
|
|
70
|
+
|
|
71
|
+
# Event indexing & log filtering
|
|
72
|
+
try:
|
|
73
|
+
from .events import EventIndex, EventLog, LogFilter, BloomFilter
|
|
74
|
+
_EVENTS_AVAILABLE = True
|
|
75
|
+
except ImportError:
|
|
76
|
+
_EVENTS_AVAILABLE = False
|
|
77
|
+
|
|
78
|
+
# Merkle Patricia Trie
|
|
79
|
+
try:
|
|
80
|
+
from .mpt import MerklePatriciaTrie, StateTrie, TrieNode, NodeType
|
|
81
|
+
_MPT_AVAILABLE = True
|
|
82
|
+
except ImportError:
|
|
83
|
+
_MPT_AVAILABLE = False
|
|
84
|
+
|
|
85
|
+
# HD Wallet & Keystore
|
|
86
|
+
try:
|
|
87
|
+
from .wallet import (
|
|
88
|
+
HDWallet, Account, Keystore, ExtendedKey,
|
|
89
|
+
generate_mnemonic, validate_mnemonic, mnemonic_to_seed,
|
|
90
|
+
)
|
|
91
|
+
_WALLET_AVAILABLE = True
|
|
92
|
+
except ImportError:
|
|
93
|
+
_WALLET_AVAILABLE = False
|
|
94
|
+
|
|
95
|
+
# Token Standards (ZX-20, ZX-721, ZX-1155)
|
|
96
|
+
try:
|
|
97
|
+
from .tokens import (
|
|
98
|
+
ZX20Token, ZX20Interface,
|
|
99
|
+
ZX721Token, ZX721Interface,
|
|
100
|
+
ZX1155Token, ZX1155Interface,
|
|
101
|
+
TokenEvent, TransferEvent, ApprovalEvent,
|
|
102
|
+
TransferSingleEvent, TransferBatchEvent, ApprovalForAllEvent,
|
|
103
|
+
)
|
|
104
|
+
_TOKENS_AVAILABLE = True
|
|
105
|
+
except ImportError:
|
|
106
|
+
_TOKENS_AVAILABLE = False
|
|
107
|
+
|
|
108
|
+
# Upgradeable Contracts & Chain Governance
|
|
109
|
+
try:
|
|
110
|
+
from .upgradeable import (
|
|
111
|
+
ProxyContract,
|
|
112
|
+
ImplementationRecord,
|
|
113
|
+
UpgradeManager,
|
|
114
|
+
ChainUpgradeGovernance,
|
|
115
|
+
ChainUpgradeProposal,
|
|
116
|
+
ProposalStatus,
|
|
117
|
+
ProposalType,
|
|
118
|
+
UpgradeEvent,
|
|
119
|
+
UpgradeEventType,
|
|
120
|
+
)
|
|
121
|
+
_UPGRADEABLE_AVAILABLE = True
|
|
122
|
+
except ImportError:
|
|
123
|
+
_UPGRADEABLE_AVAILABLE = False
|
|
124
|
+
|
|
125
|
+
# Formal Verification Engine
|
|
126
|
+
try:
|
|
127
|
+
from .verification import (
|
|
128
|
+
FormalVerifier,
|
|
129
|
+
VerificationLevel,
|
|
130
|
+
VerificationReport,
|
|
131
|
+
VerificationFinding,
|
|
132
|
+
Severity,
|
|
133
|
+
FindingCategory,
|
|
134
|
+
StructuralVerifier,
|
|
135
|
+
InvariantVerifier,
|
|
136
|
+
PropertyVerifier,
|
|
137
|
+
TaintAnalyzer,
|
|
138
|
+
AnnotationParser,
|
|
139
|
+
Invariant,
|
|
140
|
+
ContractProperty,
|
|
141
|
+
)
|
|
142
|
+
_VERIFICATION_AVAILABLE = True
|
|
143
|
+
except ImportError:
|
|
144
|
+
_VERIFICATION_AVAILABLE = False
|
|
145
|
+
|
|
146
|
+
# Execution Accelerator
|
|
147
|
+
try:
|
|
148
|
+
from .accelerator import (
|
|
149
|
+
ExecutionAccelerator,
|
|
150
|
+
AOTCompiler,
|
|
151
|
+
InlineCache,
|
|
152
|
+
NumericFastPath,
|
|
153
|
+
WASMCache,
|
|
154
|
+
BatchExecutor,
|
|
155
|
+
TxBatchResult,
|
|
156
|
+
CompiledAction,
|
|
157
|
+
)
|
|
158
|
+
_ACCELERATOR_AVAILABLE = True
|
|
159
|
+
except ImportError:
|
|
160
|
+
_ACCELERATOR_AVAILABLE = False
|
|
161
|
+
|
|
162
|
+
# Production monitoring
|
|
163
|
+
try:
|
|
164
|
+
from .monitoring import NodeMetrics, MetricsServer
|
|
165
|
+
_MONITORING_AVAILABLE = True
|
|
166
|
+
except ImportError:
|
|
167
|
+
_MONITORING_AVAILABLE = False
|
|
168
|
+
|
|
169
|
+
# Rust native execution core
|
|
170
|
+
try:
|
|
171
|
+
from .rust_bridge import RustCoreBridge, rust_core_available
|
|
172
|
+
_RUST_CORE_AVAILABLE = rust_core_available()
|
|
173
|
+
except ImportError:
|
|
174
|
+
_RUST_CORE_AVAILABLE = False
|
|
175
|
+
|
|
176
|
+
# Multiprocess executor (GIL-free parallelism)
|
|
177
|
+
try:
|
|
178
|
+
from .multiprocess_executor import MultiProcessBatchExecutor, MPBatchResult
|
|
179
|
+
_MULTIPROCESS_AVAILABLE = True
|
|
180
|
+
except ImportError:
|
|
181
|
+
_MULTIPROCESS_AVAILABLE = False
|
|
182
|
+
|
|
183
|
+
# Load testing framework
|
|
184
|
+
try:
|
|
185
|
+
from .loadtest import LoadTestRunner, LoadProfile, LoadTestReport, quick_benchmark
|
|
186
|
+
_LOADTEST_AVAILABLE = True
|
|
187
|
+
except ImportError:
|
|
188
|
+
_LOADTEST_AVAILABLE = False
|
|
189
|
+
|
|
22
190
|
__all__ = [
|
|
23
191
|
# Ledger
|
|
24
192
|
'Ledger',
|
|
@@ -37,4 +205,247 @@ __all__ = [
|
|
|
37
205
|
# Crypto
|
|
38
206
|
'CryptoPlugin',
|
|
39
207
|
'register_crypto_builtins',
|
|
208
|
+
|
|
209
|
+
# Chain & Blocks
|
|
210
|
+
'Block',
|
|
211
|
+
'BlockHeader',
|
|
212
|
+
'ChainTransaction',
|
|
213
|
+
'TransactionReceipt',
|
|
214
|
+
'Chain',
|
|
215
|
+
'Mempool',
|
|
216
|
+
|
|
217
|
+
# Storage Backends
|
|
218
|
+
'StorageBackend',
|
|
219
|
+
'SQLiteBackend',
|
|
220
|
+
'LevelDBBackend',
|
|
221
|
+
'RocksDBBackend',
|
|
222
|
+
'MemoryBackend',
|
|
223
|
+
'get_storage_backend',
|
|
224
|
+
'register_backend',
|
|
225
|
+
|
|
226
|
+
# P2P Network
|
|
227
|
+
'P2PNetwork',
|
|
228
|
+
'Message',
|
|
229
|
+
'MessageType',
|
|
230
|
+
'PeerInfo',
|
|
231
|
+
|
|
232
|
+
# Consensus
|
|
233
|
+
'ConsensusEngine',
|
|
234
|
+
'ProofOfWork',
|
|
235
|
+
'ProofOfAuthority',
|
|
236
|
+
'ProofOfStake',
|
|
237
|
+
'BFTConsensus',
|
|
238
|
+
'BFTMessage',
|
|
239
|
+
'BFTPhase',
|
|
240
|
+
'BFTRoundState',
|
|
241
|
+
'create_consensus',
|
|
242
|
+
|
|
243
|
+
# Node
|
|
244
|
+
'BlockchainNode',
|
|
245
|
+
'NodeConfig',
|
|
246
|
+
|
|
247
|
+
# RPC Server
|
|
248
|
+
'RPCServer',
|
|
249
|
+
'RPCError',
|
|
250
|
+
'RPCErrorCode',
|
|
251
|
+
'RPCMethodRegistry',
|
|
252
|
+
|
|
253
|
+
# Contract VM
|
|
254
|
+
'ContractVM',
|
|
255
|
+
'ContractExecutionReceipt',
|
|
256
|
+
'ContractStateAdapter',
|
|
257
|
+
|
|
258
|
+
# Multichain / Bridge
|
|
259
|
+
'ChainRouter',
|
|
260
|
+
'BridgeRelay',
|
|
261
|
+
'BridgeContract',
|
|
262
|
+
'CrossChainMessage',
|
|
263
|
+
'MerkleProofEngine',
|
|
264
|
+
'MessageStatus',
|
|
265
|
+
|
|
266
|
+
# Event Indexing
|
|
267
|
+
'EventIndex',
|
|
268
|
+
'EventLog',
|
|
269
|
+
'LogFilter',
|
|
270
|
+
'BloomFilter',
|
|
271
|
+
|
|
272
|
+
# Merkle Patricia Trie
|
|
273
|
+
'MerklePatriciaTrie',
|
|
274
|
+
'StateTrie',
|
|
275
|
+
'TrieNode',
|
|
276
|
+
'NodeType',
|
|
277
|
+
|
|
278
|
+
# HD Wallet & Keystore
|
|
279
|
+
'HDWallet',
|
|
280
|
+
'Account',
|
|
281
|
+
'Keystore',
|
|
282
|
+
'ExtendedKey',
|
|
283
|
+
'generate_mnemonic',
|
|
284
|
+
'validate_mnemonic',
|
|
285
|
+
'mnemonic_to_seed',
|
|
286
|
+
|
|
287
|
+
# Token Standards
|
|
288
|
+
'ZX20Token',
|
|
289
|
+
'ZX20Interface',
|
|
290
|
+
'ZX721Token',
|
|
291
|
+
'ZX721Interface',
|
|
292
|
+
'ZX1155Token',
|
|
293
|
+
'ZX1155Interface',
|
|
294
|
+
'TokenEvent',
|
|
295
|
+
'TransferEvent',
|
|
296
|
+
'ApprovalEvent',
|
|
297
|
+
'TransferSingleEvent',
|
|
298
|
+
'TransferBatchEvent',
|
|
299
|
+
'ApprovalForAllEvent',
|
|
300
|
+
|
|
301
|
+
# Upgradeable Contracts & Chain Governance
|
|
302
|
+
'ProxyContract',
|
|
303
|
+
'ImplementationRecord',
|
|
304
|
+
'UpgradeManager',
|
|
305
|
+
'ChainUpgradeGovernance',
|
|
306
|
+
'ChainUpgradeProposal',
|
|
307
|
+
'ProposalStatus',
|
|
308
|
+
'ProposalType',
|
|
309
|
+
'UpgradeEvent',
|
|
310
|
+
'UpgradeEventType',
|
|
311
|
+
|
|
312
|
+
# Formal Verification
|
|
313
|
+
'FormalVerifier',
|
|
314
|
+
'VerificationLevel',
|
|
315
|
+
'VerificationReport',
|
|
316
|
+
'VerificationFinding',
|
|
317
|
+
'Severity',
|
|
318
|
+
'FindingCategory',
|
|
319
|
+
'StructuralVerifier',
|
|
320
|
+
'InvariantVerifier',
|
|
321
|
+
'PropertyVerifier',
|
|
322
|
+
'TaintAnalyzer',
|
|
323
|
+
'AnnotationParser',
|
|
324
|
+
'Invariant',
|
|
325
|
+
'ContractProperty',
|
|
326
|
+
|
|
327
|
+
# Execution Accelerator
|
|
328
|
+
'ExecutionAccelerator',
|
|
329
|
+
'AOTCompiler',
|
|
330
|
+
'InlineCache',
|
|
331
|
+
'NumericFastPath',
|
|
332
|
+
'WASMCache',
|
|
333
|
+
'BatchExecutor',
|
|
334
|
+
'TxBatchResult',
|
|
335
|
+
'CompiledAction',
|
|
336
|
+
|
|
337
|
+
# Production Monitoring
|
|
338
|
+
'NodeMetrics',
|
|
339
|
+
'MetricsServer',
|
|
340
|
+
|
|
341
|
+
# Rust Native Execution Core
|
|
342
|
+
'RustCoreBridge',
|
|
343
|
+
'rust_core_available',
|
|
344
|
+
|
|
345
|
+
# Multiprocess Executor
|
|
346
|
+
'MultiProcessBatchExecutor',
|
|
347
|
+
'MPBatchResult',
|
|
348
|
+
|
|
349
|
+
# Load Testing
|
|
350
|
+
'LoadTestRunner',
|
|
351
|
+
'LoadProfile',
|
|
352
|
+
'LoadTestReport',
|
|
353
|
+
'quick_benchmark',
|
|
354
|
+
|
|
355
|
+
# Dependency audit
|
|
356
|
+
'check_dependencies',
|
|
40
357
|
]
|
|
358
|
+
|
|
359
|
+
|
|
360
|
+
# ── Dependency audit helper ──────────────────────────────────────────
|
|
361
|
+
|
|
362
|
+
import warnings as _warnings
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
def check_dependencies(verbose: bool = True) -> dict:
|
|
366
|
+
"""Check optional blockchain dependencies and emit warnings.
|
|
367
|
+
|
|
368
|
+
Returns a dict mapping component names to their availability status.
|
|
369
|
+
When *verbose* is ``True`` (the default), a user-friendly summary is
|
|
370
|
+
printed and ``warnings.warn()`` is called for any missing component.
|
|
371
|
+
|
|
372
|
+
Usage::
|
|
373
|
+
|
|
374
|
+
from zexus.blockchain import check_dependencies
|
|
375
|
+
deps = check_dependencies()
|
|
376
|
+
"""
|
|
377
|
+
status: dict = {}
|
|
378
|
+
|
|
379
|
+
# Rust native core
|
|
380
|
+
status["rust_core"] = _RUST_CORE_AVAILABLE
|
|
381
|
+
if not _RUST_CORE_AVAILABLE and verbose:
|
|
382
|
+
_warnings.warn(
|
|
383
|
+
"Rust execution core not compiled — throughput capped at "
|
|
384
|
+
"~500 TPS (Python GIL bound). Build it for 1800+ TPS:\n"
|
|
385
|
+
" cd rust_core/ && pip install maturin && maturin develop --release",
|
|
386
|
+
stacklevel=2,
|
|
387
|
+
)
|
|
388
|
+
|
|
389
|
+
# LevelDB
|
|
390
|
+
try:
|
|
391
|
+
import plyvel # noqa: F401
|
|
392
|
+
status["leveldb"] = True
|
|
393
|
+
except ImportError:
|
|
394
|
+
status["leveldb"] = False
|
|
395
|
+
if verbose:
|
|
396
|
+
_warnings.warn(
|
|
397
|
+
"plyvel not installed — LevelDBBackend unavailable. "
|
|
398
|
+
"Install: pip install plyvel (requires libleveldb-dev)",
|
|
399
|
+
stacklevel=2,
|
|
400
|
+
)
|
|
401
|
+
|
|
402
|
+
# RocksDB
|
|
403
|
+
try:
|
|
404
|
+
import rocksdb # noqa: F401 # type: ignore[import-untyped]
|
|
405
|
+
status["rocksdb"] = True
|
|
406
|
+
except ImportError:
|
|
407
|
+
status["rocksdb"] = False
|
|
408
|
+
if verbose:
|
|
409
|
+
_warnings.warn(
|
|
410
|
+
"python-rocksdb not installed — RocksDBBackend unavailable. "
|
|
411
|
+
"Install: pip install python-rocksdb (requires librocksdb-dev)",
|
|
412
|
+
stacklevel=2,
|
|
413
|
+
)
|
|
414
|
+
|
|
415
|
+
# aiohttp (for RPC server)
|
|
416
|
+
try:
|
|
417
|
+
import aiohttp # noqa: F401
|
|
418
|
+
status["aiohttp"] = True
|
|
419
|
+
except ImportError:
|
|
420
|
+
status["aiohttp"] = False
|
|
421
|
+
if verbose:
|
|
422
|
+
_warnings.warn(
|
|
423
|
+
"aiohttp not installed — RPCServer unavailable. "
|
|
424
|
+
"Install: pip install aiohttp",
|
|
425
|
+
stacklevel=2,
|
|
426
|
+
)
|
|
427
|
+
|
|
428
|
+
# Prometheus client (for monitoring)
|
|
429
|
+
try:
|
|
430
|
+
import prometheus_client # noqa: F401
|
|
431
|
+
status["prometheus"] = True
|
|
432
|
+
except ImportError:
|
|
433
|
+
status["prometheus"] = False
|
|
434
|
+
if verbose:
|
|
435
|
+
_warnings.warn(
|
|
436
|
+
"prometheus_client not installed — Prometheus metrics export "
|
|
437
|
+
"unavailable. Install: pip install prometheus-client",
|
|
438
|
+
stacklevel=2,
|
|
439
|
+
)
|
|
440
|
+
|
|
441
|
+
if verbose:
|
|
442
|
+
installed = [k for k, v in status.items() if v]
|
|
443
|
+
missing = [k for k, v in status.items() if not v]
|
|
444
|
+
print(f"Zexus Blockchain dependencies: "
|
|
445
|
+
f"{len(installed)} available, {len(missing)} missing")
|
|
446
|
+
if missing:
|
|
447
|
+
print(f" Missing: {', '.join(missing)}")
|
|
448
|
+
if installed:
|
|
449
|
+
print(f" Available: {', '.join(installed)}")
|
|
450
|
+
|
|
451
|
+
return status
|