stitch-substrate 0.4.1__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.
- stitch/__init__.py +137 -0
- stitch/agreement.py +989 -0
- stitch/core.py +380 -0
- stitch/crypto/__init__.py +43 -0
- stitch/crypto/ed25519.py +460 -0
- stitch/exceptions.py +31 -0
- stitch/stitches.py +492 -0
- stitch_substrate-0.4.1.dist-info/METADATA +25 -0
- stitch_substrate-0.4.1.dist-info/RECORD +11 -0
- stitch_substrate-0.4.1.dist-info/WHEEL +5 -0
- stitch_substrate-0.4.1.dist-info/top_level.txt +1 -0
stitch/__init__.py
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"""
|
|
2
|
+
stitch — A tiny, language-portable substrate primitive for accountable agent state.
|
|
3
|
+
|
|
4
|
+
The smallest binding operation in a quilt. 11 stitches, conservation law, append-only
|
|
5
|
+
hash-chained ledger, surprise oracle. Zero dependencies.
|
|
6
|
+
|
|
7
|
+
See SPEC.md for the canonical specification.
|
|
8
|
+
See ARCHITECTURE.md for where this fits in the larger Thor synthesis.
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
from .core import (
|
|
12
|
+
Tenant,
|
|
13
|
+
Cell,
|
|
14
|
+
Ledger,
|
|
15
|
+
Surprise,
|
|
16
|
+
KLSurprise,
|
|
17
|
+
LOG2_3,
|
|
18
|
+
FNV_OFFSET,
|
|
19
|
+
FNV_PRIME,
|
|
20
|
+
MASK_64,
|
|
21
|
+
ConservationError,
|
|
22
|
+
LedgerError,
|
|
23
|
+
)
|
|
24
|
+
from .exceptions import (
|
|
25
|
+
StitchError,
|
|
26
|
+
BindError,
|
|
27
|
+
EffectRejected,
|
|
28
|
+
UnknownCell,
|
|
29
|
+
)
|
|
30
|
+
from .stitches import (
|
|
31
|
+
bind,
|
|
32
|
+
link,
|
|
33
|
+
effect,
|
|
34
|
+
view,
|
|
35
|
+
tick,
|
|
36
|
+
attest,
|
|
37
|
+
delegate,
|
|
38
|
+
contest,
|
|
39
|
+
merger,
|
|
40
|
+
revoke,
|
|
41
|
+
withdraw,
|
|
42
|
+
declare_budget,
|
|
43
|
+
TENANT_KIND,
|
|
44
|
+
)
|
|
45
|
+
from .agreement import (
|
|
46
|
+
EXCHANGE_KIND,
|
|
47
|
+
AGREED,
|
|
48
|
+
NO_SEND,
|
|
49
|
+
MISSING_MIRROR,
|
|
50
|
+
PAYLOAD_MISMATCH,
|
|
51
|
+
PEER_MISMATCH,
|
|
52
|
+
CHAIN_BROKEN,
|
|
53
|
+
LAW_VIOLATED,
|
|
54
|
+
BAD_SIGNATURE,
|
|
55
|
+
UNSIGNED_BOOKING,
|
|
56
|
+
booking_signing_material,
|
|
57
|
+
AuditVerdict,
|
|
58
|
+
Agreement,
|
|
59
|
+
AgreementN,
|
|
60
|
+
AnchorVerdict,
|
|
61
|
+
payload_hash,
|
|
62
|
+
book_send,
|
|
63
|
+
book_receive,
|
|
64
|
+
audit_ledger,
|
|
65
|
+
agree,
|
|
66
|
+
agreed_state,
|
|
67
|
+
verify_anchor,
|
|
68
|
+
agree_n,
|
|
69
|
+
agreed_state_n,
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
__version__ = "0.4.1"
|
|
73
|
+
__author__ = "SuperInstance"
|
|
74
|
+
__license__ = "MIT"
|
|
75
|
+
|
|
76
|
+
__all__ = [
|
|
77
|
+
# Constants
|
|
78
|
+
"LOG2_3",
|
|
79
|
+
"FNV_OFFSET",
|
|
80
|
+
"FNV_PRIME",
|
|
81
|
+
"MASK_64",
|
|
82
|
+
# Core
|
|
83
|
+
"Tenant",
|
|
84
|
+
"Cell",
|
|
85
|
+
"Ledger",
|
|
86
|
+
"Surprise",
|
|
87
|
+
"KLSurprise",
|
|
88
|
+
"ConservationError",
|
|
89
|
+
"LedgerError",
|
|
90
|
+
# Exceptions
|
|
91
|
+
"StitchError",
|
|
92
|
+
"BindError",
|
|
93
|
+
"EffectRejected",
|
|
94
|
+
"UnknownCell",
|
|
95
|
+
# Stitches
|
|
96
|
+
"bind",
|
|
97
|
+
"link",
|
|
98
|
+
"effect",
|
|
99
|
+
"view",
|
|
100
|
+
"tick",
|
|
101
|
+
"attest",
|
|
102
|
+
"delegate",
|
|
103
|
+
"contest",
|
|
104
|
+
"merger",
|
|
105
|
+
"revoke",
|
|
106
|
+
"withdraw",
|
|
107
|
+
# Tenant declaration helpers (v0.3 — not new stitches; helpers that use BIND)
|
|
108
|
+
"declare_budget",
|
|
109
|
+
"TENANT_KIND",
|
|
110
|
+
# Agreement (v0.2)
|
|
111
|
+
"EXCHANGE_KIND",
|
|
112
|
+
"AGREED",
|
|
113
|
+
"NO_SEND",
|
|
114
|
+
"MISSING_MIRROR",
|
|
115
|
+
"PAYLOAD_MISMATCH",
|
|
116
|
+
"PEER_MISMATCH",
|
|
117
|
+
"CHAIN_BROKEN",
|
|
118
|
+
"LAW_VIOLATED",
|
|
119
|
+
# TRACK-C PROTOTYPE (signed bookings)
|
|
120
|
+
"BAD_SIGNATURE",
|
|
121
|
+
"UNSIGNED_BOOKING",
|
|
122
|
+
"booking_signing_material",
|
|
123
|
+
"AuditVerdict",
|
|
124
|
+
"Agreement",
|
|
125
|
+
"AgreementN",
|
|
126
|
+
"AnchorVerdict",
|
|
127
|
+
"payload_hash",
|
|
128
|
+
"book_send",
|
|
129
|
+
"book_receive",
|
|
130
|
+
"audit_ledger",
|
|
131
|
+
"agree",
|
|
132
|
+
"agreed_state",
|
|
133
|
+
"verify_anchor",
|
|
134
|
+
# N-party agreement (v0.3 — closes the "bilateral only" gap)
|
|
135
|
+
"agree_n",
|
|
136
|
+
"agreed_state_n",
|
|
137
|
+
]
|