Skip to content

Commit

Permalink
chore: Add core-eval for terminating mainnet v110 zcf-b1-9f877-stkATO…
Browse files Browse the repository at this point in the history
…M-USD_price_feed-governor

Ref #9483
Termination of a small vat to verify good behavior.

Discovery of magic value "board052184":
```
sqlite> SELECT json_extract(value, '$.name') AS name FROM kvStore WHERE key='v110.options';
zcf-b1-9f877-stkATOM-USD_price_feed-governor

sqlite> SELECT * FROM kvStore WHERE key >= 'v2.' AND key < 'v2/' AND value LIKE '%v110%';
v2.vs.vom.o+d13/105|{"vatID":{"body":"#\"v110\"","slots":[]}}

sqlite> SELECT * FROM kvStore WHERE key='v2.c.o+d13/105'; -- v110 admin node
v2.c.o+d13/105|ko4295546

sqlite> SELECT * FROM kvStore WHERE key='v9.c.ko4295546';
v9.c.ko4295546|R o-990404

sqlite> SELECT * FROM kvStore WHERE key >= 'v9.' AND key < 'v9/' AND value LIKE '%o-990404%';
v9.c.ko4295546|R o-990404
v9.vs.vc.4.sp+484625|{"body":"#[[\"$0.Alleged: InstanceCompletionWatcher\",\"$1.Alleged: instanceAdmin instanceAdmin\",\"$2.Alleged: adminNode\"]]","slots":["o+d1617/1","o+d33/98:1","o-990404"]}
v9.vs.vom.o+d26/98|{"instanceState":{"body":"#\"$0.Alleged: InstanceRecord\"","slots":["o+d27/98"]},"adminNode":{"body":"#\"$0.Alleged: adminNode\"","slots":["o-990404"]},"root":{"body":"#\"$0.Alleged: undefined\"","slots":["o-990405"]},"functions":{"body":"#\"#undefined\"","slots":[]}}
v9.vs.vom.o+d33/98|{"offerFilterStrings":{"body":"#[]","slots":[]},"publicFacet":{"body":"#\"$0.Alleged: ContractGovernorKit public\"","slots":["o-990417"]},"handleOfferObj":{"body":"#\"$0.Alleged: handleOfferObj\"","slots":["o-990416"]},"zoeInstanceStorageManager":{"body":"#\"$0.Alleged: InstanceStorageManager instanceStorageManager\"","slots":["o+d26/98:1"]},"seatHandleToZoeSeatAdmin":{"body":"#\"$0.Alleged: weakMapStore\"","slots":["o+d7/24"]},"instanceHandle":{"body":"#\"$0.Alleged: InstanceHandle\"","slots":["o+d29/98"]},"acceptingOffers":{"body":"#true","slots":[]},"zoeSeatAdmins":{"body":"#\"$0.Alleged: setStore\"","slots":["o+d8/2681"]},"adminNode":{"body":"#\"$0.Alleged: adminNode\"","slots":["o-990404"]}}
v9.vs.vom.o+d34/98|{"instanceStorage":{"body":"#\"$0.Alleged: InstanceStorageManager instanceStorageManager\"","slots":["o+d26/98:1"]},"instanceAdmin":{"body":"#\"$0.Alleged: instanceAdmin instanceAdmin\"","slots":["o+d33/98:1"]},"seatHandleToSeatAdmin":{"body":"#\"$0.Alleged: weakMapStore\"","slots":["o+d7/24"]},"adminNode":{"body":"#\"$0.Alleged: adminNode\"","slots":["o-990404"]}}
v9.vs.vom.o+d37/100|{"adminNode":{"body":"#\"$0.Alleged: adminNode\"","slots":["o-990404"]},"contractBundleCap":{"body":"#\"$0.Alleged: device node\"","slots":["d-75"]}}

sqlite> SELECT * FROM kvStore WHERE key='v9.c.o+d37/100'; -- Zoe contract instance admin facet
v9.c.o+d37/100|ko4295574

sqlite> SELECT * FROM kvStore WHERE key >= 'v1' AND key < 'v:' AND substr(key, -length('.c.ko4295574')) = '.c.ko4295574' AND key LIKE 'v%.c.ko4295574';
v1.c.ko4295574|R o-2920
v9.c.ko4295574|R o+d37/100

sqlite> SELECT * FROM kvStore WHERE key >= 'v1.' AND key < 'v1/' AND value LIKE '%o-2920%';
v1.c.ko4295574|R o-2920
v1.vs.vc.8.r0000000010:o-2924|{"body":"#{\"adminFacet\":\"$0.Alleged: adminFacet\",\"creatorFacet\":\"$1.Alleged: fluxAggregator creator\",\"governor\":\"$2.Alleged: InstanceHandle\",\"governorAdminFacet\":\"$3.Alleged: adminFacet\",\"governorCreatorFacet\":\"$4.Alleged: ContractGovernorKit creator\",\"instance\":\"$5.Alleged: InstanceHandle\",\"label\":\"stkATOM-USD_price_feed\",\"publicFacet\":\"$6.Alleged: fluxAggregator public\"}","slots":["o-2927","o-2926","o-2922","o-2920","o-2921","o-2924","o-2925"]}

sqlite> SELECT * FROM kvStore WHERE key >= 'v1.' AND key < 'v1/' AND value GLOB '*"o+??/8"*';
v1.vs.vc.1.sGovernedContractKits|{"body":"#\"$0.Alleged: mapStore\"","slots":["o+d6/8"]}
v1.vs.vc.5.sgovernedContractKits|{"body":"#\"$0.Alleged: mapStore\"","slots":["o+d6/8"]}

sqlite> SELECT * FROM kvStore WHERE key >= 'v1.' AND key < 'v1/' AND value GLOB '*"o+??/5"*';
v1.vs.vc.1.sBootstrap Powers|{"body":"#\"$0.Alleged: mapStore\"","slots":["o+d6/5"]}
v1.vs.vc.5.spowerStore|{"body":"#\"$0.Alleged: mapStore\"","slots":["o+d6/5"]}

sqlite> -- v1 bootstrap virtual collection 5 is "Bootstrap Powers" exposed to core eval scripts

sqlite> -- in that collection is "governedContractKits", which contains our contract instance kit by key o-2924

sqlite> SELECT * FROM kvStore WHERE key='v1.c.o-2924';
v1.c.o-2924|ko4295554

sqlite> SELECT * FROM kvStore WHERE key >= 'v1' AND key < 'v:' AND substr(key, -length('.c.ko4295554')) = '.c.ko4295554' AND key LIKE 'v%.c.ko4295554';
v1.c.ko4295554|R o-2924
v110.c.ko4295554|R o-71
v111.c.ko4295554|R o-54
v15.c.ko4295554|R o-243
v43.c.ko4295554|R o-1446627
v6.c.ko4295554|R o-170
v7.c.ko4295554|R o-295917
v9.c.ko4295554|R o+d29/99

sqlite> SELECT * FROM kvStore WHERE key >= 'v7.' AND key < 'v7/' AND value LIKE '%o-295917%';
v7.c.ko4295554|R o-295917
v7.vs.vc.5.sboard052184|{"body":"#\"$0.Alleged: InstanceHandle\"","slots":["o-295917"]}
v7.vs.vom.o+d11/5|{"valueDurability":{"body":"#\"mandatory\"","slots":[]},"publishCount":{"body":"#\"+40\"","slots":[]},"status":{"body":"#\"live\"","slots":[]},"hasValue":{"body":"#true","slots":[]},"value":{"body":"#[[\"ATOM-USD price feed\",\"$0.Alleged: InstanceHandle\"],[\"Crabble\",\"$1.Alleged: InstanceHandle\"],[\"CrabbleCommittee\",\"$2.Alleged: InstanceHandle\"],[\"CrabbleGovernor\",\"$3.Alleged: InstanceHandle\"],[\"VaultFactory\",\"$4.Alleged: InstanceHandle\"],[\"VaultFactoryGovernor\",\"$5.Alleged: InstanceHandle\"],[\"auctioneer\",\"$6.Alleged: InstanceHandle\"],[\"econCommitteeCharter\",\"$7.Alleged: InstanceHandle\"],[\"economicCommittee\",\"$8.Alleged: InstanceHandle\"],[\"feeDistributor\",\"$9.Alleged: InstanceHandle\"],[\"kread\",\"$10.Alleged: InstanceHandle\"],[\"kreadCommittee\",\"$11.Alleged: InstanceHandle\"],[\"kreadCommitteeCharter\",\"$12.Alleged: InstanceHandle\"],[\"provisionPool\",\"$13.Alleged: InstanceHandle\"],[\"psm-IST-DAI_axl\",\"$14.Alleged: InstanceHandle\"],[\"psm-IST-DAI_grv\",\"$15.Alleged: InstanceHandle\"],[\"psm-IST-USDC\",\"$16.Alleged: InstanceHandle\"],[\"psm-IST-USDC_axl\",\"$17.Alleged: InstanceHandle\"],[\"psm-IST-USDC_grv\",\"$18.Alleged: InstanceHandle\"],[\"psm-IST-USDT\",\"$19.Alleged: InstanceHandle\"],[\"psm-IST-USDT_axl\",\"$20.Alleged: InstanceHandle\"],[\"psm-IST-USDT_grv\",\"$21.Alleged: InstanceHandle\"],[\"reserve\",\"$22.Alleged: InstanceHandle\"],[\"reserveGovernor\",\"$23.Alleged: InstanceHandle\"],[\"scaledPriceAuthority-stATOM\",\"$24.Alleged: InstanceHandle\"],[\"scaledPriceAuthority-stOSMO\",\"$25.Alleged: InstanceHandle\"],[\"scaledPriceAuthority-stTIA\",\"$26.Alleged: InstanceHandle\"],[\"scaledPriceAuthority-stkATOM\",\"$27.Alleged: InstanceHandle\"],[\"stATOM-USD price feed\",\"$28.Alleged: InstanceHandle\"],[\"stOSMO-USD price feed\",\"$29.Alleged: InstanceHandle\"],[\"stTIA-USD price feed\",\"$30.Alleged: InstanceHandle\"],[\"stkATOM-USD price feed\",\"$31.Alleged: InstanceHandle\"],[\"walletFactory\",\"$32.Alleged: InstanceHandle\"]]","slots":["o-124","o-116341","o-116336","o-116342","o-121","o-134","o-689773","o-122","o-105","o-123","o-46029","o-46025","o-46022","o-125","o-132","o-133","o-68280","o-128","o-129","o-68305","o-130","o-131","o-119","o-126","o-55377","o-172282","o-175436","o-295918","o-55376","o-172281","o-175435","o-295917","o-127"]}}

sqlite> -- our Bootstrap Powers key (v1:o-2924/ko4295554/v7:o-295917) can be retrieved from the board with key "board052184"
```
  • Loading branch information
