@agoric/cosmic-swingset 0.41.4-dev-7ffae88.0 → 0.41.4-dev-32c4d68.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 CHANGED
@@ -73,7 +73,7 @@ start-amm-etc: $(INTER_PROTO)/gov-amm-vaults-etc.js
73
73
 
74
74
  gov-q:
75
75
  $(AGCH) query gov proposals --output json | \
76
- jq -c '.proposals[] | [.proposal_id,.voting_end_time,.status]'
76
+ jq -c '.proposals[] | [if .proposal_id == null then .id else .proposal_id end,.voting_end_time,.status]'
77
77
 
78
78
  # This probably shouldn't install, but that's what published instructions
79
79
  # expect.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agoric/cosmic-swingset",
3
- "version": "0.41.4-dev-7ffae88.0+7ffae88",
3
+ "version": "0.41.4-dev-32c4d68.0+32c4d68",
4
4
  "description": "Agoric's Cosmos blockchain integration",
5
5
  "type": "module",
6
6
  "bin": {
@@ -22,24 +22,24 @@
22
22
  "author": "Agoric",
23
23
  "license": "Apache-2.0",
24
24
  "dependencies": {
25
- "@agoric/assert": "0.6.1-dev-7ffae88.0+7ffae88",
26
- "@agoric/builders": "0.1.1-dev-7ffae88.0+7ffae88",
27
- "@agoric/cosmos": "0.34.2-dev-7ffae88.0+7ffae88",
28
- "@agoric/deploy-script-support": "0.10.4-dev-7ffae88.0+7ffae88",
29
- "@agoric/internal": "0.3.3-dev-7ffae88.0+7ffae88",
30
- "@agoric/store": "0.9.3-dev-7ffae88.0+7ffae88",
31
- "@agoric/swing-store": "0.9.2-dev-7ffae88.0+7ffae88",
32
- "@agoric/swingset-vat": "0.32.3-dev-7ffae88.0+7ffae88",
33
- "@agoric/telemetry": "0.6.3-dev-7ffae88.0+7ffae88",
34
- "@agoric/vm-config": "0.1.1-dev-7ffae88.0+7ffae88",
35
- "@endo/bundle-source": "^3.0.2",
36
- "@endo/env-options": "^1.1.0",
37
- "@endo/far": "^1.0.2",
38
- "@endo/import-bundle": "^1.0.2",
39
- "@endo/init": "^1.0.2",
40
- "@endo/marshal": "^1.1.0",
41
- "@endo/nat": "^5.0.2",
42
- "@endo/promise-kit": "^1.0.2",
25
+ "@agoric/assert": "0.6.1-dev-32c4d68.0+32c4d68",
26
+ "@agoric/builders": "0.1.1-dev-32c4d68.0+32c4d68",
27
+ "@agoric/cosmos": "0.34.2-dev-32c4d68.0+32c4d68",
28
+ "@agoric/deploy-script-support": "0.10.4-dev-32c4d68.0+32c4d68",
29
+ "@agoric/internal": "0.3.3-dev-32c4d68.0+32c4d68",
30
+ "@agoric/store": "0.9.3-dev-32c4d68.0+32c4d68",
31
+ "@agoric/swing-store": "0.9.2-dev-32c4d68.0+32c4d68",
32
+ "@agoric/swingset-vat": "0.32.3-dev-32c4d68.0+32c4d68",
33
+ "@agoric/telemetry": "0.6.3-dev-32c4d68.0+32c4d68",
34
+ "@agoric/vm-config": "0.1.1-dev-32c4d68.0+32c4d68",
35
+ "@endo/bundle-source": "^3.1.0",
36
+ "@endo/env-options": "^1.1.1",
37
+ "@endo/far": "^1.0.4",
38
+ "@endo/import-bundle": "^1.0.4",
39
+ "@endo/init": "^1.0.4",
40
+ "@endo/marshal": "^1.3.0",
41
+ "@endo/nat": "^5.0.4",
42
+ "@endo/promise-kit": "^1.0.4",
43
43
  "@iarna/toml": "^2.2.3",
44
44
  "@opentelemetry/api": "~1.3.0",
45
45
  "@opentelemetry/sdk-metrics": "~1.9.0",
@@ -68,7 +68,7 @@
68
68
  "timeout": "20m"
69
69
  },
70
70
  "typeCoverage": {
71
- "atLeast": 79.32
71
+ "atLeast": 79.84
72
72
  },
73
- "gitHead": "7ffae88ae37df782d5ffe3cf92261a498b0f636c"
73
+ "gitHead": "32c4d68c5f675f1e8fea1a8bc08621816e7b491e"
74
74
  }
package/src/chain-main.js CHANGED
@@ -30,7 +30,7 @@ import { makeShutdown } from '@agoric/internal/src/node/shutdown.js';
30
30
 
31
31
  import * as STORAGE_PATH from '@agoric/internal/src/chain-storage-paths.js';
32
32
  import * as ActionType from '@agoric/internal/src/action-types.js';
