@agoric/orchestration 0.2.0-upgrade-17-dev-a61cdab.0 → 0.2.0-upgrade-17-dev-ec448b0.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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agoric/orchestration",
3
- "version": "0.2.0-upgrade-17-dev-a61cdab.0+a61cdab",
3
+ "version": "0.2.0-upgrade-17-dev-ec448b0.0+ec448b0",
4
4
  "description": "Chain abstraction for Agoric's orchestration clients",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -33,19 +33,19 @@
33
33
  },
34
34
  "homepage": "https://github.com/Agoric/agoric-sdk#readme",
35
35
  "dependencies": {
36
- "@agoric/async-flow": "0.1.1-upgrade-17-dev-a61cdab.0+a61cdab",
37
- "@agoric/cosmic-proto": "0.5.0-upgrade-17-dev-a61cdab.0+a61cdab",
38
- "@agoric/ertp": "0.16.3-upgrade-17-dev-a61cdab.0+a61cdab",
39
- "@agoric/internal": "0.4.0-upgrade-17-dev-a61cdab.0+a61cdab",
40
- "@agoric/network": "0.2.0-upgrade-17-dev-a61cdab.0+a61cdab",
41
- "@agoric/notifier": "0.7.0-upgrade-17-dev-a61cdab.0+a61cdab",
42
- "@agoric/store": "0.9.3-upgrade-17-dev-a61cdab.0+a61cdab",
43
- "@agoric/time": "0.3.3-upgrade-17-dev-a61cdab.0+a61cdab",
44
- "@agoric/vat-data": "0.5.3-upgrade-17-dev-a61cdab.0+a61cdab",
45
- "@agoric/vats": "0.16.0-upgrade-17-dev-a61cdab.0+a61cdab",
46
- "@agoric/vow": "0.2.0-upgrade-17-dev-a61cdab.0+a61cdab",
47
- "@agoric/zoe": "0.26.3-upgrade-17-dev-a61cdab.0+a61cdab",
48
- "@agoric/zone": "0.3.0-upgrade-17-dev-a61cdab.0+a61cdab",
36
+ "@agoric/async-flow": "0.1.1-upgrade-17-dev-ec448b0.0+ec448b0",
37
+ "@agoric/cosmic-proto": "0.5.0-upgrade-17-dev-ec448b0.0+ec448b0",
38
+ "@agoric/ertp": "0.16.3-upgrade-17-dev-ec448b0.0+ec448b0",
39
+ "@agoric/internal": "0.4.0-upgrade-17-dev-ec448b0.0+ec448b0",
40
+ "@agoric/network": "0.2.0-upgrade-17-dev-ec448b0.0+ec448b0",
41
+ "@agoric/notifier": "0.7.0-upgrade-17-dev-ec448b0.0+ec448b0",
42
+ "@agoric/store": "0.9.3-upgrade-17-dev-ec448b0.0+ec448b0",
43
+ "@agoric/time": "0.3.3-upgrade-17-dev-ec448b0.0+ec448b0",
44
+ "@agoric/vat-data": "0.5.3-upgrade-17-dev-ec448b0.0+ec448b0",
45
+ "@agoric/vats": "0.16.0-upgrade-17-dev-ec448b0.0+ec448b0",
46
+ "@agoric/vow": "0.2.0-upgrade-17-dev-ec448b0.0+ec448b0",
47
+ "@agoric/zoe": "0.26.3-upgrade-17-dev-ec448b0.0+ec448b0",
48
+ "@agoric/zone": "0.3.0-upgrade-17-dev-ec448b0.0+ec448b0",
49
49
  "@endo/base64": "^1.0.7",
50
50
  "@endo/errors": "^1.2.5",
51
51
  "@endo/far": "^1.1.5",
@@ -54,7 +54,7 @@
54
54
  "@noble/hashes": "^1.5.0"
55
55
  },
56
56
  "devDependencies": {
57
- "@agoric/swingset-liveslots": "0.10.3-upgrade-17-dev-a61cdab.0+a61cdab",
57
+ "@agoric/swingset-liveslots": "0.10.3-upgrade-17-dev-ec448b0.0+ec448b0",
58
58
  "@chain-registry/client": "^1.47.4",
59
59
  "@cosmjs/amino": "^0.32.3",
60
60
  "@cosmjs/proto-signing": "^0.32.3",
@@ -94,5 +94,5 @@
94
94
  "typeCoverage": {
95
95
  "atLeast": 97.57
96
96
  },
97
- "gitHead": "a61cdabb23bd2c846e003dee7326018a7462a929"
97
+ "gitHead": "ec448b081ac21cbe217f210e06f0b8f7989e73d6"
98
98
  }
