@agoric/builders 0.2.0-u18.5 → 0.2.0-u18.6
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 +35 -0
- package/package.json +30 -28
- package/scripts/fast-usdc/fast-usdc-update.build.js +61 -0
- package/scripts/fast-usdc/init-fast-usdc.js +197 -0
- package/scripts/inter-protocol/replace-feeDistributor.js +28 -0
- package/scripts/orchestration/init-basic-flows.js +42 -2
- package/scripts/testing/add-USD-LEMONS.js +19 -0
- package/scripts/testing/add-USD-OLIVES.js +19 -0
- package/scripts/testing/init-auto-stake-it.js +73 -0
- package/scripts/testing/init-send-anywhere.js +67 -0
- package/scripts/testing/publish-test-info.js +79 -0
- package/scripts/testing/recorded-retired-instances.js +9 -0
- package/scripts/testing/register-interchain-bank-assets.js +199 -0
- package/scripts/testing/replace-feeDistributor-short.js +33 -0
- package/scripts/testing/test-upgraded-board.js +15 -0
- package/scripts/testing/{fix-buggy-sendAnywhere.js → upgrade-send-anywhere.js} +14 -18
- package/scripts/testing/upgrade-vaultFactory.js +21 -0
- package/scripts/vats/terminate-governor-instance.js +134 -0
- package/scripts/vats/upgrade-agoricNames.js +21 -0
- package/scripts/vats/upgrade-asset-reserve.js +21 -0
- package/scripts/vats/upgrade-board.js +20 -0
- package/scripts/vats/upgrade-mintHolder.js +126 -0
- package/scripts/vats/{upgrade-orch-core.js → upgrade-orchestration.js} +5 -2
- package/scripts/vats/upgrade-paRegistry.js +21 -0
- package/scripts/testing/start-auto-stake-it.js +0 -128
- package/scripts/testing/start-buggy-sendAnywhere.js +0 -143
- package/scripts/testing/start-send-anywhere.js +0 -136
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { makeTracer } from '@agoric/internal';
|
|
2
|
+
import { E, Far } from '@endo/far';
|
|
3
|
+
import { makeMarshal } from '@endo/marshal';
|
|
4
|
+
|
|
5
|
+
const trace = makeTracer('PublishTestInfo');
|
|
6
|
+
const { Fail } = assert;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @param {BootstrapPowers} powers
|
|
10
|
+
*/
|
|
11
|
+
export const publishTestInfo = async powers => {
|
|
12
|
+
const {
|
|
13
|
+
consume: { agoricNamesAdmin, chainStorage: chainStorageP },
|
|
14
|
+
} = powers;
|
|
15
|
+
|
|
16
|
+
const chainStorage = await chainStorageP;
|
|
17
|
+
if (!chainStorage) {
|
|
18
|
+
trace('no chain storage, not registering chain info');
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
trace('publishing testInfo');
|
|
23
|
+
const agoricNamesNode = E(chainStorage).makeChildNode('agoricNames');
|
|
24
|
+
const testInfoNode = E(agoricNamesNode).makeChildNode('testInfo');
|
|
25
|
+
const { nameAdmin } = await E(agoricNamesAdmin).provideChild('testInfo');
|
|
26
|
+
|
|
27
|
+
trace('registering onUpdate...');
|
|
28
|
+
await E(nameAdmin).onUpdate(
|
|
29
|
+
Far('chain info writer', {
|
|
30
|
+
write(entries) {
|
|
31
|
+
const marshalData = makeMarshal(_val => Fail`data only`);
|
|
32
|
+
const value = JSON.stringify(marshalData.toCapData(entries));
|
|
33
|
+
void E(testInfoNode)
|
|
34
|
+
.setValue(value)
|
|
35
|
+
.catch(() =>
|
|
36
|
+
console.log('cannot update vstorage after write to testInfo'),
|
|
37
|
+
);
|
|
38
|
+
},
|
|
39
|
+
}),
|
|
40
|
+
);
|
|
41
|
+
|
|
42
|
+
trace('writing to testInfo...');
|
|
43
|
+
await E(nameAdmin).update('agoric', {
|
|
44
|
+
isAwesome: 'yes',
|
|
45
|
+
tech: ['HardenedJs', 'Orchestration', 'Async_Execution'],
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
trace('Done.');
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export const getManifestForPublishTestInfo = () => {
|
|
52
|
+
return {
|
|
53
|
+
manifest: {
|
|
54
|
+
[publishTestInfo.name]: {
|
|
55
|
+
consume: {
|
|
56
|
+
agoricNamesAdmin: true,
|
|
57
|
+
chainStorage: true,
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */
|
|
65
|
+
export const defaultProposalBuilder = async () =>
|
|
66
|
+
harden({
|
|
67
|
+
// Somewhat unorthodox, source the exports from this builder module
|
|
68
|
+
sourceSpec: '@agoric/builders/scripts/testing/publish-test-info.js',
|
|
69
|
+
getManifestCall: ['getManifestForPublishTestInfo'],
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').DeployScriptFunction} */
|
|
73
|
+
export default async (homeP, endowments) => {
|
|
74
|
+
// import dynamically so the module can work in CoreEval environment
|
|
75
|
+
const dspModule = await import('@agoric/deploy-script-support');
|
|
76
|
+
const { makeHelpers } = dspModule;
|
|
77
|
+
const { writeCoreEval } = await makeHelpers(homeP, endowments);
|
|
78
|
+
await writeCoreEval('publish-test-info', defaultProposalBuilder);
|
|
79
|
+
};
|
|
@@ -33,9 +33,18 @@ export const testRecordedRetiredInstances = async ({
|
|
|
33
33
|
);
|
|
34
34
|
assert(committeeIDs);
|
|
35
35
|
assert(committeeIDs.length === 1);
|
|
36
|
+
trace('found committeeIDs', committeeIDs);
|
|
37
|
+
|
|
36
38
|
const committeeInstance = retiredContractInstances.get(committeeIDs[0]);
|
|
37
39
|
assert(await E(contractKits).get(committeeInstance));
|
|
38
40
|
|
|
41
|
+
const charterIDs = [...retiredContractInstances.keys()].filter(k =>
|
|
42
|
+
k.startsWith('econCommitteeCharter'),
|
|
43
|
+
);
|
|
44
|
+
assert(charterIDs);
|
|
45
|
+
assert(charterIDs.length === 1);
|
|
46
|
+
trace('found charterID', charterIDs);
|
|
47
|
+
|
|
39
48
|
trace('done');
|
|
40
49
|
};
|
|
41
50
|
harden(testRecordedRetiredInstances);
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file register-interchain-bank-assets.js Core Eval
|
|
3
|
+
*
|
|
4
|
+
* Used to populate vbank in testing environments.
|
|
5
|
+
*/
|
|
6
|
+
import { AssetKind } from '@agoric/ertp';
|
|
7
|
+
import { makeTracer } from '@agoric/internal';
|
|
8
|
+
import { E } from '@endo/far';
|
|
9
|
+
import { makeMarshal } from '@endo/marshal';
|
|
10
|
+
|
|
11
|
+
const { Fail } = assert;
|
|
12
|
+
|
|
13
|
+
const trace = makeTracer('RegisterInterchainBankAssets', true);
|
|
14
|
+
|
|
15
|
+
/** @import {Board} from '@agoric/vats'; */
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @typedef {object} InterchainAssetOptions
|
|
19
|
+
* @property {string} denom
|
|
20
|
+
* @property {number} decimalPlaces
|
|
21
|
+
* @property {string} issuerName
|
|
22
|
+
* @property {string} keyword - defaults to `issuerName` if not provided
|
|
23
|
+
* @property {string} [proposedName] - defaults to `issuerName` if not provided
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
// vstorage paths under published.*
|
|
27
|
+
const BOARD_AUX = 'boardAux';
|
|
28
|
+
|
|
29
|
+
const marshalData = makeMarshal(_val => Fail`data only`);
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Make a storage node for auxiliary data for a value on the board.
|
|
33
|
+
*
|
|
34
|
+
* @param {ERef<StorageNode>} chainStorage
|
|
35
|
+
* @param {string} boardId
|
|
36
|
+
*/
|
|
37
|
+
const makeBoardAuxNode = async (chainStorage, boardId) => {
|
|
38
|
+
const boardAux = E(chainStorage).makeChildNode(BOARD_AUX);
|
|
39
|
+
return E(boardAux).makeChildNode(boardId);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* see `publishAgoricBrandsDisplayInfo` {@link @agoric/smart-wallet/proposals/upgrade-walletFactory-proposal.js}
|
|
44
|
+
*
|
|
45
|
+
* @param {ERef<StorageNode>} chainStorage
|
|
46
|
+
* @param {ERef<Board>} board
|
|
47
|
+
* @param {Brand<'nat'>} brand
|
|
48
|
+
*/
|
|
49
|
+
const publishBrandInfo = async (chainStorage, board, brand) => {
|
|
50
|
+
const [boardId, displayInfo, allegedName] = await Promise.all([
|
|
51
|
+
E(board).getId(brand),
|
|
52
|
+
E(brand).getDisplayInfo(),
|
|
53
|
+
E(brand).getAllegedName(),
|
|
54
|
+
]);
|
|
55
|
+
const node = makeBoardAuxNode(chainStorage, boardId);
|
|
56
|
+
const aux = marshalData.toCapData(harden({ allegedName, displayInfo }));
|
|
57
|
+
await E(node).setValue(JSON.stringify(aux));
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* @param {BootstrapPowers} powers
|
|
62
|
+
* @param {object} config
|
|
63
|
+
* @param {object} config.options
|
|
64
|
+
* @param {InterchainAssetOptions[]} config.options.assets
|
|
65
|
+
*/
|
|
66
|
+
export const publishInterchainAssets = async (
|
|
67
|
+
{
|
|
68
|
+
consume: {
|
|
69
|
+
agoricNamesAdmin,
|
|
70
|
+
bankManager,
|
|
71
|
+
board,
|
|
72
|
+
chainStorage,
|
|
73
|
+
startUpgradable,
|
|
74
|
+
},
|
|
75
|
+
brand: { produce: produceBrands },
|
|
76
|
+
issuer: { produce: produceIssuers },
|
|
77
|
+
installation: {
|
|
78
|
+
consume: { mintHolder },
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
{ options: { assets } },
|
|
82
|
+
) => {
|
|
83
|
+
trace(`${publishInterchainAssets.name} starting...`);
|
|
84
|
+
trace(assets);
|
|
85
|
+
await null;
|
|
86
|
+
for (const interchainAssetOptions of assets) {
|
|
87
|
+
const {
|
|
88
|
+
denom,
|
|
89
|
+
decimalPlaces,
|
|
90
|
+
issuerName,
|
|
91
|
+
keyword = issuerName,
|
|
92
|
+
proposedName = issuerName,
|
|
93
|
+
} = interchainAssetOptions;
|
|
94
|
+
|
|
95
|
+
trace('interchainAssetOptions', {
|
|
96
|
+
denom,
|
|
97
|
+
decimalPlaces,
|
|
98
|
+
issuerName,
|
|
99
|
+
keyword,
|
|
100
|
+
proposedName,
|
|
101
|
+
});
|
|
102
|
+
|
|
103
|
+
assert.typeof(denom, 'string');
|
|
104
|
+
assert.typeof(decimalPlaces, 'number');
|
|
105
|
+
assert.typeof(keyword, 'string');
|
|
106
|
+
assert.typeof(issuerName, 'string');
|
|
107
|
+
assert.typeof(proposedName, 'string');
|
|
108
|
+
|
|
109
|
+
const terms = {
|
|
110
|
+
keyword: issuerName, // "keyword" is a misnomer in mintHolder terms
|
|
111
|
+
assetKind: AssetKind.NAT,
|
|
112
|
+
displayInfo: {
|
|
113
|
+
decimalPlaces,
|
|
114
|
+
assetKind: AssetKind.NAT,
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
const { creatorFacet: mint, publicFacet: issuer } = await E(
|
|
118
|
+
startUpgradable,
|
|
119
|
+
)({
|
|
120
|
+
installation: mintHolder,
|
|
121
|
+
label: issuerName,
|
|
122
|
+
privateArgs: undefined,
|
|
123
|
+
terms,
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
const brand = await E(issuer).getBrand();
|
|
127
|
+
const kit = /** @type {IssuerKit<'nat'>} */ ({ mint, issuer, brand });
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* `addAssetToVault.js` will register the issuer with the `reserveKit`,
|
|
131
|
+
* but we don't need to do that here.
|
|
132
|
+
*/
|
|
133
|
+
|
|
134
|
+
await Promise.all([
|
|
135
|
+
E(E(agoricNamesAdmin).lookupAdmin('issuer')).update(issuerName, issuer),
|
|
136
|
+
E(E(agoricNamesAdmin).lookupAdmin('brand')).update(issuerName, brand),
|
|
137
|
+
// triggers benign UnhandledPromiseRejection 'Error: keyword "ATOM" must
|
|
138
|
+
// be unique' in provisionPool in testing environments
|
|
139
|
+
E(bankManager).addAsset(denom, issuerName, proposedName, kit),
|
|
140
|
+
]);
|
|
141
|
+
|
|
142
|
+
// publish brands and issuers to Bootstrap space for use in proposals
|
|
143
|
+
produceBrands[keyword].reset();
|
|
144
|
+
produceIssuers[keyword].reset();
|
|
145
|
+
produceBrands[keyword].resolve(brand);
|
|
146
|
+
produceIssuers[keyword].resolve(issuer);
|
|
147
|
+
|
|
148
|
+
// publish brand info / boardAux for offer legibility
|
|
149
|
+
await publishBrandInfo(
|
|
150
|
+
// @ts-expect-error 'Promise<StorageNode | null>' is not assignable to
|
|
151
|
+
// parameter of type 'ERef<StorageNode>'
|
|
152
|
+
chainStorage,
|
|
153
|
+
board,
|
|
154
|
+
brand,
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
trace(`${publishInterchainAssets.name} complete`);
|
|
158
|
+
};
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* @param {unknown} _powers
|
|
162
|
+
* @param {{ assets: InterchainAssetOptions[] }} options
|
|
163
|
+
*/
|
|
164
|
+
export const getManifestCall = (_powers, options) => {
|
|
165
|
+
/** @type {Record<string, true>} */
|
|
166
|
+
const IssuerKws = options.assets.reduce(
|
|
167
|
+
/**
|
|
168
|
+
* @param {Record<string, true>} acc
|
|
169
|
+
* @param {InterchainAssetOptions} assetOptions
|
|
170
|
+
*/
|
|
171
|
+
(acc, { issuerName }) => Object.assign(acc, { [issuerName]: true }),
|
|
172
|
+
{},
|
|
173
|
+
);
|
|
174
|
+
harden(IssuerKws);
|
|
175
|
+
|
|
176
|
+
return {
|
|
177
|
+
manifest: {
|
|
178
|
+
[publishInterchainAssets.name]: {
|
|
179
|
+
consume: {
|
|
180
|
+
agoricNamesAdmin: true,
|
|
181
|
+
bankManager: true,
|
|
182
|
+
board: true,
|
|
183
|
+
chainStorage: true,
|
|
184
|
+
startUpgradable: true,
|
|
185
|
+
},
|
|
186
|
+
brand: {
|
|
187
|
+
produce: IssuerKws,
|
|
188
|
+
},
|
|
189
|
+
issuer: {
|
|
190
|
+
produce: IssuerKws,
|
|
191
|
+
},
|
|
192
|
+
installation: {
|
|
193
|
+
consume: { mintHolder: true },
|
|
194
|
+
},
|
|
195
|
+
},
|
|
196
|
+
},
|
|
197
|
+
options,
|
|
198
|
+
};
|
|
199
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { makeHelpers } from '@agoric/deploy-script-support';
|
|
2
|
+
import { getManifestForReplaceFeeDistributor } from '@agoric/inter-protocol/src/proposals/replace-fee-distributor.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @file
|
|
6
|
+
* a Variant of ../inter-protocol/replace-feeDistributor.js that shortens the
|
|
7
|
+
* collectionInterval for testing
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */
|
|
11
|
+
export const defaultProposalBuilder = async (_, opts) => {
|
|
12
|
+
console.log('feeDist OPTS', opts);
|
|
13
|
+
return harden({
|
|
14
|
+
sourceSpec:
|
|
15
|
+
'@agoric/inter-protocol/src/proposals/replace-fee-distributor.js',
|
|
16
|
+
getManifestCall: [getManifestForReplaceFeeDistributor.name, { ...opts }],
|
|
17
|
+
});
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').DeployScriptFunction} */
|
|
21
|
+
export default async (homeP, endowments) => {
|
|
22
|
+
const { writeCoreEval } = await makeHelpers(homeP, endowments);
|
|
23
|
+
|
|
24
|
+
await writeCoreEval('replace-feeDistributor-testing', utils =>
|
|
25
|
+
defaultProposalBuilder(utils, {
|
|
26
|
+
collectionInterval: 30n,
|
|
27
|
+
keywordShares: {
|
|
28
|
+
RewardDistributor: 0n,
|
|
29
|
+
Reserve: 1n,
|
|
30
|
+
},
|
|
31
|
+
}),
|
|
32
|
+
);
|
|
33
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { makeHelpers } from '@agoric/deploy-script-support';
|
|
2
|
+
import { getManifestForTestUpgradedBoard } from '@agoric/vats/src/proposals/testUpgradedBoard.js';
|
|
3
|
+
|
|
4
|
+
/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */
|
|
5
|
+
export const defaultProposalBuilder = async () =>
|
|
6
|
+
harden({
|
|
7
|
+
sourceSpec: '@agoric/vats/src/proposals/testUpgradedBoard.js',
|
|
8
|
+
getManifestCall: [getManifestForTestUpgradedBoard.name],
|
|
9
|
+
});
|
|
10
|
+
|
|
11
|
+
/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').DeployScriptFunction} */
|
|
12
|
+
export default async (homeP, endowments) => {
|
|
13
|
+
const { writeCoreEval } = await makeHelpers(homeP, endowments);
|
|
14
|
+
await writeCoreEval('testUpgradedBoard', defaultProposalBuilder);
|
|
15
|
+
};
|
|
@@ -7,14 +7,14 @@ import {
|
|
|
7
7
|
makeTracer,
|
|
8
8
|
NonNullish,
|
|
9
9
|
} from '@agoric/internal';
|
|
10
|
-
import { E
|
|
10
|
+
import { E } from '@endo/far';
|
|
11
11
|
|
|
12
12
|
/// <reference types="@agoric/vats/src/core/types-ambient"/>
|
|
13
13
|
/**
|
|
14
14
|
* @import {Installation, Instance} from '@agoric/zoe/src/zoeService/utils.js';
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
|
-
const trace = makeTracer('
|
|
17
|
+
const trace = makeTracer('UpgradeSA', true);
|
|
18
18
|
|
|
19
19
|
/**
|
|
20
20
|
* @import {start as StartFn} from '@agoric/orchestration/src/examples/send-anywhere.contract.js';
|
|
@@ -30,7 +30,7 @@ const trace = makeTracer('FixBuggySA', true);
|
|
|
30
30
|
* }} powers
|
|
31
31
|
* @param {...any} rest
|
|
32
32
|
*/
|
|
33
|
-
export const
|
|
33
|
+
export const upgradeSendAnywhere = async (
|
|
34
34
|
{
|
|
35
35
|
consume: {
|
|
36
36
|
agoricNames,
|
|
@@ -45,7 +45,7 @@ export const fixSendAnywhere = async (
|
|
|
45
45
|
},
|
|
46
46
|
{ options: { sendAnywhereRef } },
|
|
47
47
|
) => {
|
|
48
|
-
trace(
|
|
48
|
+
trace(upgradeSendAnywhere.name);
|
|
49
49
|
|
|
50
50
|
const saInstance = await instances.consume.sendAnywhere;
|
|
51
51
|
trace('saInstance', saInstance);
|
|
@@ -53,28 +53,24 @@ export const fixSendAnywhere = async (
|
|
|
53
53
|
|
|
54
54
|
const marshaller = await E(board).getReadonlyMarshaller();
|
|
55
55
|
|
|
56
|
-
// This apparently pointless wrapper is to maintain structural parity
|
|
57
|
-
// with the buggy core-eval's wrapper to make lookup() hang.
|
|
58
|
-
const agoricNamesResolves = Far('agoricNames that resolves', {
|
|
59
|
-
lookup: async (...args) => {
|
|
60
|
-
return E(agoricNames).lookup(...args);
|
|
61
|
-
},
|
|
62
|
-
});
|
|
63
|
-
|
|
64
56
|
const privateArgs = await deeplyFulfilledObject(
|
|
65
57
|
harden({
|
|
66
|
-
agoricNames
|
|
58
|
+
agoricNames,
|
|
67
59
|
localchain,
|
|
68
60
|
marshaller,
|
|
69
61
|
orchestrationService: cosmosInterchainService,
|
|
70
62
|
storageNode: E(NonNullish(await chainStorage)).makeChildNode(
|
|
71
|
-
'
|
|
63
|
+
'send-anywhere',
|
|
72
64
|
),
|
|
73
65
|
timerService: chainTimerService,
|
|
66
|
+
// undefined so `registerKnownChainsAndAssets` does not run again
|
|
67
|
+
chainInfo: undefined,
|
|
68
|
+
assetInfo: undefined,
|
|
74
69
|
}),
|
|
75
70
|
);
|
|
76
71
|
|
|
77
72
|
trace('upgrading...');
|
|
73
|
+
trace('ref', sendAnywhereRef);
|
|
78
74
|
await E(saKit.adminFacet).upgradeContract(
|
|
79
75
|
sendAnywhereRef.bundleID,
|
|
80
76
|
privateArgs,
|
|
@@ -82,13 +78,13 @@ export const fixSendAnywhere = async (
|
|
|
82
78
|
|
|
83
79
|
trace('done');
|
|
84
80
|
};
|
|
85
|
-
harden(
|
|
81
|
+
harden(upgradeSendAnywhere);
|
|
86
82
|
|
|
87
83
|
export const getManifestForValueVow = ({ restoreRef }, { sendAnywhereRef }) => {
|
|
88
84
|
console.log('sendAnywhereRef', sendAnywhereRef);
|
|
89
85
|
return {
|
|
90
86
|
manifest: {
|
|
91
|
-
[
|
|
87
|
+
[upgradeSendAnywhere.name]: {
|
|
92
88
|
consume: {
|
|
93
89
|
agoricNames: true,
|
|
94
90
|
board: true,
|
|
@@ -120,7 +116,7 @@ export const getManifestForValueVow = ({ restoreRef }, { sendAnywhereRef }) => {
|
|
|
120
116
|
export const defaultProposalBuilder = async ({ publishRef, install }) =>
|
|
121
117
|
harden({
|
|
122
118
|
// Somewhat unorthodox, source the exports from this builder module
|
|
123
|
-
sourceSpec: '@agoric/builders/scripts/testing/
|
|
119
|
+
sourceSpec: '@agoric/builders/scripts/testing/upgrade-send-anywhere.js',
|
|
124
120
|
getManifestCall: [
|
|
125
121
|
'getManifestForValueVow',
|
|
126
122
|
{
|
|
@@ -139,5 +135,5 @@ export default async (homeP, endowments) => {
|
|
|
139
135
|
const dspModule = await import('@agoric/deploy-script-support');
|
|
140
136
|
const { makeHelpers } = dspModule;
|
|
141
137
|
const { writeCoreEval } = await makeHelpers(homeP, endowments);
|
|
142
|
-
await writeCoreEval(
|
|
138
|
+
await writeCoreEval(upgradeSendAnywhere.name, defaultProposalBuilder);
|
|
143
139
|
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { makeHelpers } from '@agoric/deploy-script-support';
|
|
2
|
+
|
|
3
|
+
/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */
|
|
4
|
+
export const defaultProposalBuilder = async ({ publishRef, install }) =>
|
|
5
|
+
harden({
|
|
6
|
+
sourceSpec: '@agoric/vats/src/proposals/upgrade-vaultFactory-proposal.js',
|
|
7
|
+
getManifestCall: [
|
|
8
|
+
'getManifestForVaultFactoryUpgrade',
|
|
9
|
+
{
|
|
10
|
+
contractRef: publishRef(
|
|
11
|
+
install('@agoric/inter-protocol/src/vaultFactory/vaultFactory.js'),
|
|
12
|
+
),
|
|
13
|
+
},
|
|
14
|
+
],
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').DeployScriptFunction} */
|
|
18
|
+
export default async (homeP, endowments) => {
|
|
19
|
+
const { writeCoreEval } = await makeHelpers(homeP, endowments);
|
|
20
|
+
await writeCoreEval('upgrade-vaults', defaultProposalBuilder);
|
|
21
|
+
};
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file Terminate price-feed governor instances such as mainnet v110.
|
|
3
|
+
* Functions as both an off-chain builder and an on-chain core-eval.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/// <reference types="@agoric/vats/src/core/types-ambient"/>
|
|
7
|
+
|
|
8
|
+
import { E } from '@endo/far';
|
|
9
|
+
|
|
10
|
+
const SELF = '@agoric/builders/scripts/vats/terminate-governor-instance.js';
|
|
11
|
+
const USAGE = `Usage: agoric run /path/to/terminate-governor-instance.js \\
|
|
12
|
+
<$governorInstanceHandleBoardID:$instanceKitLabel>...`;
|
|
13
|
+
|
|
14
|
+
const repr = val =>
|
|
15
|
+
typeof val === 'string' || (typeof val === 'object' && val !== null)
|
|
16
|
+
? JSON.stringify(val)
|
|
17
|
+
: String(val);
|
|
18
|
+
const defaultMakeError = (strings, ...subs) =>
|
|
19
|
+
Error(
|
|
20
|
+
strings.map((s, i) => `${i === 0 ? '' : repr(subs[i - 1])}${s}`).join(''),
|
|
21
|
+
);
|
|
22
|
+
const makeUsageError = (strings, ...subs) => {
|
|
23
|
+
const err = defaultMakeError(strings, ...subs);
|
|
24
|
+
console.error(err.message);
|
|
25
|
+
console.error(USAGE);
|
|
26
|
+
return err;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
const rtarget = /^(?<boardID>board[0-9]+):(?<instanceKitLabel>.+)$/;
|
|
30
|
+
/**
|
|
31
|
+
* @param {string[]} args
|
|
32
|
+
* @param {(strings: TemplateStringsArray | string[], ...subs: unknown[]) => Error} [makeError]
|
|
33
|
+
* @returns {Array<{boardID: string, instanceKitLabel: string}>}
|
|
34
|
+
*/
|
|
35
|
+
const parseTargets = (args = [], makeError = defaultMakeError) => {
|
|
36
|
+
if (!Array.isArray(args)) throw makeError`invalid targets: ${args}`;
|
|
37
|
+
/** @type {Array<{boardID: string, instanceKitLabel: string}>} */
|
|
38
|
+
const targets = [];
|
|
39
|
+
const badTargets = [];
|
|
40
|
+
for (const arg of args) {
|
|
41
|
+
const m = typeof arg === 'string' && arg.match(rtarget);
|
|
42
|
+
if (!m) {
|
|
43
|
+
badTargets.push(arg);
|
|
44
|
+
} else {
|
|
45
|
+
// @ts-expect-error cast
|
|
46
|
+
targets.push(m.groups);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
if (badTargets.length !== 0) {
|
|
50
|
+
throw makeError`malformed target(s): ${badTargets}`;
|
|
51
|
+
} else if (targets.length === 0) {
|
|
52
|
+
throw makeError`no target(s)`;
|
|
53
|
+
}
|
|
54
|
+
return targets;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* @param {BootstrapPowers} powers
|
|
59
|
+
* @param {{ options: { targetSpecifiers: string[] } }} config
|
|
60
|
+
*/
|
|
61
|
+
export const terminateGovernors = async (
|
|
62
|
+
{ consume: { board, governedContractKits } },
|
|
63
|
+
{ options: { targetSpecifiers } },
|
|
64
|
+
) => {
|
|
65
|
+
const { Fail, quote: q } = assert;
|
|
66
|
+
const targets = parseTargets(targetSpecifiers, Fail);
|
|
67
|
+
const doneP = Promise.allSettled(
|
|
68
|
+
targets.map(async ({ boardID, instanceKitLabel }) => {
|
|
69
|
+
const logLabel = [boardID, instanceKitLabel];
|
|
70
|
+
const contractInstanceHandle = await E(board).getValue(boardID);
|
|
71
|
+
const instanceKit = await E(governedContractKits).get(
|
|
72
|
+
// @ts-expect-error TS2345 Property '[tag]' is missing
|
|
73
|
+
contractInstanceHandle,
|
|
74
|
+
);
|
|
75
|
+
console.log(
|
|
76
|
+
`${q(logLabel)} alleged governor contract instance kit`,
|
|
77
|
+
instanceKit,
|
|
78
|
+
);
|
|
79
|
+
const { label, governorAdminFacet, adminFacet } = instanceKit;
|
|
80
|
+
label === instanceKitLabel ||
|
|
81
|
+
Fail`${q(logLabel)} unexpected instanceKit label, got ${label} but wanted ${q(instanceKitLabel)}`;
|
|
82
|
+
(adminFacet && adminFacet !== governorAdminFacet) ||
|
|
83
|
+
Fail`${q(logLabel)} instanceKit adminFacet should have been present and different from governorAdminFacet but was ${adminFacet}`;
|
|
84
|
+
const reason = harden(Error(`core-eval terminating ${label} governor`));
|
|
85
|
+
await E(governorAdminFacet).terminateContract(reason);
|
|
86
|
+
console.log(`${q(logLabel)} terminated governor`);
|
|
87
|
+
}),
|
|
88
|
+
);
|
|
89
|
+
const results = await doneP;
|
|
90
|
+
const problems = targets.flatMap(({ boardID, instanceKitLabel }, i) => {
|
|
91
|
+
if (results[i].status === 'fulfilled') return [];
|
|
92
|
+
return [[boardID, instanceKitLabel, results[i].reason]];
|
|
93
|
+
});
|
|
94
|
+
if (problems.length !== 0) {
|
|
95
|
+
console.error('governor termination(s) failed', problems);
|
|
96
|
+
Fail`governor termination(s) failed: ${problems}`;
|
|
97
|
+
}
|
|
98
|
+
};
|
|
99
|
+
harden(terminateGovernors);
|
|
100
|
+
|
|
101
|
+
export const getManifest = (_powers, targetSpecifiers) => {
|
|
102
|
+
parseTargets(targetSpecifiers);
|
|
103
|
+
return {
|
|
104
|
+
manifest: {
|
|
105
|
+
[terminateGovernors.name]: {
|
|
106
|
+
consume: { board: true, governedContractKits: true },
|
|
107
|
+
},
|
|
108
|
+
},
|
|
109
|
+
// Provide `terminateGovernors` a second argument like
|
|
110
|
+
// `{ options: { targetSpecifiers } }`.
|
|
111
|
+
options: { targetSpecifiers },
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */
|
|
116
|
+
export const defaultProposalBuilder = async (_utils, targetSpecifiers) => {
|
|
117
|
+
parseTargets(targetSpecifiers);
|
|
118
|
+
return harden({
|
|
119
|
+
sourceSpec: SELF,
|
|
120
|
+
getManifestCall: ['getManifest', targetSpecifiers],
|
|
121
|
+
});
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').DeployScriptFunction} */
|
|
125
|
+
export default async (homeP, endowments) => {
|
|
126
|
+
const { scriptArgs } = endowments;
|
|
127
|
+
parseTargets(scriptArgs, makeUsageError);
|
|
128
|
+
const dspModule = await import('@agoric/deploy-script-support');
|
|
129
|
+
const { makeHelpers } = dspModule;
|
|
130
|
+
const { writeCoreEval } = await makeHelpers(homeP, endowments);
|
|
131
|
+
await writeCoreEval(terminateGovernors.name, utils =>
|
|
132
|
+
defaultProposalBuilder(utils, scriptArgs),
|
|
133
|
+
);
|
|
134
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { makeHelpers } from '@agoric/deploy-script-support';
|
|
2
|
+
|
|
3
|
+
/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */
|
|
4
|
+
export const defaultProposalBuilder = async ({ publishRef, install }) =>
|
|
5
|
+
harden({
|
|
6
|
+
sourceSpec: '@agoric/vats/src/proposals/upgrade-agoricNames-proposal.js',
|
|
7
|
+
getManifestCall: [
|
|
8
|
+
'getManifestForUpgradingAgoricNames',
|
|
9
|
+
{
|
|
10
|
+
agoricNamesRef: publishRef(
|
|
11
|
+
install('@agoric/vats/src/vat-agoricNames.js'),
|
|
12
|
+
),
|
|
13
|
+
},
|
|
14
|
+
],
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').DeployScriptFunction} */
|
|
18
|
+
export default async (homeP, endowments) => {
|
|
19
|
+
const { writeCoreProposal } = await makeHelpers(homeP, endowments);
|
|
20
|
+
await writeCoreProposal('upgrade-agoricNames', defaultProposalBuilder);
|
|
21
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { makeHelpers } from '@agoric/deploy-script-support';
|
|
2
|
+
|
|
3
|
+
/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */
|
|
4
|
+
export const defaultProposalBuilder = async ({ publishRef, install }) =>
|
|
5
|
+
harden({
|
|
6
|
+
sourceSpec: '@agoric/vats/src/proposals/upgrade-asset-reserve-proposal.js',
|
|
7
|
+
getManifestCall: [
|
|
8
|
+
'getManifestForUpgradingAssetReserve',
|
|
9
|
+
{
|
|
10
|
+
assetReserveRef: publishRef(
|
|
11
|
+
install('@agoric/inter-protocol/src/reserve/assetReserve.js'),
|
|
12
|
+
),
|
|
13
|
+
},
|
|
14
|
+
],
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').DeployScriptFunction} */
|
|
18
|
+
export default async (homeP, endowments) => {
|
|
19
|
+
const { writeCoreProposal } = await makeHelpers(homeP, endowments);
|
|
20
|
+
await writeCoreProposal('upgrade-asset-reserve', defaultProposalBuilder);
|
|
21
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { makeHelpers } from '@agoric/deploy-script-support';
|
|
2
|
+
import { getManifestForUpgradingBoard } from '@agoric/vats/src/proposals/upgrade-board-proposal.js';
|
|
3
|
+
|
|
4
|
+
/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */
|
|
5
|
+
export const defaultProposalBuilder = async ({ publishRef, install }) =>
|
|
6
|
+
harden({
|
|
7
|
+
sourceSpec: '@agoric/vats/src/proposals/upgrade-board-proposal.js',
|
|
8
|
+
getManifestCall: [
|
|
9
|
+
getManifestForUpgradingBoard.name,
|
|
10
|
+
{
|
|
11
|
+
boardRef: publishRef(install('@agoric/vats/src/vat-board.js')),
|
|
12
|
+
},
|
|
13
|
+
],
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').DeployScriptFunction} */
|
|
17
|
+
export default async (homeP, endowments) => {
|
|
18
|
+
const { writeCoreEval } = await makeHelpers(homeP, endowments);
|
|
19
|
+
await writeCoreEval('upgrade-board', defaultProposalBuilder);
|
|
20
|
+
};
|