33
- import { BridgeId as BRIDGE_ID } from '@agoric/internal';
33
+ import { BridgeId, CosmosInitKeyToBridgeId } from '@agoric/internal';
34
34
  import {
35
35
  makeBufferedStorage,
36
36
  makeReadCachingStorage,
@@ -53,6 +53,8 @@ let whenHellFreezesOver = null;
53
53
 
54
54
  const TELEMETRY_SERVICE_NAME = 'agd-cosmos';
55
55
 
56
+ const PORT_SUFFIX = 'Port';
57
+
56
58
  const toNumber = specimen => {
57
59
  const number = parseInt(specimen, 10);
58
60
  String(number) === String(specimen) ||
@@ -319,12 +321,16 @@ export default async function main(progname, args, { env, homedir, agcc }) {
319
321
  function doOutboundBridge(dstID, msg) {
320
322
  const portNum = portNums[dstID];
321
323
  if (portNum === undefined) {
324
+ const portKey =
325
+ Object.keys(CosmosInitKeyToBridgeId).find(
326
+ key => CosmosInitKeyToBridgeId[key] === dstID,
327
+ ) || `${dstID}${PORT_SUFFIX}`;
322
328
  console.error(
323
- `warning: doOutboundBridge called before AG_COSMOS_INIT gave us ${dstID}`,
329
+ `warning: doOutboundBridge called before AG_COSMOS_INIT gave us ${portKey}`,
324
330
  );
325
331
  // it is dark, and your exception is likely to be eaten by a vat
326
332
  throw Error(
327
- `warning: doOutboundBridge called before AG_COSMOS_INIT gave us ${dstID}`,
333
+ `warning: doOutboundBridge called before AG_COSMOS_INIT gave us ${portKey}`,
328
334
  );
329
335
  }
330
336
  const respStr = chainSend(portNum, stringify(msg));
@@ -336,7 +342,7 @@ export default async function main(progname, args, { env, homedir, agcc }) {
336
342
  }
337
343
 
338
344
  const toStorage = message => {
339
- return doOutboundBridge(BRIDGE_ID.STORAGE, message);
345
+ return doOutboundBridge(BridgeId.STORAGE, message);
340
346
  };
341
347
 
342
348
  const makeInstallationPublisher = () => {
@@ -652,24 +658,17 @@ export default async function main(progname, args, { env, homedir, agcc }) {
652
658
 
653
659
  !blockingSend || Fail`Swingset already initialized`;
654
660
 
655
- if (action.swingsetPort) {
656
- portNums.swingset = action.swingsetPort;
657
- }
658
-
659
- if (action.vibcPort) {
660
- portNums.dibc = action.vibcPort;
661
- }
662
-
663
- if (action.storagePort) {
664
- portNums.storage = action.storagePort;
665
- }
666
-
667
- if (action.vbankPort) {
668
- portNums.bank = action.vbankPort;
669
- }
670
-
671
- if (action.lienPort) {
672
- portNums.lien = action.lienPort;
661
+ for (const [key, value] of Object.entries(action)) {
662
+ const portAlias = CosmosInitKeyToBridgeId[key];
663
+ if (portAlias) {
664
+ // Use the alias if it exists.
665
+ portNums[portAlias] = value;
666
+ } else if (key.endsWith(PORT_SUFFIX)) {
667
+ // Anything else that ends in the suffix is assumed to be a port
668
+ // number, as described in app.go/cosmosInitAction.
669
+ const portName = key.slice(0, key.length - PORT_SUFFIX.length);
670
+ portNums[portName] = value;
671
+ }
673
672
  }
674
673
  harden(portNums);
675
674
 
@@ -1083,6 +1083,8 @@ export async function launch({
1083
1083
  controller.writeSlogObject(obj);
1084
1084
  }
1085
1085
 
1086
+ console.info('Launched SwingSet kernel');
1087
+
1086
1088
  return {
1087
1089
  blockingSend,
1088
1090
  shutdown,
package/src/params.js CHANGED
@@ -29,7 +29,10 @@ export const encodeQueueSizes = queueSizes =>
29
29
  return { key, size };
30
30
  });
31
31
 
32
- // Map the SwingSet parameters to a deterministic data structure.
32
+ /**
33
+ * Map the SwingSet parameters to a deterministic data structure.
34
+ * @param {import('@agoric/cosmic-proto/dist/codegen/agoric/swingset/swingset.js').ParamsSDKType} params
35
+ */
33
36
  export const parseParams = params => {
34
37
  const {
35
38
  beans_per_unit: rawBeansPerUnit,
package/src/sim-params.js CHANGED
@@ -1,9 +1,9 @@
1
1
  // @jessie-check
2
+ // @ts-check
2
3
 
3
4
  import { Nat } from '@endo/nat';
4
5
 
5
6
  const makeStringBeans = (key, beans) => ({ key, beans: `${Nat(beans)}` });
6
- const makePowerFlagFee = (powerFlag, fee) => ({ powerFlag, fee });
7
7
  const makeCoin = (denom, amount) => ({ denom, amount: `${Nat(amount)}` });
8
8
  /**
9
9
  * @param {string} key
@@ -63,8 +63,9 @@ export const defaultBeansPerUnit = [
63
63
  const defaultBootstrapVatConfig =
64
64
  '@agoric/vm-config/decentral-demo-config.json';
65
65
 
66
+ /** @type {import('@agoric/cosmic-proto/dist/codegen/agoric/swingset/swingset.js').PowerFlagFeeSDKType[]} */
66
67
  export const defaultPowerFlagFees = [
67
- makePowerFlagFee('SMART_WALLET', [makeCoin('ubld', 10_000_000n)]),
68
+ { power_flag: 'SMART_WALLET', fee: [makeCoin('ubld', 10_000_000n)] },
68
69
  ];
69
70
 
70
71
  export const QueueInbound = 'inbound';
@@ -75,6 +76,9 @@ export const defaultQueueMax = [
75
76
  makeQueueSize(QueueInbound, defaultInboundQueueMax),
76
77
  ];
77
78
 
79
+ /**
80
+ * @type {import('@agoric/cosmic-proto/dist/codegen/agoric/swingset/swingset.js').ParamsSDKType}
81
+ */
78
82
  export const DEFAULT_SIM_SWINGSET_PARAMS = {
79
83
  beans_per_unit: defaultBeansPerUnit,
80
84
  fee_unit_price: defaultFeeUnitPrice,