@agoric/cosmic-swingset 0.42.0-upgrade-17-dev-a1453b2.0 → 0.42.0-upgrade-18-dev-bf39b10.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/CHANGELOG.md CHANGED
@@ -3,7 +3,7 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- ## [0.42.0-u17.0](https://github.com/Agoric/agoric-sdk/compare/@agoric/cosmic-swingset@0.41.3...@agoric/cosmic-swingset@0.42.0-u17.0) (2024-09-17)
6
+ ## [0.42.0-u18.0](https://github.com/Agoric/agoric-sdk/compare/@agoric/cosmic-swingset@0.41.3...@agoric/cosmic-swingset@0.42.0-u18.0) (2024-10-31)
7
7
 
8
8
 
9
9
  ### ⚠ BREAKING CHANGES
@@ -24,6 +24,7 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
24
24
  * **cosmic-swingset:** Accept slogfile configuration in AG_COSMOS_INIT messages ([1c72193](https://github.com/Agoric/agoric-sdk/commit/1c72193c54126cff8a35f36b094743a415ab19aa))
25
25
  * **cosmic-swingset:** add begin block check and transaction ([#8432](https://github.com/Agoric/agoric-sdk/issues/8432)) ([a9d113a](https://github.com/Agoric/agoric-sdk/commit/a9d113a09dfd93889ae985533535df53fdc771e7))
26
26
  * **cosmic-swingset:** add JS upgrade plan handler stub ([655133e](https://github.com/Agoric/agoric-sdk/commit/655133ed909b5d632dc033e992214a7b6a1b5ab1))
27
+ * **cosmic-swingset:** add missing trigger events ([92f8dfd](https://github.com/Agoric/agoric-sdk/commit/92f8dfd9d204eedd3d999f732fc5779f47aa97a9))
27
28
  * **cosmic-swingset:** add repair-metadata snapshot restore option ([4fc0113](https://github.com/Agoric/agoric-sdk/commit/4fc01134fab9402d5916f0593728acce4697da9e))
28
29
  * **cosmic-swingset:** implement `ENACTED_UPGRADE` blocking send ([3825c17](https://github.com/Agoric/agoric-sdk/commit/3825c171f3528cd3c4e63e8aeb3363a3e88b75fc))
29
30
  * **cosmic-swingset:** replace import/export options ([0f01712](https://github.com/Agoric/agoric-sdk/commit/0f01712cadef12784afa547d568a6e77b9a83344))
@@ -50,6 +51,8 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
50
51
  * **cosmic-swingset:** backwards param compat in import/export ([bd49484](https://github.com/Agoric/agoric-sdk/commit/bd49484e5777b8675ed3be5e78e46f6a5d89b7db))
51
52
  * **cosmic-swingset:** call upgradeSwingset at startup ([c769606](https://github.com/Agoric/agoric-sdk/commit/c7696069d0bebaf039a2f3e1a45ebdd8dc5198a2))
52
53
  * **cosmic-swingset:** Exclude non-consensus configuration from bootstrap vat arguments ([08b3abb](https://github.com/Agoric/agoric-sdk/commit/08b3abb4d5ba183a45e84353406e67bbcc00a076)), closes [#9946](https://github.com/Agoric/agoric-sdk/issues/9946)
54
+ * **cosmic-swingset:** inject kernel upgrade events at a safe time ([5789fb6](https://github.com/Agoric/agoric-sdk/commit/5789fb68d316643906bc30506059a0a8c8874154))
55
+ * **cosmic-swingset:** installation publisher uses remotable storage messenger ([4f07d1c](https://github.com/Agoric/agoric-sdk/commit/4f07d1c82709b4572cc5e883679a30d57c827803))
53
56
  * **cosmic-swingset:** log level for swing-store export ([33c4a51](https://github.com/Agoric/agoric-sdk/commit/33c4a517f079c4ad17c30f9d1d13f181b06f112f))
54
57
  * **cosmic-swingset:** merge `coreProposals` from bootstrap and upgrade plan ([2b38ebc](https://github.com/Agoric/agoric-sdk/commit/2b38ebc378847a878725419db37580405df0a28e))
55
58
  * **cosmic-swingset:** only require vatconfig if uninitialized ([cfb72f3](https://github.com/Agoric/agoric-sdk/commit/cfb72f337cf650f303adfebaeffb1ee9ad0c0a92))
@@ -1,7 +1,7 @@
1
1
  #! /usr/bin/env node
2
+ /* eslint-env node */
2
3
  // @jessie-check
3
4
 
4
- /* global process require Buffer */
5
5
  // check-validator - Find if there is a validator that matches the current ag-chain-cosmos
6
6
  // Michael FIG <mfig@agoric.com>, 2021-06-25
7
7
  const oper = process.argv[2];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agoric/cosmic-swingset",
3
- "version": "0.42.0-upgrade-17-dev-a1453b2.0+a1453b2",
3
+ "version": "0.42.0-upgrade-18-dev-bf39b10.0+bf39b10",
4
4
  "description": "Agoric's Cosmos blockchain integration",
5
5
  "type": "module",
6
6
  "bin": {
@@ -22,25 +22,25 @@
22
22
  "author": "Agoric",
23
23
  "license": "Apache-2.0",
24
24
  "dependencies": {
25
- "@agoric/builders": "0.2.0-upgrade-17-dev-a1453b2.0+a1453b2",
26
- "@agoric/cosmos": "0.35.0-upgrade-17-dev-a1453b2.0+a1453b2",
27
- "@agoric/deploy-script-support": "0.10.4-upgrade-17-dev-a1453b2.0+a1453b2",
28
- "@agoric/internal": "0.4.0-upgrade-17-dev-a1453b2.0+a1453b2",
29
- "@agoric/store": "0.9.3-upgrade-17-dev-a1453b2.0+a1453b2",
30
- "@agoric/swing-store": "0.9.2-upgrade-17-dev-a1453b2.0+a1453b2",
31
- "@agoric/swingset-vat": "0.33.0-upgrade-17-dev-a1453b2.0+a1453b2",
32
- "@agoric/telemetry": "0.6.3-upgrade-17-dev-a1453b2.0+a1453b2",
33
- "@agoric/vm-config": "0.1.1-upgrade-17-dev-a1453b2.0+a1453b2",
34
- "@endo/bundle-source": "^3.4.0",
35
- "@endo/env-options": "^1.1.6",
36
- "@endo/errors": "^1.2.5",
37
- "@endo/far": "^1.1.5",
38
- "@endo/import-bundle": "^1.2.2",
39
- "@endo/init": "^1.1.4",
40
- "@endo/marshal": "^1.5.3",
41
- "@endo/nat": "^5.0.10",
42
- "@endo/patterns": "^1.4.3",
43
- "@endo/promise-kit": "^1.1.5",
25
+ "@agoric/builders": "0.2.0-upgrade-18-dev-bf39b10.0+bf39b10",
26
+ "@agoric/cosmos": "0.35.0-upgrade-18-dev-bf39b10.0+bf39b10",
27
+ "@agoric/deploy-script-support": "0.10.4-upgrade-18-dev-bf39b10.0+bf39b10",
28
+ "@agoric/internal": "0.4.0-upgrade-18-dev-bf39b10.0+bf39b10",
29
+ "@agoric/store": "0.9.3-upgrade-18-dev-bf39b10.0+bf39b10",
30
+ "@agoric/swing-store": "0.10.0-upgrade-18-dev-bf39b10.0+bf39b10",
31
+ "@agoric/swingset-vat": "0.33.0-upgrade-18-dev-bf39b10.0+bf39b10",
32
+ "@agoric/telemetry": "0.6.3-upgrade-18-dev-bf39b10.0+bf39b10",
33
+ "@agoric/vm-config": "0.1.1-upgrade-18-dev-bf39b10.0+bf39b10",
34
+ "@endo/bundle-source": "^3.4.2",
35
+ "@endo/env-options": "^1.1.7",
36
+ "@endo/errors": "^1.2.7",
37
+ "@endo/far": "^1.1.8",
38
+ "@endo/import-bundle": "^1.3.1",
39
+ "@endo/init": "^1.1.6",
40
+ "@endo/marshal": "^1.6.1",
41
+ "@endo/nat": "^5.0.12",
42
+ "@endo/patterns": "^1.4.6",
43
+ "@endo/promise-kit": "^1.1.7",
44
44
  "@iarna/toml": "^2.2.3",
45
45
  "@opentelemetry/api": "~1.3.0",
46
46
  "@opentelemetry/sdk-metrics": "~1.9.0",
@@ -69,7 +69,7 @@
69
69
  "timeout": "20m"
70
70
  },
71
71
  "typeCoverage": {
72
- "atLeast": 80.53
72
+ "atLeast": 80.55
73
73
  },
74
- "gitHead": "a1453b2877b017a7f5b43a92364067d001901953"
74
+ "gitHead": "bf39b100f0da4380bab0ce2464aaca1988f0b76a"
75
75
  }
@@ -1,3 +1,4 @@
1
+ /* eslint-env node */
1
2
  import {
2
3
  getEnvironmentOptionsList,
3
4
  getEnvironmentOption,
package/src/chain-main.js CHANGED
@@ -11,7 +11,7 @@ import { resolve as importMetaResolve } from 'import-meta-resolve';
11
11
  import tmp from 'tmp';
12
12
 
13
13
  import { Fail, q } from '@endo/errors';
14
- import { E } from '@endo/far';
14
+ import { E, Far } from '@endo/far';
15
15
  import { makeMarshal } from '@endo/marshal';
16
16
  import { isNat } from '@endo/nat';
17
17
  import { M, mustMatch } from '@endo/patterns';
@@ -432,9 +432,9 @@ export default async function main(progname, args, { env, homedir, agcc }) {
432
432
  }
433
433
  }
434
434
 
435
- const toStorage = message => {
435
+ const toStorage = Far('BridgeStorageHandler', message => {
436
436
  return doOutboundBridge(BridgeId.STORAGE, message);
437
- };
437
+ });
438
438
 
439
439
  const makeInstallationPublisher = () => {
440
440
  const installationStorageNode = makeChainStorageRoot(
@@ -1,5 +1,5 @@
1
1
  // @ts-check
2
- /* global process */
2
+ /* eslint-env node */
3
3
 
4
4
  // XXX the JSON configs specify that launching the chain requires @agoric/builders,
5
5
  // so let the JS tooling know about it by importing it here.
@@ -52,7 +52,8 @@ import { makeQueue, makeQueueStorageMock } from './helpers/make-queue.js';
52
52
  import { exportStorage } from './export-storage.js';
53
53
  import { parseLocatedJson } from './helpers/json.js';
54
54
 
55
- /** @import {RunPolicy} from '@agoric/swingset-vat' */
55
+ /** @import { Mailbox, RunPolicy, SwingSetConfig } from '@agoric/swingset-vat' */
56
+ /** @import { KVStore } from './helpers/bufferedStorage.js' */
56
57
 
57
58
  const console = anylogger('launch-chain');
58
59
  const blockManagerConsole = anylogger('block-manager');
@@ -74,8 +75,6 @@ const parseUpgradePlanInfo = (upgradePlan, prefix = '') => {
74
75
  return harden(upgradePlanInfo || {});
75
76
  };
76
77
 
77
- /** @import {SwingSetConfig} from '@agoric/swingset-vat' */
78
-
79
78
  /**
80
79
  * @typedef {object} CosmicSwingsetConfig
81
80
  * @property {import('@agoric/deploy-script-support/src/extract-proposal.js').ConfigProposal[]} [coreProposals]
@@ -96,7 +95,7 @@ const parseUpgradePlanInfo = (upgradePlan, prefix = '') => {
96
95
  const getHostKey = path => `host.${path}`;
97
96
 
98
97
  /**
99
- * @param {Map<*, *>} mailboxStorage
98
+ * @param {KVStore<Mailbox>} mailboxStorage
100
99
  * @param {((dstID: string, obj: any) => any)} bridgeOutbound
101
100
  * @param {SwingStoreKernelStorage} kernelStorage
102
101
  * @param {string | (() => string | Promise<string>)} vatconfig absolute path or thunk
@@ -216,7 +215,7 @@ export async function buildSwingset(
216
215
  }
217
216
 
218
217
  const pendingCoreProposals = await ensureSwingsetInitialized();
219
- upgradeSwingset(kernelStorage);
218
+ const { modified } = upgradeSwingset(kernelStorage);
220
219
  const controller = await makeSwingsetController(
221
220
  kernelStorage,
222
221
  deviceEndowments,
@@ -237,6 +236,7 @@ export async function buildSwingset(
237
236
  return {
238
237
  coreProposals: pendingCoreProposals,
239
238
  controller,
239
+ kernelHasUpgradeEvents: modified,
240
240
  mb: mailboxDevice,
241
241
  bridgeInbound: bridgeDevice.deliverInbound,
242
242
  timer: timerDevice,
@@ -409,6 +409,7 @@ export async function launch({
409
409
  const {
410
410
  coreProposals: bootstrapCoreProposals,
411
411
  controller,
412
+ kernelHasUpgradeEvents,
412
413
  mb,
413
414
  bridgeInbound,
414
415
  timer,
@@ -511,6 +512,14 @@ export async function launch({
511
512
  await commit();
512
513
  }
513
514
 
515
+ async function doKernelUpgradeEvents(inboundNum) {
516
+ controller.writeSlogObject({
517
+ type: 'cosmic-swingset-inject-kernel-upgrade-events',
518
+ inboundNum,
519
+ });
520
+ controller.injectQueuedUpgradeEvents();
521
+ }
522
+
514
523
  async function deliverInbound(sender, messages, ack, inboundNum) {
515
524
  Array.isArray(messages) || Fail`inbound given non-Array: ${messages}`;
516
525
  controller.writeSlogObject({
@@ -518,6 +527,8 @@ export async function launch({
518
527
  inboundNum,
519
528
  sender,
520
529
  count: messages.length,
530
+ messages,
531
+ ack,
521
532
  });
522
533
  if (!mb.deliverInbound(sender, messages, ack)) {
523
534
  return;
@@ -530,6 +541,7 @@ export async function launch({
530
541
  type: 'cosmic-swingset-bridge-inbound',
531
542
  inboundNum,
532
543
  source,
544
+ body,
533
545
  });
534
546
  if (!bridgeInbound) throw Fail`bridgeInbound undefined`;
535
547
  // console.log(`doBridgeInbound`);
@@ -538,7 +550,7 @@ export async function launch({
538
550
  bridgeInbound(source, body);
539
551
  }
540
552
 
541
- async function installBundle(bundleJson) {
553
+ async function installBundle(bundleJson, inboundNum) {
542
554
  let bundle;
543
555
  try {
544
556
  bundle = JSON.parse(bundleJson);
@@ -555,6 +567,13 @@ export async function launch({
555
567
 
556
568
  const { endoZipBase64Sha512 } = bundle;
557
569
 
570
+ controller.writeSlogObject({
571
+ type: 'cosmic-swingset-install-bundle',
572
+ inboundNum,
573
+ endoZipBase64Sha512,
574
+ error,
575
+ });
576
+
558
577
  if (installationPublisher === undefined) {
559
578
  return;
560
579
  }
@@ -630,8 +649,13 @@ export async function launch({
630
649
  break;
631
650
  }
632
651
 
652
+ case ActionType.KERNEL_UPGRADE_EVENTS: {
653
+ p = doKernelUpgradeEvents(inboundNum);
654
+ break;
655
+ }
656
+
633
657
  case ActionType.INSTALL_BUNDLE: {
634
- p = installBundle(action.bundle);
658
+ p = installBundle(action.bundle, inboundNum);
635
659
  break;
636
660
  }
637
661
 
@@ -700,6 +724,12 @@ export async function launch({
700
724
  // Then, update the timer device with the new external time, which might
701
725
  // push work onto the kernel run-queue (if any timers were ready to wake).
702
726
  const addedToQueue = timer.poll(blockTime);
727
+ controller.writeSlogObject({
728
+ type: 'cosmic-swingset-timer-poll',
729
+ blockHeight,
730
+ blockTime,
731
+ added: addedToQueue,
732
+ });
703
733
  console.debug(
704
734
  `polled; blockTime:${blockTime}, h:${blockHeight}; ADDED =`,
705
735
  addedToQueue,
@@ -935,6 +965,22 @@ export async function launch({
935
965
  await doBootstrap(action);
936
966
  }
937
967
 
968
+ // The reboot-time upgradeSwingset() may have generated some
969
+ // remediation events that need to be injected at the right
970
+ // time (after catchup, before proposals). Push them onto
971
+ // runThisBlock before anything else goes there.
972
+ if (kernelHasUpgradeEvents) {
973
+ isBootstrap ||
974
+ upgradeDetails ||
975
+ Fail`Unexpected kernel upgrade events outside of consensus start`;
976
+ const txHash = 'x/kernel-upgrade-events';
977
+ const context = { blockHeight, txHash, msgIdx: 0 };
978
+ runThisBlock.push({
979
+ action: { type: ActionType.KERNEL_UPGRADE_EVENTS },
980
+ context,
981
+ });
982
+ }
983
+
938
984
  // Concatenate together any pending core proposals from chain bootstrap
939
985
  // with any from this inbound init action, then execute them all.
940
986
  const coreProposals = mergeCoreProposals(
package/src/sim-chain.js CHANGED
@@ -1,4 +1,4 @@
1
- /* global process setTimeout clearTimeout */
1
+ /* eslint-env node */
2
2
  import path from 'path';
3
3
  import fs from 'fs';
4
4
  import { Fail } from '@endo/errors';