-
Notifications
You must be signed in to change notification settings - Fork 208
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8018 from Agoric/6678-upgradeZoeZcf-docker
test: a docker test for the zoe/zcf upgrade
- Loading branch information
Showing
16 changed files
with
245 additions
and
52 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
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
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
96 changes: 96 additions & 0 deletions
96
...upgrade-test/upgrade-test-scripts/agoric-upgrade-11/zoe-full-upgrade/run-prober-script.js
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,96 @@ | ||
// @ts-no-check | ||
/* global E */ | ||
|
||
// to turn on ts-check: | ||
// Xmport { E } from '@endo/far'; | ||
|
||
const PROBER_BUNDLE_ID = | ||
'b1-f4386f80814847369ad2b2135599d28f3658b0edff55cb6acc45a9a5a25b8bdb301b65a3c8fee17d569bcf724008786c55c6ff025c50959ffd1a20088926df8c'; | ||
|
||
console.info('running zcf prober'); | ||
|
||
const sub = (a, v) => { | ||
return { brand: a.brand, value: a.value - v }; | ||
}; | ||
|
||
const probeReallocation = async ( | ||
value, | ||
payment, | ||
creatorFacet, | ||
zoe, | ||
ducatIssuer, | ||
) => { | ||
const stagingInv = await E(creatorFacet).makeProbeStagingInvitation(); | ||
|
||
const stagingSeat = await E(zoe).offer( | ||
stagingInv, | ||
{ give: { Ducats: value } }, | ||
{ Ducats: payment }, | ||
); | ||
const helperPayments = await E(stagingSeat).getPayouts(); | ||
|
||
const helperInv = await E(creatorFacet).makeProbeHelperInvitation(); | ||
const helperSeat = await E(zoe).offer( | ||
helperInv, | ||
{ give: { Ducats: sub(value, 1n) } }, | ||
{ Ducats: helperPayments.Ducats }, | ||
); | ||
const internalPayments = await E(helperSeat).getPayouts(); | ||
const ducatAmount = await E(ducatIssuer).getAmountOf(internalPayments.Ducats); | ||
|
||
const internalInv = await E(creatorFacet).makeProbeInternalInvitation(); | ||
const internalSeat = await E(zoe).offer( | ||
internalInv, | ||
{ give: { Ducats: ducatAmount } }, | ||
{ Ducats: internalPayments.Ducats }, | ||
); | ||
const leftoverPayments = await E(internalSeat).getPayouts(); | ||
|
||
return { | ||
stagingResult: await E(stagingSeat).getOfferResult(), | ||
helperResult: await E(helperSeat).getOfferResult(), | ||
internalResult: await E(internalSeat).getOfferResult(), | ||
leftoverPayments, | ||
}; | ||
}; | ||
|
||
/* | ||
* Test a full upgrade of Zoe and ZCF. | ||
* This will include a change to Zoe's code, and a call to Zoe to change the ZCF | ||
* code that will get used for new and upgraded contracts. | ||
*/ | ||
const runProber = async powers => { | ||
console.info('install prober'); | ||
const { | ||
consume: { zoe, chainStorage }, | ||
} = powers; | ||
|
||
const installation = await E(zoe).installBundleID(PROBER_BUNDLE_ID); | ||
const storageNode = await E(chainStorage).makeChildNode('prober-asid9a'); | ||
|
||
const { instance, creatorFacet } = await E(zoe).startInstance( | ||
installation, | ||
undefined, | ||
undefined, | ||
{ storageNode }, | ||
'probe', | ||
); | ||
|
||
const issuers = await E(zoe).getIssuers(instance); | ||
|
||
const faucetInv = await E(creatorFacet).makeFaucetInvitation(); | ||
const seat = await E(zoe).offer(faucetInv); | ||
const payoutDucats = await E(seat).getPayout('Ducats'); | ||
const faucetAmount = await E(issuers.Ducats).getAmountOf(payoutDucats); | ||
|
||
const result1 = await probeReallocation( | ||
faucetAmount, | ||
payoutDucats, | ||
creatorFacet, | ||
zoe, | ||
issuers.Ducats, | ||
); | ||
console.info('PROBE results', result1); | ||
}; | ||
|
||
runProber; |
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
25 changes: 25 additions & 0 deletions
25
...pgrade-test/upgrade-test-scripts/agoric-upgrade-11/zoe-full-upgrade/zcf-upgrade-driver.sh
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,25 @@ | ||
#!/bin/bash | ||
|
||
. ./upgrade-test-scripts/env_setup.sh | ||
|
||
set -euo pipefail | ||
|
||
# This shows how to upgrade Zoe and ZCF on a running chain. It presumes that | ||
# the bundles for Zoe and ZCF have been installed, and their hashes updated in | ||
# zcf-upgrade-script.js. Instructions for updating the bundles are available | ||
# in ../actions.sh | ||
|
||
here='upgrade-test-scripts/agoric-upgrade-11/zoe-full-upgrade' | ||
|
||
agd --chain-id=agoriclocal \ | ||
tx gov submit-proposal swingset-core-eval \ | ||
${here}/zcf-upgrade-permit.json ${here}/zcf-upgrade-script.js \ | ||
--title="Zoe Upgrade" --description="zoe upgrade test" \ | ||
--deposit=10000000ubld \ | ||
--gas=auto --gas-adjustment=1.2 \ | ||
--yes -o json --from=validator --keyring-backend=test -b block | ||
|
||
agd --chain-id=agoriclocal query gov proposals --output json | \ | ||
jq -c '.proposals[] | [.proposal_id,.voting_end_time,.status]'; | ||
|
||
voteLatestProposalAndWait |
8 changes: 8 additions & 0 deletions
8
...rade-test/upgrade-test-scripts/agoric-upgrade-11/zoe-full-upgrade/zcf-upgrade-permit.json
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,8 @@ | ||
{ | ||
"consume": { | ||
"vatStore": true, | ||
"vatAdminSvc": true, | ||
"zoe": true, | ||
"chainStorage": true | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
...pgrade-test/upgrade-test-scripts/agoric-upgrade-11/zoe-full-upgrade/zcf-upgrade-script.js
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,33 @@ | ||
// to turn on ts-check: | ||
/* global E */ | ||
|
||
// import { E } from "@endo/far"; | ||
|
||
const ZCF_BUNDLE_ID = | ||
'b1-3781ce16d40590a41588a472795d2487dbdd9c5f055ac9a82ff52a872cf24f1eb35c6f45d248bcbe13c12d2c1356aecaf5e81b73155ab109499f285ef83fdfd9'; | ||
const ZOE_BUNDLE_ID = | ||
'b1-51ffc8e388df8dff7d16b670f5c2c5a2de51f23b7a9a411e90eb222c4a673b3845db2bd925bbf5f9e2bff5fb40e65aa2d366f45c186dd81d0f1517d456b8de58'; | ||
|
||
console.info('zoe upgrade: evaluating script'); | ||
|
||
/* | ||
* Test a full upgrade of Zoe and ZCF. | ||
* This will include a change to Zoe's code, and a call to Zoe to change the ZCF | ||
* code that will get used for new and upgraded contracts. | ||
*/ | ||
const upgradeZoeAndZcf = async powers => { | ||
console.info('upgradeZoeAndZcf'); | ||
const { | ||
consume: { vatStore, vatAdminSvc }, | ||
} = powers; | ||
|
||
const newZoeBundleCap = await E(vatAdminSvc).getBundleCap(ZOE_BUNDLE_ID); | ||
const { adminNode, root: zoeRoot } = await E(vatStore).get('zoe'); | ||
|
||
await E(adminNode).upgrade(newZoeBundleCap, {}); | ||
|
||
const zoeConfigFacet = await E(zoeRoot).getZoeConfigFacet(); | ||
await E(zoeConfigFacet).updateZcfBundleId(ZCF_BUNDLE_ID); | ||
}; | ||
|
||
upgradeZoeAndZcf; |
6 changes: 0 additions & 6 deletions
6
...t/upgrade-test/upgrade-test-scripts/agoric-upgrade-11/zoe-upgrade/zoe-upgrade-permit.json
This file was deleted.
Oops, something went wrong.
32 changes: 0 additions & 32 deletions
32
...ent/upgrade-test/upgrade-test-scripts/agoric-upgrade-11/zoe-upgrade/zoe-upgrade-script.js
This file was deleted.
Oops, something went wrong.
File renamed without changes.
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