@@ -0,0 +1,12 @@
1
+ export function initChainInfo({ consume: { agoricNamesAdmin, chainStorage: chainStorageP }, }: BootstrapPowers): Promise<void>;
2
+ export function getManifestForChainInfo(): {
3
+ manifest: {
4
+ [x: string]: {
5
+ consume: {
6
+ agoricNamesAdmin: boolean;
7
+ chainStorage: boolean;
8
+ };
9
+ };
10
+ };
11
+ };
12
+ //# sourceMappingURL=init-chain-info.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"init-chain-info.d.ts","sourceRoot":"","sources":["init-chain-info.js"],"names":[],"mappings":"AA2EO,+FAFI,eAAe,iBAYzB;AAGM;;;;;;;;;EASL"}
@@ -0,0 +1,98 @@
1
+ import { Fail } from '@endo/errors';
2
+ import { E, Far } from '@endo/far';
3
+ import { makeMarshal } from '@endo/marshal';
4
+ import { makeTracer } from '@agoric/internal';
5
+ import { registerKnownChains } from '../chain-info.js';
6
+ import { CHAIN_KEY, CONNECTIONS_KEY } from '../exos/chain-hub.js';
7
+
8
+ const trace = makeTracer('InitChainInfo', true);
9
+
10
+ /**
11
+ * Similar to publishAgoricNamesToChainStorage but publishes a node per chain
12
+ * instead of one list of entries
13
+ */
14
+
15
+ /**
16
+ * @param {ERef<import('@agoric/vats').NameHubKit['nameAdmin']>} agoricNamesAdmin
17
+ * @param {ERef<StorageNode | null>} chainStorageP
18
+ */
19
+ const publishChainInfoToChainStorage = async (
20
+ agoricNamesAdmin,
21
+ chainStorageP,
22
+ ) => {
23
+ const chainStorage = await chainStorageP;
24
+ if (!chainStorage) {
25
+ console.warn('no chain storage, not registering chain info');
26
+ return;
27
+ }
28
+
29
+ const agoricNamesNode = await E(chainStorage).makeChildNode('agoricNames');
30
+
31
+ /**
32
+ * @param {string} subpath
33
+ */
34
+ const echoNameUpdates = async subpath => {
35
+ const chainNamesNode = E(agoricNamesNode).makeChildNode(subpath);
36
+ const { nameAdmin } = await E(agoricNamesAdmin).provideChild(subpath);
37
+
38
+ /**
39
+ * Previous entries, to prevent redundant updates
40
+ *
41
+ * @type {Record<string, string>} chainName => stringified chainInfo
42
+ */
43
+ const prev = {};
44
+
45
+ // XXX cannot be changed until we upgrade vat-agoricNames to allow it
46
+ await E(nameAdmin).onUpdate(
47
+ // XXX will live on the heap in the bootstrap vat. When we upgrade or kill
48
+ // that this handler will sever and vat-agoricNames will need to be upgraded
49
+ // to allow changing the handler, or to use pubsub mechanics instead.
50
+ Far('chain info writer', {
51
+ write(entries) {
52
+ // chainInfo has no cap data but we need to marshal bigints
53
+ const marshalData = makeMarshal(_val => Fail`data only`);
54
+ for (const [chainName, info] of entries) {
55
+ const value = JSON.stringify(marshalData.toCapData(info));
56
+ if (prev[chainName] === value) {
57
+ continue;
58
+ }
59
+ const chainNode = E(chainNamesNode).makeChildNode(chainName);
60
+ prev[chainName] = value;
61
+ void E(chainNode)
62
+ .setValue(value)
63
+ .catch(() => delete prev[chainName]);
64
+ }
65
+ },
66
+ }),
67
+ );
68
+ };
69
+ await echoNameUpdates(CHAIN_KEY);
70
+ await echoNameUpdates(CONNECTIONS_KEY);
71
+ };
72
+
73
+ /**
74
+ * @param {BootstrapPowers} powers
75
+ */
76
+ export const initChainInfo = async ({
77
+ consume: { agoricNamesAdmin, chainStorage: chainStorageP },
78
+ }) => {
79
+ trace('init-chainInfo');
80
+
81
+ // First set up callback to write updates to vstorage
82
+ await publishChainInfoToChainStorage(agoricNamesAdmin, chainStorageP);
83
+
84
+ // Now register the names
85
+ await registerKnownChains(agoricNamesAdmin, trace);
86
+ };
87
+ harden(initChainInfo);
88
+
89
+ export const getManifestForChainInfo = () => ({
90
+ manifest: {
91
+ [initChainInfo.name]: {
92
+ consume: {
93
+ agoricNamesAdmin: true,
94
+ chainStorage: true,
95
+ },
96
+ },
97
+ },
98
+ });
@@ -5,12 +5,11 @@ export function setupOrchestrationVat({ consume: { loadCriticalVat, portAllocato
5
5
  produce: {
6
6
  orchestrationVat: Producer<any>;
7
7
  };
8
- }, options: {
8
+ }, { options }: {
9
9
  options: {
10
10
  orchestrationRef: VatSourceRef;
11
11
  };
12
12
  }): Promise<void>;
13
- export function initChainInfo({ consume: { agoricNamesAdmin, chainStorage: chainStorageP }, }: BootstrapPowers): Promise<void>;
14
13
  export function getManifestForOrchestration(_powers: any, { orchestrationRef }: {
15
14
  orchestrationRef: any;
16
15
  }): {
@@ -19,21 +18,11 @@ export function getManifestForOrchestration(_powers: any, { orchestrationRef }:
19
18
  consume: {
20
19
  loadCriticalVat: boolean;
21
20
  portAllocator: string;
22
- agoricNamesAdmin?: undefined;
23
- chainStorage?: undefined;
24
21
  };
25
22
  produce: {
26
23
  cosmosInterchainService: string;
27
24
  orchestrationVat: string;
28
25
  };
29
- } | {
30
- consume: {
31
- agoricNamesAdmin: boolean;
32
- chainStorage: boolean;
33
- loadCriticalVat?: undefined;
34
- portAllocator?: undefined;
35
- };
36
- produce?: undefined;
37
26
  };
38
27
  };
39
28
  options: {
@@ -1 +1 @@
1
- {"version":3,"file":"orchestration-proposal.d.ts","sourceRoot":"","sources":["orchestration-proposal.js"],"names":[],"mappings":"AAwBO,mJAVI,eAAe,GAAG;IAC5B,OAAW,EAAE;QACb,aAAmB,EAAE,aAAa,CAAC;KAC9B,CAAC;IACN,OAAW,EAAE;QACb,gBAAsB,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC;KACjC,CAAC;CACH,WACO;IAAE,OAAO,EAAE;QAAE,gBAAgB,EAAE,YAAY,CAAA;KAAE,CAAA;CAAE,iBA6BzD;AAoEM,+FAFI,eAAe,iBAYzB;AAGM;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsBL;mCAhJ8B,iBAAiB"}
1
+ {"version":3,"file":"orchestration-proposal.d.ts","sourceRoot":"","sources":["orchestration-proposal.js"],"names":[],"mappings":"AAoBO,mJAVI,eAAe,GAAG;IAC5B,OAAW,EAAE;QACb,aAAmB,EAAE,aAAa,CAAC;KAC9B,CAAC;IACN,OAAW,EAAE;QACb,gBAAsB,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC;KACjC,CAAC;CACH,eACO;IAAE,OAAO,EAAE;QAAE,gBAAgB,EAAE,YAAY,CAAA;KAAE,CAAA;CAAE,iBAgCzD;AAEM;;;;;;;;;;;;;;;;;;EAgBL;mCA9D8B,iBAAiB"}
@@ -1,9 +1,5 @@
1
- import { Fail } from '@endo/errors';
2
- import { E, Far } from '@endo/far';
3
- import { makeMarshal } from '@endo/marshal';
4
1
  import { makeTracer } from '@agoric/internal';
5
- import { registerKnownChains } from '../chain-info.js';
6
- import { CHAIN_KEY, CONNECTIONS_KEY } from '../exos/chain-hub.js';
2
+ import { E } from '@endo/far';
7
3
 
8
4
  const trace = makeTracer('CoreEvalOrchestration', true);
9
5
 
@@ -27,14 +23,16 @@ export const setupOrchestrationVat = async (
27
23
  consume: { loadCriticalVat, portAllocator: portAllocatorP },
28
24
  produce: { orchestrationVat, ...produce },
29
25
  },
30
- options,
26
+ { options },
31
27
  ) => {
32
- const { orchestrationRef } = options.options;
28
+ trace('setupOrchestrationVat', options);
29
+ const { orchestrationRef } = options;
33
30
  const vats = {
34
31
  orchestration: E(loadCriticalVat)('orchestration', orchestrationRef),
35
32
  };
36
33
  // don't proceed if loadCriticalVat fails
37
34
  await Promise.all(Object.values(vats));
35
+ trace('setupOrchestrationVat got vats');
38
36
 
39
37
  orchestrationVat.reset();
40
38
  orchestrationVat.resolve(vats.orchestration);
@@ -49,87 +47,9 @@ export const setupOrchestrationVat = async (
49
47
 
50
48
  produce.cosmosInterchainService.reset();
51
49
  produce.cosmosInterchainService.resolve(cosmosInterchainService);
50
+ trace('setupOrchestrationVat complete');
52
51
  };
53
52
 
54
- /**
55
- * Similar to publishAgoricNamesToChainStorage but publishes a node per chain
56
- * instead of one list of entries
57
- */
58
-
59
- /**
60
- * @param {ERef<import('@agoric/vats').NameHubKit['nameAdmin']>} agoricNamesAdmin
61
- * @param {ERef<StorageNode | null>} chainStorageP
62
- */
63
- const publishChainInfoToChainStorage = async (
64
- agoricNamesAdmin,
65
- chainStorageP,
66
- ) => {
67
- const chainStorage = await chainStorageP;
68
- if (!chainStorage) {
69
- console.warn('no chain storage, not registering chain info');
70
- return;
71
- }
72
-
73
- const agoricNamesNode = await E(chainStorage).makeChildNode('agoricNames');
74
-
75
- /**
76
- * @param {string} subpath
77
- */
78
- const echoNameUpdates = async subpath => {
79
- const chainNamesNode = E(agoricNamesNode).makeChildNode(subpath);
80
- const { nameAdmin } = await E(agoricNamesAdmin).provideChild(subpath);
81
-
82
- /**
83
- * Previous entries, to prevent redundant updates
84
- *
85
- * @type {Record<string, string>} chainName => stringified chainInfo
86
- */
87
- const prev = {};
88
-
89
- // XXX cannot be changed until we upgrade vat-agoricNames to allow it
90
- await E(nameAdmin).onUpdate(
91
- // XXX will live on the heap in the bootstrap vat. When we upgrade or kill
92
- // that this handler will sever and vat-agoricNames will need to be upgraded
93
- // to allow changing the handler, or to use pubsub mechanics instead.
94
- Far('chain info writer', {
95
- write(entries) {
96
- // chainInfo has no cap data but we need to marshal bigints
97
- const marshalData = makeMarshal(_val => Fail`data only`);
98
- for (const [chainName, info] of entries) {
99
- const value = JSON.stringify(marshalData.toCapData(info));
100
- if (prev[chainName] === value) {
101
- continue;
102
- }
103
- const chainNode = E(chainNamesNode).makeChildNode(chainName);
104
- prev[chainName] = value;
105
- void E(chainNode)
106
- .setValue(value)
107
- .catch(() => delete prev[chainName]);
108
- }
109
- },
110
- }),
111
- );
112
- };
113
- await echoNameUpdates(CHAIN_KEY);
114
- await echoNameUpdates(CONNECTIONS_KEY);
115
- };
116
-
117
- /**
118
- * @param {BootstrapPowers} powers
119
- */
120
- export const initChainInfo = async ({
121
- consume: { agoricNamesAdmin, chainStorage: chainStorageP },
122
- }) => {
123
- trace('init-chainInfo');
124
-
125
- // First set up callback to write updates to vstorage
126
- await publishChainInfoToChainStorage(agoricNamesAdmin, chainStorageP);
127
-
128
- // Now register the names
129
- await registerKnownChains(agoricNamesAdmin, trace);
130
- };
131
- harden(initChainInfo);
132
-
133
53
  export const getManifestForOrchestration = (_powers, { orchestrationRef }) => ({
134
54
  manifest: {
135
55
  [setupOrchestrationVat.name]: {
@@ -142,12 +62,6 @@ export const getManifestForOrchestration = (_powers, { orchestrationRef }) => ({
142
62
  orchestrationVat: 'orchestrationVat',
143
63
  },
144
64
  },
145
- [initChainInfo.name]: {
146
- consume: {
147
- agoricNamesAdmin: true,
148
- chainStorage: true,
149
- },
150
- },
151
65
  },
152
66
  options: {
153
67
  orchestrationRef,