@agoric/builders 0.1.1-dev-d575daa.0 → 0.1.1-dev-e06691f.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/builders",
|
|
3
|
-
"version": "0.1.1-dev-
|
|
3
|
+
"version": "0.1.1-dev-e06691f.0+e06691f",
|
|
4
4
|
"description": "Build scripts for proposals to an Agoric chain",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -23,14 +23,14 @@
|
|
|
23
23
|
"author": "Agoric",
|
|
24
24
|
"license": "Apache-2.0",
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@agoric/ertp": "0.16.3-dev-
|
|
27
|
-
"@agoric/fast-usdc": "0.1.1-dev-
|
|
28
|
-
"@agoric/internal": "0.3.3-dev-
|
|
29
|
-
"@agoric/notifier": "0.6.3-dev-
|
|
30
|
-
"@agoric/smart-wallet": "0.5.4-dev-
|
|
31
|
-
"@agoric/vat-data": "0.5.3-dev-
|
|
32
|
-
"@agoric/vats": "0.15.2-dev-
|
|
33
|
-
"@agoric/zoe": "0.26.3-dev-
|
|
26
|
+
"@agoric/ertp": "0.16.3-dev-e06691f.0+e06691f",
|
|
27
|
+
"@agoric/fast-usdc": "0.1.1-dev-e06691f.0+e06691f",
|
|
28
|
+
"@agoric/internal": "0.3.3-dev-e06691f.0+e06691f",
|
|
29
|
+
"@agoric/notifier": "0.6.3-dev-e06691f.0+e06691f",
|
|
30
|
+
"@agoric/smart-wallet": "0.5.4-dev-e06691f.0+e06691f",
|
|
31
|
+
"@agoric/vat-data": "0.5.3-dev-e06691f.0+e06691f",
|
|
32
|
+
"@agoric/vats": "0.15.2-dev-e06691f.0+e06691f",
|
|
33
|
+
"@agoric/zoe": "0.26.3-dev-e06691f.0+e06691f",
|
|
34
34
|
"@endo/bundle-source": "^3.5.0",
|
|
35
35
|
"@endo/captp": "^4.4.3",
|
|
36
36
|
"@endo/eventual-send": "^1.2.8",
|
|
@@ -43,14 +43,14 @@
|
|
|
43
43
|
"import-meta-resolve": "^2.2.1"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@agoric/deploy-script-support": "0.10.4-dev-
|
|
47
|
-
"@agoric/governance": "0.10.4-dev-
|
|
48
|
-
"@agoric/inter-protocol": "0.16.2-dev-
|
|
49
|
-
"@agoric/orchestration": "0.1.1-dev-
|
|
50
|
-
"@agoric/store": "0.9.3-dev-
|
|
51
|
-
"@agoric/swing-store": "0.9.2-dev-
|
|
52
|
-
"@agoric/swingset-liveslots": "0.10.3-dev-
|
|
53
|
-
"@agoric/time": "0.3.3-dev-
|
|
46
|
+
"@agoric/deploy-script-support": "0.10.4-dev-e06691f.0+e06691f",
|
|
47
|
+
"@agoric/governance": "0.10.4-dev-e06691f.0+e06691f",
|
|
48
|
+
"@agoric/inter-protocol": "0.16.2-dev-e06691f.0+e06691f",
|
|
49
|
+
"@agoric/orchestration": "0.1.1-dev-e06691f.0+e06691f",
|
|
50
|
+
"@agoric/store": "0.9.3-dev-e06691f.0+e06691f",
|
|
51
|
+
"@agoric/swing-store": "0.9.2-dev-e06691f.0+e06691f",
|
|
52
|
+
"@agoric/swingset-liveslots": "0.10.3-dev-e06691f.0+e06691f",
|
|
53
|
+
"@agoric/time": "0.3.3-dev-e06691f.0+e06691f",
|
|
54
54
|
"@endo/errors": "^1.2.8",
|
|
55
55
|
"ava": "^5.3.0",
|
|
56
56
|
"c8": "^10.1.2"
|
|
@@ -83,5 +83,5 @@
|
|
|
83
83
|
"typeCoverage": {
|
|
84
84
|
"atLeast": 90.93
|
|
85
85
|
},
|
|
86
|
-
"gitHead": "
|
|
86
|
+
"gitHead": "e06691f3bb13d315a4b557b4711c33cabc94979c"
|
|
87
87
|
}
|
|
@@ -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
|
+
};
|
|
@@ -3,15 +3,18 @@ import { makeHelpers } from '@agoric/deploy-script-support';
|
|
|
3
3
|
/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */
|
|
4
4
|
export const defaultProposalBuilder = async ({ publishRef, install }) =>
|
|
5
5
|
harden({
|
|
6
|
-
sourceSpec: '@agoric/vats/src/proposals/upgrade-
|
|
6
|
+
sourceSpec: '@agoric/vats/src/proposals/upgrade-vats-generic-proposal.js',
|
|
7
7
|
getManifestCall: [
|
|
8
|
-
'
|
|
8
|
+
'getManifestForUpgradingVats',
|
|
9
9
|
{
|
|
10
10
|
bundleRefs: {
|
|
11
11
|
ibc: publishRef(install('@agoric/vats/src/vat-ibc.js')),
|
|
12
12
|
network: publishRef(install('@agoric/vats/src/vat-network.js')),
|
|
13
13
|
localchain: publishRef(install('@agoric/vats/src/vat-localchain.js')),
|
|
14
14
|
transfer: publishRef(install('@agoric/vats/src/vat-transfer.js')),
|
|
15
|
+
orchestration: publishRef(
|
|
16
|
+
install('@agoric/orchestration/src/vat-orchestration.js'),
|
|
17
|
+
),
|
|
15
18
|
},
|
|
16
19
|
},
|
|
17
20
|
],
|