-
Notifications
You must be signed in to change notification settings - Fork 214
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(vats): upgrade the orchestration core
- Loading branch information
1 parent
4117643
commit 798937c
Showing
5 changed files
with
72 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,4 +3,4 @@ add-LEMONS/ | |
add-OLIVES/ | ||
upgrade-bank/ | ||
upgrade-provisionPool/ | ||
|
||
upgrade-orch-core/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { makeHelpers } from '@agoric/deploy-script-support'; | ||
|
||
/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */ | ||
export const defaultProposalBuilder = async ({ publishRef, install }) => | ||
harden({ | ||
sourceSpec: '@agoric/vats/src/proposals/upgrade-orch-core-proposal.js', | ||
getManifestCall: [ | ||
'getManifestForUpgradingOrchCore', | ||
{ | ||
bundleRefs: { | ||
ibc: publishRef(install('@agoric/vats/src/vat-ibc.js')), | ||
network: publishRef(install('@agoric/vats/src/vat-network.js')), | ||
localchain: publishRef(install('@agoric/vats/src/vat-localchain.js')), | ||
transfer: publishRef(install('@agoric/vats/src/vat-transfer.js')), | ||
}, | ||
}, | ||
], | ||
}); | ||
|
||
export default async (homeP, endowments) => { | ||
const { writeCoreProposal } = await makeHelpers(homeP, endowments); | ||
await writeCoreProposal('upgrade-network', defaultProposalBuilder); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { E } from '@endo/far'; | ||
|
||
/** | ||
* @param {BootstrapPowers & { | ||
* consume: { | ||
* vatAdminSvc: VatAdminSvc; | ||
* vatStore: MapStore< | ||
* string, | ||
* import('@agoric/swingset-vat').CreateVatResults | ||
* >; | ||
* }; | ||
* }} powers | ||
* @param {object} options | ||
* @param {{ ibcRef: VatSourceRef; networkRef: VatSourceRef }} options.options | ||
*/ | ||
export const upgradeOrchCore = async ( | ||
{ consume: { vatAdminSvc, vatStore } }, | ||
options, | ||
) => { | ||
const { bundleRefs } = options.options; | ||
|
||
for await (const [name, ref] of Object.entries(bundleRefs)) { | ||
assert(ref.bundleID, `bundleID missing for ${name}`); | ||
console.log(name, `BUNDLE ID: `, ref.bundleID); | ||
const bundleCap = await E(vatAdminSvc).getBundleCap(ref.bundleID); | ||
|
||
const { adminNode } = await E(vatStore).get(name); | ||
await E(adminNode).upgrade(bundleCap, {}); | ||
} | ||
}; | ||
|
||
export const getManifestForUpgradingOrchCore = (_powers, { bundleRefs }) => ({ | ||
manifest: { | ||
[upgradeOrchCore.name]: { | ||
consume: { | ||
vatAdminSvc: 'vatAdminSvc', | ||
vatStore: 'vatStore', | ||
}, | ||
produce: {}, | ||
}, | ||
}, | ||
options: { bundleRefs }, | ||
}); |