@agoric/vats 0.15.2-dev-f20cc05.0 → 0.15.2-dev-9f8a76e.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/package.json +17 -29
- package/src/core/basic-behaviors.js +1 -1
- package/src/core/demoIssuers.js +1 -1
- package/src/core/startWalletFactory.d.ts +1 -1
- package/src/core/startWalletFactory.d.ts.map +1 -1
- package/src/core/startWalletFactory.js +1 -1
- package/src/core/types.d.ts +1 -1
- package/src/core/types.d.ts.map +1 -1
- package/src/core/types.js +1 -1
- package/src/core/utils.js +1 -1
- package/decentral-core-config.json +0 -63
- package/decentral-demo-config.json +0 -155
- package/decentral-devnet-config.json +0 -216
- package/decentral-itest-vaults-config.json +0 -210
- package/decentral-main-vaults-config.json +0 -229
- package/decentral-test-vaults-config.json +0 -195
- package/demo-proposals.json +0 -5
- package/tools/authorityViz.d.ts +0 -27
- package/tools/authorityViz.d.ts.map +0 -1
- package/tools/authorityViz.js +0 -291
- package/tools/viz.mk +0 -17
package/tools/authorityViz.js
DELETED
|
@@ -1,291 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
// @ts-check
|
|
3
|
-
import '@endo/init';
|
|
4
|
-
import process from 'process';
|
|
5
|
-
|
|
6
|
-
const { entries, keys, values } = Object;
|
|
7
|
-
|
|
8
|
-
const logged = label => x => {
|
|
9
|
-
console.error(label, x);
|
|
10
|
-
return x;
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
const styles = {
|
|
14
|
-
vatPowers: 'shape=star, style=filled, fillcolor=aqua',
|
|
15
|
-
vats: 'shape=doubleoctagon, style=filled, fillcolor=tomato',
|
|
16
|
-
vat: 'shape=doubleoctagon, style=filled, fillcolor=tomato3',
|
|
17
|
-
devices: 'shape=box, style=filled, fillcolor=gold',
|
|
18
|
-
space: 'shape=house, style=filled, fillcolor=khaki',
|
|
19
|
-
issuer: 'shape=trapezium, style=filled, fillcolor=chocolate',
|
|
20
|
-
brand: 'shape=Mcircle, style=filled, fillcolor=chocolate2',
|
|
21
|
-
installation: 'shape=cylinder',
|
|
22
|
-
instance: 'shape=component',
|
|
23
|
-
home: 'shape=folder',
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* @param {Set<GraphNode>} nodes
|
|
28
|
-
* @param {Map<string, Set<{ id: string; style?: string }>>} neighbors
|
|
29
|
-
* @yields {string}
|
|
30
|
-
*
|
|
31
|
-
* @typedef {{
|
|
32
|
-
* id: string;
|
|
33
|
-
* cluster?: string;
|
|
34
|
-
* label: string;
|
|
35
|
-
* style?: string;
|
|
36
|
-
* }} GraphNode
|
|
37
|
-
*/
|
|
38
|
-
function* fmtGraph(nodes, neighbors) {
|
|
39
|
-
const q = txt => JSON.stringify(txt.replace(/\./g, '_'));
|
|
40
|
-
yield 'digraph G {\n';
|
|
41
|
-
yield 'rankdir = LR;\n';
|
|
42
|
-
const clusters = new Set(
|
|
43
|
-
[...nodes].map(({ cluster }) => cluster).filter(c => !!c),
|
|
44
|
-
);
|
|
45
|
-
for (const subgraph of [...clusters, undefined]) {
|
|
46
|
-
if (subgraph) {
|
|
47
|
-
assert.typeof(subgraph, 'string');
|
|
48
|
-
yield `subgraph cluster_${subgraph} {\n`;
|
|
49
|
-
yield `label = "${subgraph}"\n`;
|
|
50
|
-
}
|
|
51
|
-
for (const { id, cluster, label, style } of nodes) {
|
|
52
|
-
if (subgraph && cluster !== subgraph) continue;
|
|
53
|
-
yield `${q(id)} [label=${q(label)}${style ? `, ${style}` : ''}];\n`;
|
|
54
|
-
}
|
|
55
|
-
if (subgraph) {
|
|
56
|
-
yield `}\n`;
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
for (const [src, arcs] of neighbors.entries()) {
|
|
60
|
-
for (const { id, style } of arcs) {
|
|
61
|
-
yield `${q(src)} -> ${q(id)} [${style}]\n`;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
yield '}\n';
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* @param {Record<string, Permit>} manifest
|
|
69
|
-
*
|
|
70
|
-
* @typedef {| true
|
|
71
|
-
* | ({
|
|
72
|
-
* vatParameters?: Record<string, Permit>;
|
|
73
|
-
* vatPowers?: Record<string, true>;
|
|
74
|
-
* vats?: Record<string, Status>;
|
|
75
|
-
* devices?: Record<string, true>;
|
|
76
|
-
* home?: PowerSpace;
|
|
77
|
-
* issuer?: PowerSpace;
|
|
78
|
-
* brand?: PowerSpace;
|
|
79
|
-
* oracleBrand?: PowerSpace;
|
|
80
|
-
* installation?: PowerSpace;
|
|
81
|
-
* instance?: PowerSpace;
|
|
82
|
-
* } & PowerSpace)} Permit
|
|
83
|
-
*
|
|
84
|
-
* @typedef {{
|
|
85
|
-
* produce?: Record<string, Status>;
|
|
86
|
-
* consume?: Record<string, Status>;
|
|
87
|
-
* }} PowerSpace
|
|
88
|
-
*
|
|
89
|
-
* @typedef {boolean | VatName} Status
|
|
90
|
-
*
|
|
91
|
-
* @typedef {string} VatName
|
|
92
|
-
*/
|
|
93
|
-
const manifest2graph = manifest => {
|
|
94
|
-
/** @type {Set<GraphNode>} */
|
|
95
|
-
const nodes = new Set();
|
|
96
|
-
const neighbors = new Map();
|
|
97
|
-
|
|
98
|
-
/**
|
|
99
|
-
* @param {string} src
|
|
100
|
-
* @param {string} dest
|
|
101
|
-
* @param {string} [style]
|
|
102
|
-
*/
|
|
103
|
-
const addEdge = (src, dest, style = '') => {
|
|
104
|
-
logged('addEdge')({ src, dest });
|
|
105
|
-
if (!neighbors.has(src)) {
|
|
106
|
-
neighbors.set(src, new Set());
|
|
107
|
-
}
|
|
108
|
-
neighbors.get(src).add({ id: dest, style });
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* @param {string} src
|
|
113
|
-
* @param {string} ty
|
|
114
|
-
* @param {Permit} item
|
|
115
|
-
* @param {boolean} [reverse]
|
|
116
|
-
*/
|
|
117
|
-
const level1 = (src, ty, item, reverse = false) => {
|
|
118
|
-
if (!item) return;
|
|
119
|
-
for (const [powerName, status] of entries(item)) {
|
|
120
|
-
// subsumed by permits for vat:, home:, ...
|
|
121
|
-
if (
|
|
122
|
-
[
|
|
123
|
-
'loadVat',
|
|
124
|
-
'loadCriticalVat',
|
|
125
|
-
'client',
|
|
126
|
-
'agoricNames',
|
|
127
|
-
'nameHubs',
|
|
128
|
-
'nameAdmins',
|
|
129
|
-
].includes(powerName) &&
|
|
130
|
-
reverse
|
|
131
|
-
)
|
|
132
|
-
continue;
|
|
133
|
-
if (status) {
|
|
134
|
-
let cluster = {};
|
|
135
|
-
if (typeof status !== 'boolean') {
|
|
136
|
-
cluster = { cluster: status };
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
nodes.add({
|
|
140
|
-
id: `${ty}.${powerName}`,
|
|
141
|
-
label: powerName,
|
|
142
|
-
style: styles[ty],
|
|
143
|
-
...cluster,
|
|
144
|
-
});
|
|
145
|
-
addEdge(src, `${ty}.${powerName}`, reverse ? 'dir=back' : '');
|
|
146
|
-
if (ty === 'home') {
|
|
147
|
-
nodes.add({ id: 'home', label: 'home', cluster: 'provisioning' });
|
|
148
|
-
addEdge('home', `${ty}.${powerName}`);
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
/** @type {<X>(xs: X[]) => X[]} */
|
|
155
|
-
const uniq = xs => [...new Set(xs)];
|
|
156
|
-
const spaces = uniq(
|
|
157
|
-
logged('vals')(values(manifest)).flatMap(permit =>
|
|
158
|
-
logged('keys?')(keys(permit)).flatMap(name => {
|
|
159
|
-
logged('name?')(name);
|
|
160
|
-
|
|
161
|
-
if (['produce', 'consume'].includes(name)) return [];
|
|
162
|
-
return [name];
|
|
163
|
-
}),
|
|
164
|
-
),
|
|
165
|
-
);
|
|
166
|
-
console.error('@@@', { spaces });
|
|
167
|
-
|
|
168
|
-
for (const [fnName, permit] of entries(manifest)) {
|
|
169
|
-
if (permit === true) {
|
|
170
|
-
console.error('skipping wildcard permit:', fnName);
|
|
171
|
-
continue;
|
|
172
|
-
}
|
|
173
|
-
nodes.add({ id: logged('fn')(fnName), label: fnName });
|
|
174
|
-
|
|
175
|
-
permit.vatPowers && level1(fnName, 'vatPowers', permit.vatPowers, true);
|
|
176
|
-
permit.vats && level1(fnName, 'vats', permit.vats, true);
|
|
177
|
-
permit.devices && level1(fnName, 'devices', permit.devices, true);
|
|
178
|
-
|
|
179
|
-
const doPart = (name, part) => {
|
|
180
|
-
if (!part) return;
|
|
181
|
-
level1(fnName, name, part.produce || {});
|
|
182
|
-
level1(fnName, name, part.consume || {}, true);
|
|
183
|
-
};
|
|
184
|
-
doPart('space', permit);
|
|
185
|
-
spaces.forEach(s => doPart(s, permit[s]));
|
|
186
|
-
|
|
187
|
-
if ('runBehaviors' in permit) {
|
|
188
|
-
throw Error('not impl');
|
|
189
|
-
// nodes.add({
|
|
190
|
-
// id: `runBehaviors`,
|
|
191
|
-
// label: `runBehaviors`,
|
|
192
|
-
// style: '',
|
|
193
|
-
// });
|
|
194
|
-
// addEdge(fnName, `runBehaviors`);
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
return { nodes, neighbors };
|
|
198
|
-
};
|
|
199
|
-
|
|
200
|
-
const { Fail, quote: q } = assert;
|
|
201
|
-
|
|
202
|
-
/**
|
|
203
|
-
* @param {string} specifier
|
|
204
|
-
* @param {object} io
|
|
205
|
-
* @param {Resolver} io.resolve
|
|
206
|
-
* @param {typeof import('fs/promises').readFile} io.readFile
|
|
207
|
-
*/
|
|
208
|
-
const loadConfig = async (specifier, { resolve, readFile }) => {
|
|
209
|
-
const fullPath = await resolve(specifier, import.meta.url).then(
|
|
210
|
-
u => new URL(u).pathname,
|
|
211
|
-
);
|
|
212
|
-
typeof fullPath === 'string' || Fail`${q(specifier)}`;
|
|
213
|
-
const txt = await readFile(fullPath, 'utf-8');
|
|
214
|
-
typeof txt === 'string' || Fail`readFile ${q(fullPath)}`;
|
|
215
|
-
return JSON.parse(txt);
|
|
216
|
-
};
|
|
217
|
-
|
|
218
|
-
/**
|
|
219
|
-
* @param {string[]} args
|
|
220
|
-
* @param {object} io
|
|
221
|
-
* @param {typeof import('process').stdout} io.stdout
|
|
222
|
-
* @param {typeof import('fs/promises')} io.fsp
|
|
223
|
-
* @param {{
|
|
224
|
-
* resolve: Resolver;
|
|
225
|
-
* url: string;
|
|
226
|
-
* load: (specifier: string) => Promise<Record<string, any>>;
|
|
227
|
-
* }} io.meta
|
|
228
|
-
*
|
|
229
|
-
* @typedef {(specifier: string, parent: string) => Promise<string>} Resolver
|
|
230
|
-
*/
|
|
231
|
-
const main = async (args, { stdout, fsp, meta }) => {
|
|
232
|
-
const [specifier, ...opts] = args;
|
|
233
|
-
specifier || Fail`Usage: $0 @agoric/vats/decentral-...json`;
|
|
234
|
-
|
|
235
|
-
const config = await loadConfig(specifier, {
|
|
236
|
-
resolve: meta.resolve,
|
|
237
|
-
readFile: fsp.readFile,
|
|
238
|
-
});
|
|
239
|
-
// console.log(config);
|
|
240
|
-
const { bootstrap } = config.vats;
|
|
241
|
-
|
|
242
|
-
const { MANIFEST } = await meta
|
|
243
|
-
.resolve(bootstrap.sourceSpec, meta.url)
|
|
244
|
-
.then(p => meta.load(p));
|
|
245
|
-
// console.log('manifest keys:', Object.keys(MANIFEST));
|
|
246
|
-
|
|
247
|
-
const [gov] = ['--gov'].map(opt => opts.includes(opt));
|
|
248
|
-
|
|
249
|
-
if (gov) {
|
|
250
|
-
throw Error('not impl');
|
|
251
|
-
/*
|
|
252
|
-
const postBoot = sim
|
|
253
|
-
? manifests.SIM_CHAIN_POST_BOOT_MANIFEST
|
|
254
|
-
: manifests.CHAIN_POST_BOOT_MANIFEST;
|
|
255
|
-
manifest = { ...postBoot, ...manifest };
|
|
256
|
-
*/
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
const g = manifest2graph(MANIFEST);
|
|
260
|
-
for (const chunk of fmtGraph(g.nodes, g.neighbors)) {
|
|
261
|
-
stdout.write(chunk);
|
|
262
|
-
}
|
|
263
|
-
};
|
|
264
|
-
|
|
265
|
-
const run = async () => {
|
|
266
|
-
const [fsp, metaResolve] = await Promise.all([
|
|
267
|
-
import('fs/promises'),
|
|
268
|
-
import('import-meta-resolve'),
|
|
269
|
-
]);
|
|
270
|
-
|
|
271
|
-
return main(process.argv.slice(2), {
|
|
272
|
-
stdout: process.stdout,
|
|
273
|
-
fsp,
|
|
274
|
-
meta: {
|
|
275
|
-
resolve: metaResolve.resolve,
|
|
276
|
-
url: import.meta.url,
|
|
277
|
-
load: specifier => import(specifier),
|
|
278
|
-
},
|
|
279
|
-
});
|
|
280
|
-
};
|
|
281
|
-
|
|
282
|
-
process.exitCode = 1;
|
|
283
|
-
run().then(
|
|
284
|
-
() => {
|
|
285
|
-
process.exitCode = 0;
|
|
286
|
-
},
|
|
287
|
-
err => {
|
|
288
|
-
console.error('Failed with', err);
|
|
289
|
-
process.exit(process.exitCode || 1);
|
|
290
|
-
},
|
|
291
|
-
);
|
package/tools/viz.mk
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
# config: tools outsidet the source tree
|
|
2
|
-
VIEWER=firefox
|
|
3
|
-
DOT=dot
|
|
4
|
-
|
|
5
|
-
CONFIG=decentral-test-vaults-config
|
|
6
|
-
|
|
7
|
-
SRC=../src/core/chain-behaviors.js ../src/core/basic-behaviors.js
|
|
8
|
-
|
|
9
|
-
$(CONFIG).svg: $(CONFIG).dot
|
|
10
|
-
$(DOT) -Tsvg $< >$@ || rm $@
|
|
11
|
-
|
|
12
|
-
view: $(CONFIG).svg
|
|
13
|
-
$(VIEWER) $<
|
|
14
|
-
|
|
15
|
-
$(CONFIG).dot: ../$(CONFIG).json $(SRC) authorityViz.js
|
|
16
|
-
node authorityViz.js ../$(CONFIG).json >$@ || rm $@
|
|
17
|
-
|