@agoric/cosmic-swingset 0.41.4-dev-ad1e50e.0 → 0.41.4-dev-0eaf7cc.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 +11 -11
- package/src/launch-chain.js +25 -0
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-0eaf7cc.0+0eaf7cc",
|
|
4
4
|
"description": "Agoric's Cosmos blockchain integration",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -22,15 +22,15 @@
|
|
|
22
22
|
"author": "Agoric",
|
|
23
23
|
"license": "Apache-2.0",
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@agoric/builders": "0.1.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-
|
|
33
|
-
"@agoric/vm-config": "0.1.1-dev-
|
|
25
|
+
"@agoric/builders": "0.1.1-dev-0eaf7cc.0+0eaf7cc",
|
|
26
|
+
"@agoric/cosmos": "0.34.2-dev-0eaf7cc.0+0eaf7cc",
|
|
27
|
+
"@agoric/deploy-script-support": "0.10.4-dev-0eaf7cc.0+0eaf7cc",
|
|
28
|
+
"@agoric/internal": "0.3.3-dev-0eaf7cc.0+0eaf7cc",
|
|
29
|
+
"@agoric/store": "0.9.3-dev-0eaf7cc.0+0eaf7cc",
|
|
30
|
+
"@agoric/swing-store": "0.9.2-dev-0eaf7cc.0+0eaf7cc",
|
|
31
|
+
"@agoric/swingset-vat": "0.32.3-dev-0eaf7cc.0+0eaf7cc",
|
|
32
|
+
"@agoric/telemetry": "0.6.3-dev-0eaf7cc.0+0eaf7cc",
|
|
33
|
+
"@agoric/vm-config": "0.1.1-dev-0eaf7cc.0+0eaf7cc",
|
|
34
34
|
"@endo/bundle-source": "^3.3.0",
|
|
35
35
|
"@endo/env-options": "^1.1.5",
|
|
36
36
|
"@endo/errors": "^1.2.4",
|
|
@@ -70,5 +70,5 @@
|
|
|
70
70
|
"typeCoverage": {
|
|
71
71
|
"atLeast": 80.6
|
|
72
72
|
},
|
|
73
|
-
"gitHead": "
|
|
73
|
+
"gitHead": "0eaf7cc8151b4e1966f3f33e43362d3d021457aa"
|
|
74
74
|
}
|
package/src/launch-chain.js
CHANGED
|
@@ -21,6 +21,7 @@ import {
|
|
|
21
21
|
makeSwingsetController,
|
|
22
22
|
loadBasedir,
|
|
23
23
|
loadSwingsetConfigFile,
|
|
24
|
+
upgradeSwingset,
|
|
24
25
|
} from '@agoric/swingset-vat';
|
|
25
26
|
import { waitUntilQuiescent } from '@agoric/internal/src/lib-nodejs/waitUntilQuiescent.js';
|
|
26
27
|
import { openSwingStore } from '@agoric/swing-store';
|
|
@@ -214,6 +215,7 @@ export async function buildSwingset(
|
|
|
214
215
|
}
|
|
215
216
|
|
|
216
217
|
const coreProposals = await ensureSwingsetInitialized();
|
|
218
|
+
upgradeSwingset(kernelStorage);
|
|
217
219
|
const controller = await makeSwingsetController(
|
|
218
220
|
kernelStorage,
|
|
219
221
|
deviceEndowments,
|
|
@@ -331,6 +333,25 @@ export async function launch({
|
|
|
331
333
|
}) {
|
|
332
334
|
console.info('Launching SwingSet kernel');
|
|
333
335
|
|
|
336
|
+
// The swingstore export-data callback gives us export-data records,
|
|
337
|
+
// which must be written into IAVL by sending them over to the
|
|
338
|
+
// golang side with swingStoreExportCallback . However, that
|
|
339
|
+
// callback isn't ready right away, so if e.g. openSwingStore() were
|
|
340
|
+
// to invoke it, we might lose those records. Likewise
|
|
341
|
+
// saveOutsideState() gathers the chainSends just before calling
|
|
342
|
+
// commit, so if the callback were invoked during commit(), those
|
|
343
|
+
// records would be left for a subsequent block, which would break
|
|
344
|
+
// consensus if the node crashed before the next commit. So this
|
|
345
|
+
// `allowExportCallback` flag serves to catch these two cases.
|
|
346
|
+
//
|
|
347
|
+
// Note that swingstore is within its rights to call exportCallback
|
|
348
|
+
// during openSwingStore() or commit(), it just happens to not do so
|
|
349
|
+
// right now. If that changes under maintenance, this guard should
|
|
350
|
+
// turn a corruption bug into a crash bug. See
|
|
351
|
+
// https://github.com/Agoric/agoric-sdk/issues/9655 for details
|
|
352
|
+
|
|
353
|
+
let allowExportCallback = false;
|
|
354
|
+
|
|
334
355
|
// The swingStore's exportCallback is synchronous, however we allow the
|
|
335
356
|
// callback provided to launch-chain to be asynchronous. The callbacks are
|
|
336
357
|
// invoked sequentially like if they were awaited, and the block manager
|
|
@@ -341,6 +362,7 @@ export async function launch({
|
|
|
341
362
|
const swingStoreExportSyncCallback =
|
|
342
363
|
swingStoreExportCallback &&
|
|
343
364
|
(updates => {
|
|
365
|
+
assert(allowExportCallback, 'export-data callback called at bad time');
|
|
344
366
|
pendingSwingStoreExport = swingStoreExportCallbackWithQueue(updates);
|
|
345
367
|
});
|
|
346
368
|
|
|
@@ -468,6 +490,7 @@ export async function launch({
|
|
|
468
490
|
}
|
|
469
491
|
|
|
470
492
|
async function saveOutsideState(blockHeight) {
|
|
493
|
+
allowExportCallback = false;
|
|
471
494
|
const chainSends = await clearChainSends();
|
|
472
495
|
kvStore.set(getHostKey('height'), `${blockHeight}`);
|
|
473
496
|
kvStore.set(getHostKey('chainSends'), JSON.stringify(chainSends));
|
|
@@ -887,6 +910,7 @@ export async function launch({
|
|
|
887
910
|
// );
|
|
888
911
|
switch (action.type) {
|
|
889
912
|
case ActionType.AG_COSMOS_INIT: {
|
|
913
|
+
allowExportCallback = true; // cleared by saveOutsideState in COMMIT_BLOCK
|
|
890
914
|
const { blockHeight, isBootstrap, upgradeDetails } = action;
|
|
891
915
|
|
|
892
916
|
if (!blockNeedsExecution(blockHeight)) {
|
|
@@ -973,6 +997,7 @@ export async function launch({
|
|
|
973
997
|
}
|
|
974
998
|
|
|
975
999
|
case ActionType.BEGIN_BLOCK: {
|
|
1000
|
+
allowExportCallback = true; // cleared by saveOutsideState in COMMIT_BLOCK
|
|
976
1001
|
const { blockHeight, blockTime, params } = action;
|
|
977
1002
|
blockParams = parseParams(params);
|
|
978
1003
|
verboseBlocks &&
|