@xmbl/state-machine 0.1.16 → 0.1.17
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 +30 -0
- package/package.json +2 -1
package/README.md
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# @xmbl/state-machine
|
|
2
|
+
|
|
3
|
+
XMBL's state layer: a **Verkle tree** whose root moves as the chain applies transactions. A moving
|
|
4
|
+
state root is health, not drift.
|
|
5
|
+
|
|
6
|
+
```sh
|
|
7
|
+
npm install @xmbl/state-machine
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
## What it owns
|
|
11
|
+
|
|
12
|
+
| Export | What it is |
|
|
13
|
+
|---|---|
|
|
14
|
+
| `VerkleStateTree` | The tree. Proofs verify **independently** — `verkle-independent-verify.test.mjs` checks a proof against the root alone, with no access to the prover's tree. |
|
|
15
|
+
| `StateDiff` | An app-centric diff: what a transaction changes, as a value. |
|
|
16
|
+
| `StateShard` | Sharded state. |
|
|
17
|
+
| `StateAssembler` | Assembles diffs into current state. |
|
|
18
|
+
| `StateMachine` | The machine that applies diffs and **emits `state:committed`** when a cube commits a state root — the one moment the chain commits state must be observable outside this file. |
|
|
19
|
+
|
|
20
|
+
## Rehydration
|
|
21
|
+
|
|
22
|
+
State survives a restart: `rehydration.test.mjs` and `applied-count.test.mjs` hold the count of
|
|
23
|
+
applied diffs across a reopen, because a state machine that silently reapplies or silently skips is
|
|
24
|
+
indistinguishable from a working one until the root diverges.
|
|
25
|
+
|
|
26
|
+
## Tests
|
|
27
|
+
|
|
28
|
+
```sh
|
|
29
|
+
node ../../scripts/run-node-tests.mjs .
|
|
30
|
+
```
|
package/package.json
CHANGED