-
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.
fix! vault factory takes auctioneerPublicFacet from private args inst…
…ead of terms
- Loading branch information
1 parent
df3d0a7
commit 02a24db
Showing
8 changed files
with
261 additions
and
11 deletions.
There are no files selected for viewing
51 changes: 51 additions & 0 deletions
51
...ployment/upgrade-test/upgrade-test-scripts/agoric-upgrade-11/auctioneer-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,51 @@ | ||
#!/bin/bash | ||
|
||
. ./upgrade-test-scripts/env_setup.sh | ||
|
||
set -euo pipefail | ||
# set -x | ||
|
||
here='upgrade-test-scripts/agoric-upgrade-11' | ||
|
||
bundle_auctioneer_filepath='/tmp/bundle-auctioneer.json' | ||
bundle_vault_filepath='/tmp/bundle-vaultFactory.json' | ||
|
||
alias bundle-source="yarn run --silent bundle-source" | ||
# TODO: for now, we're bundling vaultFactory outside the container. but before we finish: | ||
# bundle-source --cache-json /tmp packages/inter-protocol/src/vaultFactory/vaultFactory.js vaultFactory | ||
VAULT_HASH=`jq -r .endoZipBase64Sha512 ${bundle_vault_filepath}` | ||
|
||
echo checking that hashes match ${here}/gov-switch-auctioneer.js | ||
echo ${VAULT_HASH} | ||
grep ${VAULT_HASH} ${here}/gov-switch-auctioneer.js || exit 1 | ||
|
||
bundle-source --cache-json /tmp packages/inter-protocol/src/auction/auctioneer.js auctioneer | ||
AUCTIONEER_HASH=`jq -r .endoZipBase64Sha512 ${bundle_auctioneer_filepath}` | ||
grep ${AUCTIONEER_HASH} ${here}/gov-switch-auctioneer.js || exit 1 | ||
|
||
# TODO: make sure this consistently works | ||
agd tx swingset install-bundle @${bundle_vault_filepath} \ | ||
--from gov1 --keyring-backend=test --gas=auto \ | ||
--chain-id=agoriclocal -b block --yes | ||
agoric follow -lF :bundles | ||
|
||
agd tx swingset install-bundle @${bundle_auctioneer_filepath} \ | ||
--from gov1 --keyring-backend=test --gas=auto \ | ||
--chain-id=agoriclocal -b block --yes | ||
agoric follow -lF :bundles | ||
|
||
agd --chain-id=agoriclocal \ | ||
tx gov submit-proposal swingset-core-eval \ | ||
${here}/gov-switch-auctioneer-permit.json ${here}/gov-switch-auctioneer.js \ | ||
--title="Auctioneer Upgrade" --description="auctioneer 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 | ||
|
||
# then tes some stuff??? | ||
# 3129800000uist |
29 changes: 29 additions & 0 deletions
29
...ent/upgrade-test/upgrade-test-scripts/agoric-upgrade-11/gov-switch-auctioneer-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,29 @@ | ||
{ | ||
"consume": { | ||
"auctioneerKit": true, | ||
"chainTimerService": true, | ||
"priceAuthority": true, | ||
"startGovernedUpgradable": true, | ||
"vaultFactoryKit": true, | ||
"zoe": true, | ||
"chainStorage": true, | ||
"board": true, | ||
"reserveKit": true | ||
}, | ||
"produce": { | ||
"auctioneerKit": true | ||
}, | ||
"instance": { | ||
"produce": { | ||
"auctioneer": true | ||
}, | ||
"consume": { | ||
"reserve": true | ||
} | ||
}, | ||
"issuer": { | ||
"consume": { | ||
"IST": true | ||
} | ||
} | ||
} |
147 changes: 147 additions & 0 deletions
147
...s/deployment/upgrade-test/upgrade-test-scripts/agoric-upgrade-11/gov-switch-auctioneer.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,147 @@ | ||
// @ts-nocheck | ||
/* global E */ | ||
|
||
console.log('started switch-auctioneer script'); | ||
|
||
// TODO: set these bundle-ids to the revised code | ||
const bundleIDs = { | ||
vaultFactory: | ||
'b1-4755fb5c079fc2a17e6ea5a887d27787cd6d48df179e046466c4dbf4b9e78ac7dceee183a395de3d6a09c5f162415e12f42685269b84c64b58c5f65eab6b0de1', | ||
auctioneer: | ||
'b1-e85289898e66e0423d7ec1c402ac2ced21573f93cf599d593a0533a1e2355ace624cc95c8c8c18c66d44a921511642e87837accd0e728427c269936b040bb886', | ||
}; | ||
|
||
const STORAGE_PATH = 'auction'; | ||
|
||
const { fromEntries, keys, values } = Object; | ||
|
||
/** @type {<X, Y>(xs: X[], ys: Y[]) => [X, Y][]} */ | ||
const zip = (xs, ys) => harden(xs.map((x, i) => [x, ys[+i]])); | ||
|
||
/** | ||
* @type {<T extends Record<string, ERef<any>>>( | ||
* obj: T, | ||
* ) => Promise<{ [K in keyof T]: Awaited<T[K]> }>} | ||
*/ | ||
const allValues = async obj => { | ||
const resolved = await Promise.all(values(obj)); | ||
// @ts-expect-error cast | ||
return harden(fromEntries(zip(keys(obj), resolved))); | ||
}; | ||
|
||
/** @param {import('../../src/proposals/econ-behaviors').EconomyBootstrapPowers} permittedPowers */ | ||
const switchAuctioneer = async permittedPowers => { | ||
console.log('switchAuctioneer: extracting permitted powers...'); | ||
// see gov-switch-auctioneer-permit.json | ||
const { | ||
consume: { | ||
auctioneerKit: auctioneerKitP, | ||
chainTimerService: timerService, | ||
priceAuthority, | ||
startGovernedUpgradable, | ||
vaultFactoryKit, | ||
zoe, | ||
chainStorage, | ||
board, | ||
reserveKit, | ||
}, | ||
produce: { auctioneerKit }, | ||
instance: { | ||
produce: { auctioneer: auctionInstance }, | ||
consume: { reserve: reserveInstance }, | ||
}, | ||
issuer: { | ||
consume: { IST: stableIssuerP }, | ||
}, | ||
} = permittedPowers; | ||
|
||
/** install, start governed instance, publish results */ | ||
const startNewAuctioneer = async () => { | ||
console.log('startNewAuctioneer: installBundleID etc.'); | ||
const { | ||
// @ts-expect-error cast XXX missing from type | ||
// auctioneerKit: { privateArgs }, // TODO, this doesn't work. Find a way to pass in valid private args | ||
governedParamsOrig, | ||
installation, | ||
reservePublicFacet, | ||
stableIssuer, | ||
storageNode, | ||
marshaller, | ||
} = await allValues({ | ||
auctioneerKit: auctioneerKitP, | ||
installation: E(zoe).installBundleID(bundleIDs.auctioneer, 'auctioneer'), | ||
reservePublicFacet: E(zoe).getPublicFacet(reserveInstance), | ||
stableIssuer: stableIssuerP, | ||
governedParamsOrig: E( | ||
E.get(auctioneerKitP).publicFacet, | ||
).getGovernedParams(), | ||
storageNode: E(chainStorage).makeChildNode(STORAGE_PATH), | ||
marshaller: E(board).getReadonlyMarshaller(), | ||
}); | ||
|
||
const privateArgs = { | ||
storageNode, | ||
marshaller, | ||
}; | ||
|
||
const { Electorate: _, ...governedParams } = governedParamsOrig; | ||
|
||
const terms = { | ||
priceAuthority, | ||
reservePublicFacet, | ||
timerService, | ||
governedParams: governedParamsOrig, | ||
}; | ||
|
||
console.log('startNewAuctioneer: startGovernedUpgradable'); | ||
const kit = await E(startGovernedUpgradable)({ | ||
label: 'auctioneer', | ||
installation, | ||
issuerKeywordRecord: { Bid: stableIssuer }, | ||
terms, | ||
governedParams, | ||
privateArgs, | ||
}); | ||
|
||
auctioneerKit.reset(); | ||
auctioneerKit.resolve(kit); | ||
// TODO: test that auctioneer in agoricNames.instance gets updated | ||
auctionInstance.reset(); | ||
auctionInstance.resolve(kit.instance); | ||
|
||
return kit; | ||
}; | ||
|
||
const newAuctionKit = await startNewAuctioneer(); | ||
|
||
// TODO: shut down old auctioneer? | ||
|
||
// upgrade the vaultFactory | ||
const upgradeVaultFactory = async () => { | ||
console.log('upgradeVaultFactory...'); | ||
const kit = await vaultFactoryKit; | ||
// @ts-expect-error cast XXX privateArgs missing from type | ||
const { privateArgs } = kit; | ||
|
||
/** @type {xxport('../../src/vaultFactory/vaultFactory').VaultFactoryContract['privateArgs']} */ | ||
const newPrivateArgs = harden({ | ||
...privateArgs, | ||
auctioneerInstance: newAuctionKit.instance, | ||
}); | ||
const upgradeResult = await E(kit.adminFacet).upgradeContract( | ||
bundleIDs.vaultFactory, | ||
newPrivateArgs, | ||
); | ||
|
||
const shortfallInvitation = await E( | ||
E.get(reserveKit).creatorFacet, | ||
).makeShortfallReportingInvitation(); | ||
|
||
await E(kit.creatorFacet).updateShortfallReporter(shortfallInvitation); | ||
|
||
console.log('upgraded vaultVactory.', upgradeResult); | ||
}; | ||
await upgradeVaultFactory(); | ||
}; | ||
|
||
switchAuctioneer; |
6 changes: 6 additions & 0 deletions
6
packages/deployment/upgrade-test/upgrade-test-scripts/agoric-upgrade-11/mint-ist.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,6 @@ | ||
agd tx bank send validator $GOV1ADDR 20123000000ibc/BA313C4A19DFBF943586C0387E6B11286F9E416B4DD27574E6909CABE0E342FA --keyring-backend=test --chain-id=agoriclocal --yes -bblock | ||
agops vaults open --giveCollateral 5000 --wantMinted 20000 > /tmp/offer.json | ||
agops perf satisfaction --executeOffer /tmp/offer.json --from gov1 --keyring-backend=test | ||
|
||
|
||
# ibc/BA313C4A19DFBF943586C0387E6B11286F9E416B4DD27574E6909CABE0E342FA |
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