gibson042 committed Dec 23, 2024
1 parent 17027c9 commit 4a56d35
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 0 deletions.
3 changes: 3 additions & 0 deletions golang/cosmos/app/upgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,9 @@ func unreleasedUpgradeHandler(app *GaiaApp, targetUpgrade string) func(sdk.Conte
// vm.CoreProposalStepForModules(
// "@agoric/builders/scripts/vats/upgrade-asset-reserve.js",
// ),
// vm.CoreProposalStepForModules(
// "@agoric/builders/scripts/vats/terminate-original-stkATOM-USD-price-feed-governor.js",
// ),
// )
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/**
* @file Terminate v110 zcf-b1-9f877-stkATOM-USD_price_feed-governor.
*/

import { E } from '@endo/far';

/// <reference types="@agoric/vats/src/core/types-ambient"/>

/**
* @param {BootstrapPowers} powers
*/
export const terminateOriginalStkATOMPriceFeedGovernor = async ({
consume: { board, governedContractKits },
}) => {
const { Fail, quote: q } = assert;
const expectedLabel = 'stkATOM-USD_price_feed';
const contractInstanceHandle = await E(board).getValue('board052184');
// @ts-expect-error Property '[tag]' is missing
const instanceKit = await E(governedContractKits).get(contractInstanceHandle);
console.log(
`alleged ${q(expectedLabel)} governor contract instance kit`,
instanceKit,
);
const { label, governorAdminFacet, adminFacet } = instanceKit;
label === expectedLabel ||
Fail`unexpected instanceKit label, got ${label} but wanted ${q(expectedLabel)}`;
(adminFacet && adminFacet !== governorAdminFacet) ||
Fail`instanceKit adminFacet should have been present and different from governorAdminFacet but was ${adminFacet}`;
const reason = harden(Error(`core-eval terminating ${label} governor`));
await E(governorAdminFacet).terminateContract(reason);
console.log(`terminated ${label} governor`);
};
harden(terminateOriginalStkATOMPriceFeedGovernor);

export const getManifest = () => {
return {
manifest: {
[terminateOriginalStkATOMPriceFeedGovernor.name]: {
consume: { board: true, governedContractKits: true },
},
},
};
};

/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').CoreEvalBuilder} */
export const defaultProposalBuilder = async () =>
harden({
sourceSpec:
'@agoric/builders/scripts/vats/terminate-original-stkATOM-USD-price-feed-governor.js',
getManifestCall: ['getManifest'],
});

/** @type {import('@agoric/deploy-script-support/src/externalTypes.js').DeployScriptFunction} */
export default async (homeP, endowments) => {
const dspModule = await import('@agoric/deploy-script-support');
const { makeHelpers } = dspModule;
const { writeCoreEval } = await makeHelpers(homeP, endowments);
await writeCoreEval(
terminateOriginalStkATOMPriceFeedGovernor.name,
defaultProposalBuilder,
);
};

0 comments on commit 4a56d35

Please sign in to comment.