@agoric/cosmic-swingset 0.41.4-dev-68f7b6b.0 → 0.41.4-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/Makefile +4 -4
- package/package.json +10 -10
- package/src/chain-main.js +10 -7
- package/src/launch-chain.js +42 -31
- package/src/sim-chain.js +18 -10
- package/src/sim-params.js +1 -1
package/Makefile
CHANGED
|
@@ -141,18 +141,18 @@ scenario2-setup:
|
|
|
141
141
|
|
|
142
142
|
t1/decentral-economy-config.json: $(ECONOMY_PROPOSALS)
|
|
143
143
|
jq -s '.[0] * { coreProposals: .[1] }' \
|
|
144
|
-
../
|
|
144
|
+
../boot/decentral-core-config.json \
|
|
145
145
|
'$(ECONOMY_PROPOSALS)' > t1/decentral-economy-config.json
|
|
146
146
|
|
|
147
147
|
scenario2-run-chain-economy: t1/decentral-economy-config.json
|
|
148
|
-
echo "DEPRECATED use: CHAIN_BOOTSTRAP_VAT_CONFIG=@agoric/
|
|
148
|
+
echo "DEPRECATED use: CHAIN_BOOTSTRAP_VAT_CONFIG=@agoric/boot/decentral-itest-vaults-config.json scenario2-run-chain"
|
|
149
149
|
CHAIN_BOOTSTRAP_VAT_CONFIG="$$PWD/t1/decentral-economy-config.json" \
|
|
150
150
|
$(MAKE) scenario2-run-chain
|
|
151
151
|
|
|
152
152
|
# We want to use the same configuration that will be deployed to the next
|
|
153
153
|
# devnet.agoric.net so that developers can test their code against it locally.
|
|
154
|
-
scenario2-run-chain: ../
|
|
155
|
-
CHAIN_BOOTSTRAP_VAT_CONFIG="$${CHAIN_BOOTSTRAP_VAT_CONFIG-$$PWD/../
|
|
154
|
+
scenario2-run-chain: ../boot/decentral-devnet-config.json
|
|
155
|
+
CHAIN_BOOTSTRAP_VAT_CONFIG="$${CHAIN_BOOTSTRAP_VAT_CONFIG-$$PWD/../boot/decentral-devnet-config.json}" \
|
|
156
156
|
OTEL_EXPORTER_PROMETHEUS_PORT=$(OTEL_EXPORTER_PROMETHEUS_PORT) \
|
|
157
157
|
$(AGC) --home=t1/n0 start --log_level=warn $(AGC_START_ARGS)
|
|
158
158
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agoric/cosmic-swingset",
|
|
3
|
-
"version": "0.41.4-dev-
|
|
3
|
+
"version": "0.41.4-dev-9f8a76e.0+9f8a76e",
|
|
4
4
|
"description": "Agoric's Cosmos blockchain integration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -22,14 +22,14 @@
|
|
|
22
22
|
"author": "Agoric",
|
|
23
23
|
"license": "Apache-2.0",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@agoric/assert": "0.6.1-dev-
|
|
26
|
-
"@agoric/cosmos": "0.34.2-dev-
|
|
27
|
-
"@agoric/deploy-script-support": "0.10.4-dev-
|
|
28
|
-
"@agoric/internal": "0.3.3-dev-
|
|
29
|
-
"@agoric/store": "0.9.3-dev-
|
|
30
|
-
"@agoric/swing-store": "0.9.2-dev-
|
|
31
|
-
"@agoric/swingset-vat": "0.32.3-dev-
|
|
32
|
-
"@agoric/telemetry": "0.6.3-dev-
|
|
25
|
+
"@agoric/assert": "0.6.1-dev-9f8a76e.0+9f8a76e",
|
|
26
|
+
"@agoric/cosmos": "0.34.2-dev-9f8a76e.0+9f8a76e",
|
|
27
|
+
"@agoric/deploy-script-support": "0.10.4-dev-9f8a76e.0+9f8a76e",
|
|
28
|
+
"@agoric/internal": "0.3.3-dev-9f8a76e.0+9f8a76e",
|
|
29
|
+
"@agoric/store": "0.9.3-dev-9f8a76e.0+9f8a76e",
|
|
30
|
+
"@agoric/swing-store": "0.9.2-dev-9f8a76e.0+9f8a76e",
|
|
31
|
+
"@agoric/swingset-vat": "0.32.3-dev-9f8a76e.0+9f8a76e",
|
|
32
|
+
"@agoric/telemetry": "0.6.3-dev-9f8a76e.0+9f8a76e",
|
|
33
33
|
"@endo/far": "^0.2.19",
|
|
34
34
|
"@endo/import-bundle": "^0.3.5",
|
|
35
35
|
"@endo/init": "^0.5.57",
|
|
@@ -60,5 +60,5 @@
|
|
|
60
60
|
],
|
|
61
61
|
"timeout": "20m"
|
|
62
62
|
},
|
|
63
|
-
"gitHead": "
|
|
63
|
+
"gitHead": "9f8a76ee66bd74f028158b689c4b437921613f63"
|
|
64
64
|
}
|
package/src/chain-main.js
CHANGED
|
@@ -353,12 +353,15 @@ export default async function main(progname, args, { env, homedir, agcc }) {
|
|
|
353
353
|
const argv = {
|
|
354
354
|
bootMsg,
|
|
355
355
|
};
|
|
356
|
-
const
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
356
|
+
const getVatConfig = async () => {
|
|
357
|
+
const vatHref = await importMetaResolve(
|
|
358
|
+
env.CHAIN_BOOTSTRAP_VAT_CONFIG ||
|
|
359
|
+
argv.bootMsg.params.bootstrap_vat_config,
|
|
360
|
+
import.meta.url,
|
|
361
|
+
);
|
|
362
|
+
const vatconfig = new URL(vatHref).pathname;
|
|
363
|
+
return vatconfig;
|
|
364
|
+
};
|
|
362
365
|
|
|
363
366
|
// Delay makeShutdown to override the golang interrupts
|
|
364
367
|
const { registerShutdown } = makeShutdown();
|
|
@@ -457,7 +460,7 @@ export default async function main(progname, args, { env, homedir, agcc }) {
|
|
|
457
460
|
clearChainSends,
|
|
458
461
|
replayChainSends,
|
|
459
462
|
bridgeOutbound: doOutboundBridge,
|
|
460
|
-
vatconfig,
|
|
463
|
+
vatconfig: getVatConfig,
|
|
461
464
|
argv,
|
|
462
465
|
env,
|
|
463
466
|
verboseBlocks: true,
|
package/src/launch-chain.js
CHANGED
|
@@ -67,7 +67,7 @@ const getHostKey = path => `host.${path}`;
|
|
|
67
67
|
* @param {Map<*, *>} mailboxStorage
|
|
68
68
|
* @param {undefined | ((dstID: string, obj: any) => any)} bridgeOutbound
|
|
69
69
|
* @param {SwingStoreKernelStorage} kernelStorage
|
|
70
|
-
* @param {string} vatconfig absolute path
|
|
70
|
+
* @param {string | (() => string | Promise<string>)} vatconfig absolute path
|
|
71
71
|
* @param {unknown} bootstrapArgs JSON-serializable data
|
|
72
72
|
* @param {{}} env
|
|
73
73
|
* @param {*} options
|
|
@@ -82,42 +82,48 @@ export async function buildSwingset(
|
|
|
82
82
|
{ debugName = undefined, slogCallbacks, slogSender },
|
|
83
83
|
) {
|
|
84
84
|
const debugPrefix = debugName === undefined ? '' : `${debugName}:`;
|
|
85
|
-
let config = await loadSwingsetConfigFile(vatconfig);
|
|
86
|
-
if (config === null) {
|
|
87
|
-
config = loadBasedir(vatconfig);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
85
|
const mbs = buildMailboxStateMap(mailboxStorage);
|
|
91
|
-
|
|
92
|
-
const
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
},
|
|
97
|
-
timer: {
|
|
98
|
-
sourceSpec: timer.srcPath,
|
|
99
|
-
},
|
|
100
|
-
};
|
|
86
|
+
|
|
87
|
+
const bridgeDevice = bridgeOutbound && buildBridge(bridgeOutbound);
|
|
88
|
+
const mailboxDevice = buildMailbox(mbs);
|
|
89
|
+
const timerDevice = buildTimer();
|
|
90
|
+
|
|
101
91
|
const deviceEndowments = {
|
|
102
|
-
mailbox: { ...
|
|
103
|
-
timer: { ...
|
|
92
|
+
mailbox: { ...mailboxDevice.endowments },
|
|
93
|
+
timer: { ...timerDevice.endowments },
|
|
104
94
|
};
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
if (bridgeOutbound) {
|
|
108
|
-
const bd = buildBridge(bridgeOutbound);
|
|
109
|
-
config.devices.bridge = {
|
|
110
|
-
sourceSpec: bd.srcPath,
|
|
111
|
-
};
|
|
112
|
-
deviceEndowments.bridge = { ...bd.endowments };
|
|
113
|
-
bridgeInbound = bd.deliverInbound;
|
|
95
|
+
if (bridgeDevice) {
|
|
96
|
+
deviceEndowments.bridge = { ...bridgeDevice.endowments };
|
|
114
97
|
}
|
|
115
98
|
|
|
116
99
|
async function ensureSwingsetInitialized() {
|
|
117
100
|
if (swingsetIsInitialized(kernelStorage)) {
|
|
118
101
|
return;
|
|
119
102
|
}
|
|
120
|
-
|
|
103
|
+
|
|
104
|
+
const configLocation = await (typeof vatconfig === 'function'
|
|
105
|
+
? vatconfig()
|
|
106
|
+
: vatconfig);
|
|
107
|
+
let config = await loadSwingsetConfigFile(configLocation);
|
|
108
|
+
if (config === null) {
|
|
109
|
+
config = loadBasedir(configLocation);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
config.devices = {
|
|
113
|
+
mailbox: {
|
|
114
|
+
sourceSpec: mailboxDevice.srcPath,
|
|
115
|
+
},
|
|
116
|
+
timer: {
|
|
117
|
+
sourceSpec: timerDevice.srcPath,
|
|
118
|
+
},
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
if (bridgeDevice) {
|
|
122
|
+
config.devices.bridge = {
|
|
123
|
+
sourceSpec: bridgeDevice.srcPath,
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
|
|
121
127
|
const {
|
|
122
128
|
coreProposals,
|
|
123
129
|
clearStorageSubtrees,
|
|
@@ -131,11 +137,10 @@ export async function buildSwingset(
|
|
|
131
137
|
swingsetConfig.vats[swingsetConfig.bootstrap || 'bootstrap'];
|
|
132
138
|
|
|
133
139
|
// Find the entrypoints for all the core proposals.
|
|
134
|
-
await null;
|
|
135
140
|
if (coreProposals) {
|
|
136
141
|
const { bundles, code } = await extractCoreProposalBundles(
|
|
137
142
|
coreProposals,
|
|
138
|
-
|
|
143
|
+
configLocation, // for path resolution
|
|
139
144
|
);
|
|
140
145
|
swingsetConfig.bundles = { ...swingsetConfig.bundles, ...bundles };
|
|
141
146
|
|
|
@@ -162,6 +167,7 @@ export async function buildSwingset(
|
|
|
162
167
|
debugPrefix,
|
|
163
168
|
});
|
|
164
169
|
}
|
|
170
|
+
|
|
165
171
|
await ensureSwingsetInitialized();
|
|
166
172
|
const controller = await makeSwingsetController(
|
|
167
173
|
kernelStorage,
|
|
@@ -176,7 +182,12 @@ export async function buildSwingset(
|
|
|
176
182
|
// We DON'T want to run the kernel yet, only when the application decides
|
|
177
183
|
// (either on bootstrap block (0) or in endBlock).
|
|
178
184
|
|
|
179
|
-
return {
|
|
185
|
+
return {
|
|
186
|
+
controller,
|
|
187
|
+
mb: mailboxDevice,
|
|
188
|
+
bridgeInbound: bridgeDevice && bridgeDevice.deliverInbound,
|
|
189
|
+
timer: timerDevice,
|
|
190
|
+
};
|
|
180
191
|
}
|
|
181
192
|
|
|
182
193
|
/**
|
package/src/sim-chain.js
CHANGED
|
@@ -33,7 +33,9 @@ async function makeMapStorage(file) {
|
|
|
33
33
|
const map = new Map();
|
|
34
34
|
map.commit = async () => {
|
|
35
35
|
const obj = {};
|
|
36
|
-
|
|
36
|
+
for (const [k, v] of map.entries()) {
|
|
37
|
+
obj[k] = exportMailbox(v);
|
|
38
|
+
}
|
|
37
39
|
const json = stringify(obj);
|
|
38
40
|
await fs.promises.writeFile(file, json);
|
|
39
41
|
};
|
|
@@ -42,8 +44,11 @@ async function makeMapStorage(file) {
|
|
|
42
44
|
content = await fs.promises.readFile(file);
|
|
43
45
|
return JSON.parse(content);
|
|
44
46
|
})().then(
|
|
45
|
-
obj =>
|
|
46
|
-
|
|
47
|
+
obj => {
|
|
48
|
+
for (const [k, v] of Object.entries(obj)) {
|
|
49
|
+
map.set(k, importMailbox(v));
|
|
50
|
+
}
|
|
51
|
+
},
|
|
47
52
|
() => {},
|
|
48
53
|
);
|
|
49
54
|
|
|
@@ -69,12 +74,15 @@ export async function connectToFakeChain(basedir, GCI, delay, inbound) {
|
|
|
69
74
|
},
|
|
70
75
|
};
|
|
71
76
|
|
|
72
|
-
const
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
77
|
+
const getVatConfig = async () => {
|
|
78
|
+
const url = await importMetaResolve(
|
|
79
|
+
process.env.CHAIN_BOOTSTRAP_VAT_CONFIG ||
|
|
80
|
+
argv.bootMsg.params.bootstrap_vat_config,
|
|
81
|
+
import.meta.url,
|
|
82
|
+
);
|
|
83
|
+
const vatconfig = new URL(url).pathname;
|
|
84
|
+
return vatconfig;
|
|
85
|
+
};
|
|
78
86
|
const stateDBdir = path.join(basedir, `fake-chain-${GCI}-state`);
|
|
79
87
|
function replayChainSends() {
|
|
80
88
|
Fail`Replay not implemented`;
|
|
@@ -107,7 +115,7 @@ export async function connectToFakeChain(basedir, GCI, delay, inbound) {
|
|
|
107
115
|
mailboxStorage,
|
|
108
116
|
clearChainSends,
|
|
109
117
|
replayChainSends,
|
|
110
|
-
vatconfig,
|
|
118
|
+
vatconfig: getVatConfig,
|
|
111
119
|
argv,
|
|
112
120
|
debugName: GCI,
|
|
113
121
|
metricsProvider,
|
package/src/sim-params.js
CHANGED
|
@@ -60,7 +60,7 @@ export const defaultBeansPerUnit = [
|
|
|
60
60
|
makeStringBeans(BeansPerXsnapComputron, defaultBeansPerXsnapComputron),
|
|
61
61
|
];
|
|
62
62
|
|
|
63
|
-
const defaultBootstrapVatConfig = '@agoric/
|
|
63
|
+
const defaultBootstrapVatConfig = '@agoric/boot/decentral-demo-config.json';
|
|
64
64
|
|
|
65
65
|
export const defaultPowerFlagFees = [
|
|
66
66
|
makePowerFlagFee('SMART_WALLET', [makeCoin('ubld', 10_000_000n)]),
|