@wowok/skills 1.2.4 → 1.2.6
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 +34 -16
- package/dist/cli.js +6 -2
- package/dist/cli.js.map +1 -1
- package/dist/skills.d.ts +32 -1
- package/dist/skills.d.ts.map +1 -1
- package/dist/skills.js +63 -0
- package/dist/skills.js.map +1 -1
- package/dist/types.d.ts +8 -0
- package/dist/types.d.ts.map +1 -1
- package/examples/Insurance/Insurance.md +543 -475
- package/examples/MyShop/MyShop.md +865 -746
- package/examples/MyShop_Advanced/MyShop_Advanced.md +1520 -1376
- package/examples/ThreeBody_Signature/ThreeBody_Signature.md +891 -651
- package/examples/Travel/Travel.md +952 -848
- package/package.json +2 -2
- package/scripts/install.js +3 -17
- package/wowok-arbitrator/SKILL.md +18 -57
- package/wowok-auditor/SKILL.md +16 -12
- package/wowok-distill/SKILL.md +237 -0
- package/wowok-guard/SKILL.md +40 -354
- package/wowok-machine/SKILL.md +21 -127
- package/wowok-messenger/SKILL.md +14 -59
- package/wowok-onboard/SKILL.md +42 -12
- package/wowok-order/SKILL.md +20 -169
- package/wowok-output/SKILL.md +0 -10
- package/wowok-planner/SKILL.md +29 -9
- package/wowok-provider/SKILL.md +72 -32
- package/wowok-safety/SKILL.md +8 -80
- package/wowok-scenario/SKILL.md +70 -102
- package/wowok-tools/SKILL.md +68 -107
- package/references/glossary.ts +0 -297
- package/references/guard-scenario-ledger.md +0 -353
- package/references/guard-template-library.md +0 -481
- package/references/machine-design-reference.md +0 -398
- package/references/machine-scenario-ledger.md +0 -227
- package/references/machine-template-library.md +0 -522
- package/references/merchant-scenario-coordination.md +0 -383
- package/references/object-collaboration.md +0 -362
- package/references/onchain-constants.md +0 -81
- package/wowok-arbitrator/APPENDIX.md +0 -545
- package/wowok-auditor/APPENDIX.md +0 -487
- package/wowok-guard/APPENDIX.md +0 -430
- package/wowok-machine/APPENDIX.md +0 -407
- package/wowok-messenger/APPENDIX.md +0 -550
- package/wowok-onboard/APPENDIX.md +0 -502
- package/wowok-order/APPENDIX.md +0 -777
- package/wowok-output/APPENDIX.md +0 -575
- package/wowok-planner/APPENDIX.md +0 -726
- package/wowok-provider/APPENDIX.md +0 -455
- package/wowok-safety/APPENDIX.md +0 -565
- package/wowok-scenario/APPENDIX.md +0 -97
- package/wowok-scenario/MODE-DETAILS.md +0 -275
- package/wowok-tools/APPENDIX.md +0 -394
|
@@ -1,481 +0,0 @@
|
|
|
1
|
-
# Guard Template Library Reference
|
|
2
|
-
|
|
3
|
-
> Contains 13 scenario templates covering 9 binding scenarios + 1 test scenario.
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## Template Unified Structure
|
|
8
|
-
|
|
9
|
-
```typescript
|
|
10
|
-
interface GuardTemplate {
|
|
11
|
-
id: string; // e.g. "tpl_buy_guard_whitelist"
|
|
12
|
-
name: string;
|
|
13
|
-
description: string;
|
|
14
|
-
scene_id: string; // binding scenario ID
|
|
15
|
-
applicable_industries: string[]; // industry tags
|
|
16
|
-
patterns: string[]; // associated Patterns (P02-P17)
|
|
17
|
-
risk_rules: string[]; // associated risk rule IDs
|
|
18
|
-
params: GuardTemplateParam[]; // parameter definitions
|
|
19
|
-
skeleton: GuardSkeleton; // JSON skeleton with ${param} placeholders
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
interface GuardTemplateParam {
|
|
23
|
-
name: string;
|
|
24
|
-
type: "Address" | "String" | "U64" | "Bool" | "String[]";
|
|
25
|
-
required: boolean;
|
|
26
|
-
description: string;
|
|
27
|
-
default?: string;
|
|
28
|
-
validation?: string;
|
|
29
|
-
}
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
---
|
|
33
|
-
|
|
34
|
-
## The 13 Templates
|
|
35
|
-
|
|
36
|
-
### 1. `tpl_buy_guard_whitelist` — Whitelist Purchase Validation
|
|
37
|
-
|
|
38
|
-
| Field | Value |
|
|
39
|
-
|-------|-------|
|
|
40
|
-
| **Scene** | `service_buy_guard` |
|
|
41
|
-
| **Patterns** | P03 (single address), P04 (whitelist), P16 (circular reference) |
|
|
42
|
-
| **Industries** | rental, ecommerce, education, travel, subscription |
|
|
43
|
-
| **Verifier Level** | level2_identity_set |
|
|
44
|
-
|
|
45
|
-
**Parameters:**
|
|
46
|
-
|
|
47
|
-
| Parameter | Type | Required | Description |
|
|
48
|
-
|-----------|------|----------|-------------|
|
|
49
|
-
| `authorized_address` | Address | Yes | Authorized address (P03) or first whitelist address |
|
|
50
|
-
| `service_address` | Address | Yes (name for circular ref) | Service object address or name |
|
|
51
|
-
| `whitelist` | Address[] | No | P04 whitelist variant, overrides authorized_address |
|
|
52
|
-
|
|
53
|
-
**Risk Rules:** R-C4-01, R-X1-08
|
|
54
|
-
|
|
55
|
-
---
|
|
56
|
-
|
|
57
|
-
### 2. `tpl_allocator_threshold` — Allocation Amount Threshold Validation
|
|
58
|
-
|
|
59
|
-
| Field | Value |
|
|
60
|
-
|-------|-------|
|
|
61
|
-
| **Scene** | `service_order_allocators_guard` |
|
|
62
|
-
| **Patterns** | P02, P10 |
|
|
63
|
-
| **Industries** | ecommerce, rental, education, travel |
|
|
64
|
-
| **Verifier Level** | level3_scene_combined |
|
|
65
|
-
|
|
66
|
-
**Parameters:**
|
|
67
|
-
|
|
68
|
-
| Parameter | Type | Required | Description |
|
|
69
|
-
|-----------|------|----------|-------------|
|
|
70
|
-
| `order_id` | Address | Yes (submission) | Order address submitted by user |
|
|
71
|
-
| `node_names` | String[] | Yes | Expected current node name(s) |
|
|
72
|
-
| `service_address` | Address | No | Service address (project binding, strongly recommended) |
|
|
73
|
-
|
|
74
|
-
**Risk Rules:** R-C3-01, R-X1-05, R-X1-03, R-C3-05 (CRITICAL)
|
|
75
|
-
|
|
76
|
-
---
|
|
77
|
-
|
|
78
|
-
### 3. `tpl_allocator_treasury_personal` — Treasury + Personal Address Allocation
|
|
79
|
-
|
|
80
|
-
| Field | Value |
|
|
81
|
-
|-------|-------|
|
|
82
|
-
| **Scene** | `service_order_allocators_guard` |
|
|
83
|
-
| **Patterns** | P02, P10, P16 |
|
|
84
|
-
| **Industries** | insurance, ecommerce, travel, rental, subscription |
|
|
85
|
-
| **Verifier Level** | level3_scene_combined |
|
|
86
|
-
|
|
87
|
-
**Parameters:**
|
|
88
|
-
|
|
89
|
-
| Parameter | Type | Required | Description |
|
|
90
|
-
|-----------|------|----------|-------------|
|
|
91
|
-
| `node_names` | String[] | Yes | Expected current node name(s) |
|
|
92
|
-
| `service_address` | Address | Yes | Service address (project binding) |
|
|
93
|
-
| `treasury_address` | Address | Yes | Treasury address for fund allocation |
|
|
94
|
-
| `personal_address` | Address | Yes | Personal address for fund allocation |
|
|
95
|
-
|
|
96
|
-
**Risk Rules:** R-C3-05, R-C3-06 (CRITICAL), R-X1-05, R-X1-01
|
|
97
|
-
|
|
98
|
-
---
|
|
99
|
-
|
|
100
|
-
### 4. `tpl_allocator_identity_set_order_holder` — Order-Holder Identity-Set Allocation (Level 2)
|
|
101
|
-
|
|
102
|
-
| Field | Value |
|
|
103
|
-
|-------|-------|
|
|
104
|
-
| **Scene** | `service_order_allocators_guard` |
|
|
105
|
-
| **Patterns** | P02, P10, P16 |
|
|
106
|
-
| **Industries** | ecommerce, rental, travel, subscription |
|
|
107
|
-
| **Verifier Level** | level2_identity_set |
|
|
108
|
-
|
|
109
|
-
**Parameters:**
|
|
110
|
-
|
|
111
|
-
| Parameter | Type | Required | Description |
|
|
112
|
-
|-----------|------|----------|-------------|
|
|
113
|
-
| `service_name` | string | Yes | Service object name (P16 circular reference, resolved to address after publish) |
|
|
114
|
-
|
|
115
|
-
**Key Feature:** Level 2 identity-set binding — Signer is `order.owner` (1562, Address) OR `order.agent` (1567, Bool with [Signer] param). Uses `logic_or` to wrap Signer checks. Suppresses R-C4-04 (Level 1 strict binding convenience warning).
|
|
116
|
-
|
|
117
|
-
**Risk Rules:** R-C3-01, R-C3-05, R-C3-06, R-C4-04
|
|
118
|
-
|
|
119
|
-
---
|
|
120
|
-
|
|
121
|
-
### 5. `tpl_allocator_identity_set_service_provider_dynamic` — Service-Provider Identity-Set Allocation with Dynamic Permission (Level 2)
|
|
122
|
-
|
|
123
|
-
| Field | Value |
|
|
124
|
-
|-------|-------|
|
|
125
|
-
| **Scene** | `service_order_allocators_guard` |
|
|
126
|
-
| **Patterns** | P02, P10, P16 |
|
|
127
|
-
| **Industries** | ecommerce, rental, insurance, travel, subscription |
|
|
128
|
-
| **Verifier Level** | level2_identity_set |
|
|
129
|
-
|
|
130
|
-
**Parameters:**
|
|
131
|
-
|
|
132
|
-
| Parameter | Type | Required | Description |
|
|
133
|
-
|-----------|------|----------|-------------|
|
|
134
|
-
| `service_name` | string | Yes | Service object name (P16 circular reference) |
|
|
135
|
-
|
|
136
|
-
**Key Feature:** Level 2 identity-set binding + dynamic permission address verification. Signer is `permission.owner` (1002, Address) OR `has admin` (1004, Bool with [Signer] param). Permission address is submitted by caller and validated against `service.permission` (1488) — Guard survives permission rotation without rebuilding.
|
|
137
|
-
|
|
138
|
-
**Risk Rules:** R-C3-01, R-C3-05, R-C3-06, R-C4-04
|
|
139
|
-
|
|
140
|
-
---
|
|
141
|
-
|
|
142
|
-
### 6. `tpl_forward_node_check` — Workflow Node State Validation
|
|
143
|
-
|
|
144
|
-
| Field | Value |
|
|
145
|
-
|-------|-------|
|
|
146
|
-
| **Scene** | `machine_forward_guard` |
|
|
147
|
-
| **Patterns** | P06, P09 |
|
|
148
|
-
| **Industries** | rental, ecommerce, education, travel, subscription |
|
|
149
|
-
| **Verifier Level** | level3_scene_combined |
|
|
150
|
-
|
|
151
|
-
**Parameters:**
|
|
152
|
-
|
|
153
|
-
| Parameter | Type | Required | Description |
|
|
154
|
-
|-----------|------|----------|-------------|
|
|
155
|
-
| `order_id` | Address | Yes (submission) | Order address submitted by user |
|
|
156
|
-
| `node_names` | String[] | Yes | Expected current node name(s) |
|
|
157
|
-
| `service_address` | Address | No | Service address (project binding, strongly recommended) |
|
|
158
|
-
| `timeout_ms` | U64 | No (timelock variant) | Timelock duration in milliseconds |
|
|
159
|
-
| `progress_query_id` | U64 | No (default 1272) | Time reference query, default `progress.current_time` (1272) |
|
|
160
|
-
|
|
161
|
-
**Sub-variants:**
|
|
162
|
-
- **Node matching variant**: Uses P09 + P06 to verify progress.current matches expected node. Must include project binding (query 1563 order.service) to suppress R-C3-05.
|
|
163
|
-
- **Timelock variant**: Uses P05. Verifies `Clock > progress.current_time + timeout`. Uses query 1272 (progress.current_time), NOT 1271 (progress.session.forward.time) — the latter returns 0 when the forward hasn't occurred yet.
|
|
164
|
-
|
|
165
|
-
**Risk Rules:** R-C2-01, R-C2-03, R-X1-08; Timelock variant: R-X1-01, R-X1-06, R-C2-03
|
|
166
|
-
|
|
167
|
-
---
|
|
168
|
-
|
|
169
|
-
### 7. `tpl_forward_privacy_delivery_proof` — Privacy-Delivery Proof Verification (Strict Mode)
|
|
170
|
-
|
|
171
|
-
| Field | Value |
|
|
172
|
-
|-------|-------|
|
|
173
|
-
| **Scene** | `machine_forward_guard` |
|
|
174
|
-
| **Patterns** | P10, P15 (broad mode) |
|
|
175
|
-
| **Industries** | ecommerce, logistics, service, privacy delivery |
|
|
176
|
-
| **Verifier Level** | level3_scene_combined |
|
|
177
|
-
|
|
178
|
-
**Parameters:**
|
|
179
|
-
|
|
180
|
-
| Parameter | Type | Required | Description |
|
|
181
|
-
|-----------|------|----------|-------------|
|
|
182
|
-
| `service_name` | string | Yes | Service object name (P16 circular reference) |
|
|
183
|
-
|
|
184
|
-
**Key Feature:** Strict-mode Guard for privacy-sensitive information (delivery details, return addresses, private credentials). Verifier submits a Proof object address (generated by `messenger.submitChainProof`) and an Order address. Three conditions:
|
|
185
|
-
1. Signer == proof.signer (submitter accountability)
|
|
186
|
-
2. proof.time > order.time (freshness, prevents stale proof replay)
|
|
187
|
-
3. order.service == service (project binding, suppresses R-C3-05)
|
|
188
|
-
|
|
189
|
-
**Broad Mode Alternative:** Uses P15 retained_submission + String submission (Merkle Root). Validates `calc_string_length == 66` (0x prefix + 64 hex chars). Trusts submitter honesty.
|
|
190
|
-
|
|
191
|
-
**Risk Rules:** R-C3-01, R-C3-05, R-X1-12
|
|
192
|
-
|
|
193
|
-
---
|
|
194
|
-
|
|
195
|
-
### 8. `tpl_submission_signer_binding` — Submission Data Signer Binding Validation
|
|
196
|
-
|
|
197
|
-
| Field | Value |
|
|
198
|
-
|-------|-------|
|
|
199
|
-
| **Scene** | `progress_submission_guard` |
|
|
200
|
-
| **Patterns** | P08, P15 |
|
|
201
|
-
| **Industries** | rental, ecommerce, education, travel |
|
|
202
|
-
| **Verifier Level** | level1_strict |
|
|
203
|
-
|
|
204
|
-
**Parameters:**
|
|
205
|
-
|
|
206
|
-
| Parameter | Type | Required | Description |
|
|
207
|
-
|-----------|------|----------|-------------|
|
|
208
|
-
| `expected_value` | string | Yes | Expected submission value (e.g., node name, status code) |
|
|
209
|
-
| `provider_address` | address | Yes | Service provider address (for identity verification) |
|
|
210
|
-
|
|
211
|
-
**Key Feature:** Validates that the submitting user is a legitimate Progress participant and the submitted value matches expectations. E.g., user submits 'return' for equipment return; Guard verifies submitter is the service provider and operation type is correct.
|
|
212
|
-
|
|
213
|
-
**Risk Rules:** R-C3-01, R-C3-03, R-X1-12
|
|
214
|
-
|
|
215
|
-
---
|
|
216
|
-
|
|
217
|
-
### 9. `tpl_reward_one_time_claim` — One-Time Reward Claim Validation
|
|
218
|
-
|
|
219
|
-
| Field | Value |
|
|
220
|
-
|-------|-------|
|
|
221
|
-
| **Scene** | `reward_guard` |
|
|
222
|
-
| **Patterns** | P07, P13 |
|
|
223
|
-
| **Industries** | ecommerce, education, travel, subscription |
|
|
224
|
-
| **Verifier Level** | level3_scene_combined |
|
|
225
|
-
|
|
226
|
-
**Parameters:**
|
|
227
|
-
|
|
228
|
-
| Parameter | Type | Required | Description |
|
|
229
|
-
|-----------|------|----------|-------------|
|
|
230
|
-
| `order_id` | Address | Yes (submission) | Order address submitted by user |
|
|
231
|
-
| `reward_address` | Address | Yes | Reward object address |
|
|
232
|
-
| `expected_node` | String | Yes | Expected node name (e.g., "Wonderful") |
|
|
233
|
-
| `service_address` | Address | No | Service address (project binding, recommended) |
|
|
234
|
-
|
|
235
|
-
**CRITICAL Constraint (R-X1-14):** Must include re-entrancy protection — query 1613 `reward.record has` + `logic_not` wrapping, or 1612 count == 0. Without this → CRITICAL risk.
|
|
236
|
-
|
|
237
|
-
**Risk Rules:** R-X1-14 (CRITICAL re-entrancy), R-C4-01
|
|
238
|
-
|
|
239
|
-
---
|
|
240
|
-
|
|
241
|
-
### 10. `tpl_write_guard_type_check` — Storage Write Type Validation
|
|
242
|
-
|
|
243
|
-
| Field | Value |
|
|
244
|
-
|-------|-------|
|
|
245
|
-
| **Scene** | `repository_write_guard` |
|
|
246
|
-
| **Patterns** | P08, P11 |
|
|
247
|
-
| **Industries** | ecommerce, education, travel, subscription, rental |
|
|
248
|
-
| **Verifier Level** | level1_strict |
|
|
249
|
-
|
|
250
|
-
**Parameters:**
|
|
251
|
-
|
|
252
|
-
| Parameter | Type | Required | Description |
|
|
253
|
-
|-----------|------|----------|-------------|
|
|
254
|
-
| `repo_address` | Address | Yes | Repository object address |
|
|
255
|
-
| `policy_name` | String | Yes | Repository policy name (e.g., "Condition") |
|
|
256
|
-
|
|
257
|
-
**Special Constraints (BINDING_02 + BINDING_03):**
|
|
258
|
-
- Repository write_guard `id_from_submission` must be Address
|
|
259
|
-
- Repository write_guard `data_from_submission` type must match Repository value_type
|
|
260
|
-
|
|
261
|
-
**Key Issue:** `quote_guard` authentication in `verify_guard` stage always has an empty `impack_list`, so repository queries with quote_guard will fail with `IMPACK_GUARD_NOT_FOUND` in gen_passport flow.
|
|
262
|
-
|
|
263
|
-
**Risk Rules:** R-C1-03, R-C3-04, R-X1-10, R-X1-14 (LOW)
|
|
264
|
-
|
|
265
|
-
---
|
|
266
|
-
|
|
267
|
-
### 11. `tpl_usage_guard_threshold` — Dispute Initiation Threshold Validation
|
|
268
|
-
|
|
269
|
-
| Field | Value |
|
|
270
|
-
|-------|-------|
|
|
271
|
-
| **Scene** | `arbitration_usage_guard` |
|
|
272
|
-
| **Patterns** | P02, P10 |
|
|
273
|
-
| **Industries** | ecommerce, rental, education, travel |
|
|
274
|
-
| **Verifier Level** | level3_scene_combined |
|
|
275
|
-
|
|
276
|
-
**Parameters:**
|
|
277
|
-
|
|
278
|
-
| Parameter | Type | Required | Description |
|
|
279
|
-
|-----------|------|----------|-------------|
|
|
280
|
-
| `arbitration_address` | Address | Yes | Arbitration object address |
|
|
281
|
-
| `threshold` | U64 | Yes | Dispute initiation threshold (e.g., minimum reputation score) |
|
|
282
|
-
|
|
283
|
-
**Key Constraint:** EntityRegistrar address is fixed at `0xaab`, EntityLinker at `0xaaa` (R-C1-02 system address misuse risk).
|
|
284
|
-
|
|
285
|
-
**Risk Rules:** R-X1-01, R-X1-07, R-C3-03
|
|
286
|
-
|
|
287
|
-
---
|
|
288
|
-
|
|
289
|
-
### 12. `tpl_voting_guard_numeric_weight` — Numeric Voting Weight Validation
|
|
290
|
-
|
|
291
|
-
| Field | Value |
|
|
292
|
-
|-------|-------|
|
|
293
|
-
| **Scene** | `arbitration_voting_guard` |
|
|
294
|
-
| **Patterns** | P12 |
|
|
295
|
-
| **Industries** | ecommerce, rental, education, travel |
|
|
296
|
-
| **Verifier Level** | level2_identity_set |
|
|
297
|
-
|
|
298
|
-
**Parameters:**
|
|
299
|
-
|
|
300
|
-
| Parameter | Type | Required | Description |
|
|
301
|
-
|-----------|------|----------|-------------|
|
|
302
|
-
| `arbitration_address` | Address | Yes | Arbitration object address |
|
|
303
|
-
| `weight_threshold` | U64 | No | Weight comparison threshold (optional) |
|
|
304
|
-
|
|
305
|
-
**Special Constraint (BINDING_01):** voting_guard's GuardIdentifier must be numeric (U8/U256), otherwise Move layer throws `E_GUARD_IDENTIFIER_NOT_NUMBER`. Root must return a numeric type (e.g., U64), not Bool — the only exception among the 9 binding scenarios.
|
|
306
|
-
|
|
307
|
-
**CRITICAL Constraint (R-X1-14):** Must include re-entrancy protection — query 1404 `arb.voted has` + `logic_not` wrapping, or 1405 count == 0. Note: 1403 `arb.voted_count` is the total count and **cannot be used** for re-entrancy protection.
|
|
308
|
-
|
|
309
|
-
**Risk Rules:** R-C3-02 (CRITICAL weight forgery), R-X1-14 (CRITICAL re-entrancy), BINDING_01 (numeric)
|
|
310
|
-
|
|
311
|
-
---
|
|
312
|
-
|
|
313
|
-
### 13. `tpl_gen_passport_identity` — Passport Identity Credential Generation Validation
|
|
314
|
-
|
|
315
|
-
| Field | Value |
|
|
316
|
-
|-------|-------|
|
|
317
|
-
| **Scene** | `gen_passport_guard` |
|
|
318
|
-
| **Patterns** | P03, P14 |
|
|
319
|
-
| **Industries** | ecommerce, education, travel, subscription, rental |
|
|
320
|
-
| **Verifier Level** | level1_strict |
|
|
321
|
-
|
|
322
|
-
**Parameters:**
|
|
323
|
-
|
|
324
|
-
| Parameter | Type | Required | Description |
|
|
325
|
-
|-----------|------|----------|-------------|
|
|
326
|
-
| `authorized_address` | address | Yes | Authorized address (or use Vec\<Address\> whitelist) |
|
|
327
|
-
|
|
328
|
-
**Key Feature:** Standalone Guard — does not bind to a Host Object (`host_object: Standalone`). Verifies user identity and generates a signed Passport credential, which can be used as submission data in subsequent operations.
|
|
329
|
-
|
|
330
|
-
**Constraints:**
|
|
331
|
-
- `impack_list` is always empty during verify stage; quote_guard queries will fail
|
|
332
|
-
- Can be relied upon by other Guards via `rely` (requires `rep=true`)
|
|
333
|
-
- Generated Passport can be used as submission data in subsequent operations
|
|
334
|
-
|
|
335
|
-
**Risk Rules:** R-C1-01, R-X1-10, R-X1-13
|
|
336
|
-
|
|
337
|
-
---
|
|
338
|
-
|
|
339
|
-
## Pattern-to-Template Mapping
|
|
340
|
-
|
|
341
|
-
| Pattern | Data Source Combination | Typical Templates |
|
|
342
|
-
|---------|----------------------|-------------------|
|
|
343
|
-
| P02 | Type1 + Type4 | `tpl_allocator_threshold`, `tpl_usage_guard_threshold` |
|
|
344
|
-
| P03 | Type1 + Type4 + Type1 constant | `tpl_buy_guard_whitelist`, `tpl_gen_passport_identity` |
|
|
345
|
-
| P04 | Type1 + Type4 + Type1 constant | `tpl_buy_guard_whitelist` (whitelist) |
|
|
346
|
-
| P05 | Type2 + Type4 + Type1 constant | `tpl_forward_node_check` (timelock) |
|
|
347
|
-
| P06 | Type2 + Type1 constant | `tpl_forward_node_check`, `tpl_allocator_threshold` (node matching) |
|
|
348
|
-
| P07 | Type3 + Type1 constant | `tpl_reward_one_time_claim` |
|
|
349
|
-
| P08 | Type3 + Type4 | `tpl_reward_one_time_claim` (Signer binding), `tpl_submission_signer_binding` |
|
|
350
|
-
| P09 | Type2 + Type3 | `tpl_forward_node_check`, `tpl_allocator_treasury_personal` |
|
|
351
|
-
| P10 | Type1+2+3+4 | `tpl_reward_one_time_claim` (quadruple verification), `tpl_allocator_treasury_personal` |
|
|
352
|
-
| P11 | Type3 + Type1 system address | `tpl_write_guard_type_check` |
|
|
353
|
-
| P12 | Type3 + Type4 + Type1 constant | `tpl_voting_guard_numeric_weight` |
|
|
354
|
-
| P13 | Type1 + Type2 | `tpl_reward_one_time_claim` (Repository query) |
|
|
355
|
-
| P14 | rely only | `tpl_gen_passport_identity` (P14 variant) |
|
|
356
|
-
| P15 | retained_submission | `tpl_forward_privacy_delivery_proof` (broad mode), `tpl_submission_signer_binding` |
|
|
357
|
-
| P16 | Circular reference | `tpl_buy_guard_whitelist` (circular ref), `tpl_allocator_treasury_personal` |
|
|
358
|
-
| P17 | Query parameter translation | `tpl_write_guard_type_check` (parameter translation) |
|
|
359
|
-
|
|
360
|
-
---
|
|
361
|
-
|
|
362
|
-
## Scene Distribution
|
|
363
|
-
|
|
364
|
-
| Scene | Templates |
|
|
365
|
-
|-------|-----------|
|
|
366
|
-
| `service_buy_guard` | `tpl_buy_guard_whitelist` |
|
|
367
|
-
| `service_order_allocators_guard` | `tpl_allocator_threshold`, `tpl_allocator_treasury_personal`, `tpl_allocator_identity_set_order_holder`, `tpl_allocator_identity_set_service_provider_dynamic` |
|
|
368
|
-
| `machine_forward_guard` | `tpl_forward_node_check`, `tpl_forward_privacy_delivery_proof` |
|
|
369
|
-
| `progress_submission_guard` | `tpl_submission_signer_binding` |
|
|
370
|
-
| `reward_guard` | `tpl_reward_one_time_claim` |
|
|
371
|
-
| `repository_write_guard` | `tpl_write_guard_type_check` |
|
|
372
|
-
| `arbitration_usage_guard` | `tpl_usage_guard_threshold` |
|
|
373
|
-
| `arbitration_voting_guard` | `tpl_voting_guard_numeric_weight` |
|
|
374
|
-
| `gen_passport_guard` | `tpl_gen_passport_identity` |
|
|
375
|
-
|
|
376
|
-
---
|
|
377
|
-
|
|
378
|
-
## Template-to-Risk-Rule Binding (Mandatory Checks)
|
|
379
|
-
|
|
380
|
-
| Template | Mandatory Risk Rules |
|
|
381
|
-
|----------|---------------------|
|
|
382
|
-
| `tpl_buy_guard_whitelist` | R-C1-01, R-C3-01, R-C4-01 |
|
|
383
|
-
| `tpl_allocator_threshold` | R-X1-01, R-X1-05, R-X1-08 |
|
|
384
|
-
| `tpl_allocator_treasury_personal` | R-C3-05, **R-C3-06 (CRITICAL)**, R-X1-05, R-X1-01 |
|
|
385
|
-
| `tpl_allocator_identity_set_order_holder` | R-C3-01, R-C3-05, R-C3-06, R-C4-04 |
|
|
386
|
-
| `tpl_allocator_identity_set_service_provider_dynamic` | R-C3-01, R-C3-05, R-C3-06, R-C4-04 |
|
|
387
|
-
| `tpl_forward_node_check` | R-C2-01, R-C2-03, R-X1-08 |
|
|
388
|
-
| `tpl_forward_privacy_delivery_proof` | R-C3-01, R-C3-05, R-X1-12 |
|
|
389
|
-
| `tpl_submission_signer_binding` | R-C3-01, R-C3-03, R-X1-12 |
|
|
390
|
-
| `tpl_reward_one_time_claim` | R-C1-03, R-X1-01, R-X1-10 |
|
|
391
|
-
| `tpl_write_guard_type_check` | R-C1-02, R-C3-03, R-C3-04 |
|
|
392
|
-
| `tpl_usage_guard_threshold` | R-X1-01, R-X1-07, R-C3-03 |
|
|
393
|
-
| `tpl_voting_guard_numeric_weight` | R-C3-02 (CRITICAL weight forgery), R-C2-01, R-C2-02, BINDING_01 (numeric) |
|
|
394
|
-
| `tpl_gen_passport_identity` | R-C1-01, R-X1-10, R-X1-13 |
|
|
395
|
-
|
|
396
|
-
---
|
|
397
|
-
|
|
398
|
-
## Template Recommendation Functions
|
|
399
|
-
|
|
400
|
-
### `suggestTemplateForScene(sceneId)`
|
|
401
|
-
Returns the first matching template for a given scene ID.
|
|
402
|
-
|
|
403
|
-
| Scene | Recommended Template |
|
|
404
|
-
|-------|---------------------|
|
|
405
|
-
| `service_buy_guard` | `tpl_buy_guard_whitelist` |
|
|
406
|
-
| `service_order_allocators_guard` | `tpl_allocator_threshold` (+3 alternatives) |
|
|
407
|
-
| `machine_forward_guard` | `tpl_forward_node_check` (+1 alternative) |
|
|
408
|
-
| `progress_submission_guard` | `tpl_submission_signer_binding` |
|
|
409
|
-
| `reward_guard` | `tpl_reward_one_time_claim` |
|
|
410
|
-
| `repository_write_guard` | `tpl_write_guard_type_check` |
|
|
411
|
-
| `arbitration_usage_guard` | `tpl_usage_guard_threshold` |
|
|
412
|
-
| `arbitration_voting_guard` | `tpl_voting_guard_numeric_weight` |
|
|
413
|
-
| `gen_passport_guard` | `tpl_gen_passport_identity` |
|
|
414
|
-
|
|
415
|
-
### `getTemplatesByScene(sceneId)`
|
|
416
|
-
Returns all available templates for a scene (e.g., order_allocators has 4 templates).
|
|
417
|
-
|
|
418
|
-
### `getTemplatesByIndustry(industryTag)`
|
|
419
|
-
Filters templates by industry tag (e.g., `"ecommerce"` returns buy_guard, order_allocator, reward_guard, etc.).
|
|
420
|
-
|
|
421
|
-
### `validateTemplateParams(template, params)`
|
|
422
|
-
Validates user-provided parameters against template definition:
|
|
423
|
-
- Required parameters present
|
|
424
|
-
- Type matching (Address must be valid Wow address format)
|
|
425
|
-
- Numeric range validity (U64 must be ≥ 0)
|
|
426
|
-
- String length constraints
|
|
427
|
-
|
|
428
|
-
---
|
|
429
|
-
|
|
430
|
-
## Special Pattern Templates
|
|
431
|
-
|
|
432
|
-
### Retained Submission (P15)
|
|
433
|
-
Forward execution retains audit data; caller submits constrained scalar values (not object addresses). Typical use: Machine Forward.guard requiring Merkle Root, signature results, etc.
|
|
434
|
-
|
|
435
|
-
**Constraint (R-X1-12):** Each `b_submission=true` entry's name must be a complete natural-language description (≥10 characters). A `binding_constraint` field is recommended to describe value rules.
|
|
436
|
-
|
|
437
|
-
### Circular Reference (P16)
|
|
438
|
-
Guard binds to a Host Object and simultaneously queries the Host Object's own fields (e.g., Service.buy_guard querying `service.paused`).
|
|
439
|
-
|
|
440
|
-
**Workflow:** CREATE host (no guard) → CREATE guard (table references host by name) → MODIFY host (bind guard).
|
|
441
|
-
|
|
442
|
-
**Constraint (R-X1-13):** Host Object's value in table must use a name (e.g., `"my_service"`) not an address, since the Host Object may not be published yet when Guard is created. `host_object_state` must be `created_unpublished` — if already `published_immutable`, a new Host Object must be created.
|
|
443
|
-
|
|
444
|
-
### Query Parameter Translation (P17)
|
|
445
|
-
Witness query parameter type doesn't match the table-declared type, requiring a type conversion node.
|
|
446
|
-
|
|
447
|
-
**Conversion Nodes:**
|
|
448
|
-
|
|
449
|
-
| Node | Source → Target | Typical Use |
|
|
450
|
-
|------|----------------|-------------|
|
|
451
|
-
| `convert_number_address` | number → Address | U64 timestamp → Address key |
|
|
452
|
-
| `convert_address_number` | Address → U256 | Address key → numeric comparison |
|
|
453
|
-
| `convert_number_string` | number → String | Numeric → string concatenation |
|
|
454
|
-
| `convert_string_number` | String → U256 | String numeric → numeric |
|
|
455
|
-
| `convert_safe_u8/u16/u32/u64/u128/u256` | number → width | Width narrowing (overflow errors) |
|
|
456
|
-
|
|
457
|
-
---
|
|
458
|
-
|
|
459
|
-
## Witness Reference (9 Types)
|
|
460
|
-
|
|
461
|
-
| Witness | Name | Source → Target | Hops |
|
|
462
|
-
|---------|------|----------------|------|
|
|
463
|
-
| 100 | TypeOrderProgress | Order → Progress | 1 |
|
|
464
|
-
| 101 | TypeOrderMachine | Order → Machine | 1 |
|
|
465
|
-
| 102 | TypeOrderService | Order → Service | 1 |
|
|
466
|
-
| 103 | TypeProgressMachine | Progress → Machine | 1 |
|
|
467
|
-
| 104 | TypeArbOrder | Arb → Order | 1 |
|
|
468
|
-
| 105 | TypeArbArbitration | Arb → Arbitration | 1 |
|
|
469
|
-
| 106 | TypeArbProgress | Arb → Progress | 2 |
|
|
470
|
-
| 107 | TypeArbMachine | Arb → Machine | 2 |
|
|
471
|
-
| 108 | TypeArbService | Arb → Service | 2 |
|
|
472
|
-
|
|
473
|
-
---
|
|
474
|
-
|
|
475
|
-
## Verifier Constraint Levels
|
|
476
|
-
|
|
477
|
-
| Level | Description | Templates |
|
|
478
|
-
|-------|-------------|-----------|
|
|
479
|
-
| level1_strict | Strict single identity | `tpl_submission_signer_binding`, `tpl_write_guard_type_check`, `tpl_gen_passport_identity` |
|
|
480
|
-
| level2_identity_set | Identity set | `tpl_buy_guard_whitelist`, `tpl_allocator_identity_set_order_holder`, `tpl_allocator_identity_set_service_provider_dynamic`, `tpl_voting_guard_numeric_weight` |
|
|
481
|
-
| level3_scene_combined | Scene combined, no Signer binding needed | Remaining 7 templates |
|