@xmbl/simulator 0.1.0

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/status.md ADDED
@@ -0,0 +1,167 @@
1
+ # XSIM Status
2
+
3
+ ## Current Status: Working - Core Functionality Demonstrated
4
+
5
+ ### Latest Run Results (45 seconds):
6
+ - **Identities Created**: 10
7
+ - **Transactions Created**: 223
8
+ - **Transactions Validated**: 265
9
+ - **Blocks Added**: 265
10
+ - **Faces Completed**: 20 ✅
11
+ - **Cubes Completed**: 0 (need 3 faces per cube with different indices)
12
+ - **SuperCubes Completed**: 0 (need 27 cubes per supercube)
13
+ - **State Diffs Created**: 44
14
+ - **Storage Operations**: 22
15
+ - **Compute Operations**: 22
16
+
17
+ ### Completed
18
+ - ✅ Project setup with dependencies (faker, chance)
19
+ - ✅ Structured logging system implemented
20
+ - ✅ Comprehensive simulator with module integration framework
21
+ - ✅ **All modules connected**: xid, xn, xclt, xvsm, xpc, xsc
22
+ - ✅ **Real identity creation** using xid module (10 identities on startup)
23
+ - ✅ **Consensus workflow** fully operational:
24
+ - Transactions submitted to leaders
25
+ - Validation tasks created
26
+ - Validations auto-completed (3 validators)
27
+ - Transactions moved to processing
28
+ - Transactions finalized
29
+ - ✅ **Ledger integration** working:
30
+ - Blocks being added to ledger (22+ blocks in test run)
31
+ - Block events logged with coordinates
32
+ - ✅ **State machine** processing state diffs
33
+ - ✅ **Storage and compute** operations simulated
34
+ - ✅ **Network** integration (nodes added on identity creation)
35
+
36
+ ### Working System Flow
37
+ 1. **Identity Creation** → Real xid identities created, added to network
38
+ 2. **Transaction Generation** → 2 tx/sec, various types (utxo, token_creation, contract, state_diff)
39
+ 3. **Consensus** → Transactions submitted → Validations → Processing → Finalization
40
+ 4. **Ledger** → Finalized transactions → Blocks added → (faces/cubes pending more blocks)
41
+ 5. **State Machine** → State diffs created and processed
42
+ 6. **Storage/Compute** → Operations simulated at 0.5/sec each
43
+
44
+ ### In Progress
45
+ - 🔄 Testing and validation of full system integration
46
+ - 🔄 Monitoring all activities through logs
47
+ - 🔄 Ensuring all core functionality is demonstrated
48
+
49
+ ### Pending
50
+ - ⏳ Failure injection (network failures, node crashes)
51
+ - ⏳ Browser monitoring capabilities
52
+ - ⏳ Metrics export/visualization (JSON, CSV, Prometheus)
53
+ - ⏳ Performance benchmarking
54
+ - ⏳ Stress testing modes
55
+ - ⏳ Configuration file support
56
+
57
+ ## Architecture
58
+
59
+ The simulator integrates with all XMBL modules:
60
+ - **xid**: Identity creation and signature verification
61
+ - **xn**: Network topology and node management
62
+ - **xclt**: Cubic ledger construction (blocks → faces → cubes → supercubes)
63
+ - **xvsm**: State machine with state diffs and state assembly
64
+ - **xpc**: Consensus workflow with transaction validation
65
+ - **xsc**: Storage and compute operations
66
+
67
+ ## Logging
68
+
69
+ All activities are logged with structured format:
70
+ - Timestamp
71
+ - Level (info, error)
72
+ - Category (identity, transaction, consensus, ledger, stateMachine, storage, compute, network, system)
73
+ - Event name
74
+ - Event data
75
+
76
+ Logs are designed to be consumed by other tools and are explicit about what's happening in the system.
77
+
78
+ ## Metrics Tracked
79
+
80
+ - Identities created
81
+ - Transactions created and validated
82
+ - Blocks added to ledger
83
+ - Faces completed
84
+ - Cubes completed
85
+ - Supercubes completed
86
+ - State diffs created
87
+ - State assemblies
88
+ - Storage operations
89
+ - Compute operations
90
+ - System uptime
91
+
92
+ ## Implementation Details
93
+
94
+ ### Core Functionality Demonstrated
95
+
96
+ 1. **Identity Creation (xid)**
97
+ - Creates 10 initial identities on startup
98
+ - Uses real xid module if available, falls back to simulation
99
+ - Logs all identity creation events
100
+
101
+ 2. **Consensus (xpc)**
102
+ - Submits transactions to consensus workflow
103
+ - Tracks validation tasks and completion
104
+ - Monitors transaction finalization
105
+ - Establishes leaders from initial identities
106
+
107
+ 3. **Cubic Ledger (xclt)**
108
+ - Adds transactions to ledger
109
+ - Tracks block creation
110
+ - Monitors face completion (6 blocks)
111
+ - Monitors cube completion (6 faces)
112
+ - Monitors supercube completion (recursive structure)
113
+
114
+ 4. **State Machine (xvsm)**
115
+ - Creates state diff transactions
116
+ - Processes state diffs from ledger blocks
117
+ - Assembles state from diffs periodically
118
+ - Tracks state root and statistics
119
+
120
+ 5. **Storage and Compute (xsc)**
121
+ - Simulates storage operations (store, retrieve, delete)
122
+ - Simulates compute operations with function execution
123
+ - Tracks operation metrics
124
+
125
+ 6. **Network (xn)**
126
+ - Integrates with network module for node management
127
+ - Tracks network topology (when available)
128
+
129
+ ### Logging Structure
130
+
131
+ All logs follow this format:
132
+ ```json
133
+ {
134
+ "timestamp": "ISO8601 timestamp",
135
+ "level": "info|error",
136
+ "category": "identity|transaction|consensus|ledger|stateMachine|storage|compute|network|system",
137
+ "event": "event_name",
138
+ "data": { /* event-specific data */ }
139
+ }
140
+ ```
141
+
142
+ ### Running the Simulator
143
+
144
+ ```bash
145
+ node index.js
146
+ # or
147
+ node index.js --run
148
+ ```
149
+
150
+ The simulator will:
151
+ 1. Initialize and connect to available modules
152
+ 2. Create 10 initial identities
153
+ 3. Start generating transactions at 2/sec
154
+ 4. Start generating state diffs at 1/sec
155
+ 5. Start storage operations at 0.5/sec
156
+ 6. Start compute operations at 0.5/sec
157
+ 7. Log all activities with structured format
158
+ 8. Emit metrics every 5 seconds
159
+
160
+ ## Next Steps
161
+
162
+ 1. ✅ Run simulator and verify all activities are logged
163
+ 2. ✅ Monitor logs to ensure all core functionality is demonstrated
164
+ 3. ⏳ Add failure injection capabilities
165
+ 4. ⏳ Add web dashboard for monitoring
166
+ 5. ⏳ Add metrics export functionality
167
+