@agoric/cosmic-swingset 0.41.4-dev-7bfadd3.0 → 0.41.4-dev-c6d8a27.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/export-kernel-db.js +19 -16
- package/src/import-kernel-db.js +5 -1
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-c6d8a27.0+c6d8a27",
|
|
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/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-
|
|
33
|
-
"@agoric/vm-config": "0.1.1-dev-
|
|
25
|
+
"@agoric/assert": "0.6.1-dev-c6d8a27.0+c6d8a27",
|
|
26
|
+
"@agoric/cosmos": "0.34.2-dev-c6d8a27.0+c6d8a27",
|
|
27
|
+
"@agoric/deploy-script-support": "0.10.4-dev-c6d8a27.0+c6d8a27",
|
|
28
|
+
"@agoric/internal": "0.3.3-dev-c6d8a27.0+c6d8a27",
|
|
29
|
+
"@agoric/store": "0.9.3-dev-c6d8a27.0+c6d8a27",
|
|
30
|
+
"@agoric/swing-store": "0.9.2-dev-c6d8a27.0+c6d8a27",
|
|
31
|
+
"@agoric/swingset-vat": "0.32.3-dev-c6d8a27.0+c6d8a27",
|
|
32
|
+
"@agoric/telemetry": "0.6.3-dev-c6d8a27.0+c6d8a27",
|
|
33
|
+
"@agoric/vm-config": "0.1.1-dev-c6d8a27.0+c6d8a27",
|
|
34
34
|
"@endo/bundle-source": "^2.5.2",
|
|
35
35
|
"@endo/far": "^0.2.19",
|
|
36
36
|
"@endo/import-bundle": "^0.3.5",
|
|
@@ -65,5 +65,5 @@
|
|
|
65
65
|
],
|
|
66
66
|
"timeout": "20m"
|
|
67
67
|
},
|
|
68
|
-
"gitHead": "
|
|
68
|
+
"gitHead": "c6d8a278ad7d7c0ad758f57c7e4db858d6a67e53"
|
|
69
69
|
}
|
package/src/export-kernel-db.js
CHANGED
|
@@ -11,7 +11,7 @@ import pathPower from 'path';
|
|
|
11
11
|
import { fileURLToPath } from 'url';
|
|
12
12
|
|
|
13
13
|
import { makePromiseKit } from '@endo/promise-kit';
|
|
14
|
-
import { Fail } from '@agoric/assert';
|
|
14
|
+
import { Fail, q } from '@agoric/assert';
|
|
15
15
|
import { makeAggregateError } from '@agoric/internal';
|
|
16
16
|
import { makeShutdown } from '@agoric/internal/src/node/shutdown.js';
|
|
17
17
|
import { openSwingStore, makeSwingStoreExporter } from '@agoric/swing-store';
|
|
@@ -19,29 +19,35 @@ import { openSwingStore, makeSwingStoreExporter } from '@agoric/swing-store';
|
|
|
19
19
|
import { isEntrypoint } from './helpers/is-entrypoint.js';
|
|
20
20
|
import { makeProcessValue } from './helpers/process-value.js';
|
|
21
21
|
|
|
22
|
-
/** @typedef {'current' | 'archival' | 'debug'} SwingStoreExportMode */
|
|
23
|
-
|
|
24
22
|
// ExportManifestFilename is the manifest filename which must be synchronized
|
|
25
23
|
// with the golang SwingStoreExportsHandler in golang/cosmos/x/swingset/keeper/swing_store_exports_handler.go
|
|
26
24
|
export const ExportManifestFileName = 'export-manifest.json';
|
|
27
25
|
|
|
28
|
-
|
|
26
|
+
/** @typedef {'current' | 'archival' | 'debug'} SwingStoreExportMode */
|
|
27
|
+
|
|
29
28
|
/**
|
|
30
|
-
* @param {
|
|
31
|
-
* @returns {
|
|
29
|
+
* @param {SwingStoreExportMode | undefined} exportMode
|
|
30
|
+
* @returns {import("@agoric/swing-store").ArtifactMode}
|
|
32
31
|
*/
|
|
33
|
-
const
|
|
34
|
-
switch (
|
|
32
|
+
const getArtifactModeFromExportMode = exportMode => {
|
|
33
|
+
switch (exportMode) {
|
|
35
34
|
case 'current':
|
|
35
|
+
case undefined:
|
|
36
|
+
return 'operational';
|
|
36
37
|
case 'archival':
|
|
38
|
+
return 'archival';
|
|
37
39
|
case 'debug':
|
|
38
|
-
|
|
39
|
-
break;
|
|
40
|
+
return 'debug';
|
|
40
41
|
default:
|
|
41
|
-
throw Fail`Invalid value ${
|
|
42
|
+
throw Fail`Invalid value ${q(exportMode)} for "export-mode"`;
|
|
42
43
|
}
|
|
43
44
|
};
|
|
44
45
|
|
|
46
|
+
/**
|
|
47
|
+
* @type {(exportMode: string | undefined) => asserts exportMode is SwingStoreExportMode}
|
|
48
|
+
*/
|
|
49
|
+
const checkExportMode = getArtifactModeFromExportMode;
|
|
50
|
+
|
|
45
51
|
/**
|
|
46
52
|
* A state-sync manifest is a representation of the information contained in a
|
|
47
53
|
* swingStore export for a given block.
|
|
@@ -116,10 +122,7 @@ export const initiateSwingStoreExport = (
|
|
|
116
122
|
log = console.log,
|
|
117
123
|
},
|
|
118
124
|
) => {
|
|
119
|
-
const
|
|
120
|
-
if (effectiveExportMode !== 'current' && !includeExportData) {
|
|
121
|
-
throw Fail`Must include export data if export mode not "current"`;
|
|
122
|
-
}
|
|
125
|
+
const artifactMode = getArtifactModeFromExportMode(exportMode);
|
|
123
126
|
|
|
124
127
|
/** @type {number | undefined} */
|
|
125
128
|
let savedBlockHeight;
|
|
@@ -140,7 +143,7 @@ export const initiateSwingStoreExport = (
|
|
|
140
143
|
const manifestFile = await open(manifestPath, 'wx');
|
|
141
144
|
cleanup.push(async () => manifestFile.close());
|
|
142
145
|
|
|
143
|
-
const swingStoreExporter = makeExporter(stateDir,
|
|
146
|
+
const swingStoreExporter = makeExporter(stateDir, { artifactMode });
|
|
144
147
|
cleanup.push(async () => swingStoreExporter.close());
|
|
145
148
|
|
|
146
149
|
const { hostStorage } = openDB(stateDir);
|
package/src/import-kernel-db.js
CHANGED
|
@@ -141,7 +141,11 @@ export const performStateSyncImport = async (
|
|
|
141
141
|
},
|
|
142
142
|
});
|
|
143
143
|
|
|
144
|
-
const
|
|
144
|
+
const artifactMode = includeHistorical
|
|
145
|
+
? 'debug' // for now don't enforce completeness but allow importing all provided artifacts
|
|
146
|
+
: 'operational';
|
|
147
|
+
|
|
148
|
+
const swingstore = await importDB(exporter, stateDir, { artifactMode });
|
|
145
149
|
|
|
146
150
|
const { hostStorage } = swingstore;
|
|
147
151
|
|