From 1749514b5b69a3112d60293ffc141885e4ff2edd Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Thu, 25 Apr 2024 11:33:15 -0700 Subject: [PATCH] chore(types): suppress deferals --- packages/SwingSet/misc-tools/classify-promises.js | 1 + packages/SwingSet/src/controller/initializeKernel.js | 1 + packages/SwingSet/src/devices/bundle/device-bundle.js | 1 + .../SwingSet/src/devices/vat-admin/device-vat-admin.js | 7 +++++++ packages/SwingSet/test/devices/device-raw-0.js | 1 + packages/governance/src/contractGovernance/paramManager.js | 4 ++-- packages/inter-protocol/src/auction/sortedOffers.js | 1 + packages/inter-protocol/src/econCommitteeCharter.js | 1 + packages/inter-protocol/src/proposals/econ-behaviors.js | 4 ++++ packages/inter-protocol/src/provisionPool.js | 1 + packages/inter-protocol/src/vaultFactory/vaultHolder.js | 1 + packages/inter-protocol/src/vaultFactory/vaultManager.js | 2 ++ .../test/swingsetTests/psmUpgrade/bootstrap-psm-upgrade.js | 2 ++ .../reserve/bootstrap-assetReserve-upgrade.js | 1 + packages/notifier/test/iterable-testing-tools.js | 4 ++-- packages/orchestration/src/exos/localchainAccountKit.js | 1 + packages/orchestration/src/exos/stakingAccountKit.js | 1 + packages/vats/src/core/startWalletFactory.js | 2 ++ packages/vats/src/core/utils.js | 1 + packages/vats/src/virtual-purse.js | 1 + packages/vats/test/test-bootstrapPayment.js | 1 + packages/vats/test/test-clientBundle.js | 1 + packages/vats/test/test-vat-bank-integration.js | 2 ++ packages/wallet/api/src/lib-wallet.js | 1 + packages/zoe/src/contractFacet/offerHandlerStorage.js | 5 +++++ 25 files changed, 44 insertions(+), 4 deletions(-) diff --git a/packages/SwingSet/misc-tools/classify-promises.js b/packages/SwingSet/misc-tools/classify-promises.js index 63bafaaf998..410d2b9dbd8 100755 --- a/packages/SwingSet/misc-tools/classify-promises.js +++ b/packages/SwingSet/misc-tools/classify-promises.js @@ -1,4 +1,5 @@ #!/usr/bin/env node +// @ts-nocheck XXX /* eslint no-labels: "off", no-extra-label: "off", no-underscore-dangle: "off" */ import process from 'process'; import sqlite3 from 'better-sqlite3'; diff --git a/packages/SwingSet/src/controller/initializeKernel.js b/packages/SwingSet/src/controller/initializeKernel.js index 67552acf629..3378a28c39f 100644 --- a/packages/SwingSet/src/controller/initializeKernel.js +++ b/packages/SwingSet/src/controller/initializeKernel.js @@ -212,6 +212,7 @@ export async function initializeKernel(config, kernelStorage, options = {}) { // See https://github.com/Agoric/agoric-sdk/issues/2780 errorIdNum: 60_000, }); + // @ts-expect-error xxx const args = kunser(m.serialize(harden([vatObj0s, deviceObj0s]))); const rootKref = exportRootObject(kernelKeeper, bootstrapVatID); const resultKpid = queueToKref(rootKref, 'bootstrap', args, 'panic'); diff --git a/packages/SwingSet/src/devices/bundle/device-bundle.js b/packages/SwingSet/src/devices/bundle/device-bundle.js index d4038c9d935..1b3dfa74d77 100644 --- a/packages/SwingSet/src/devices/bundle/device-bundle.js +++ b/packages/SwingSet/src/devices/bundle/device-bundle.js @@ -103,6 +103,7 @@ export function buildDevice(tools, endowments) { const dispatch = { invoke: (dnid, method, argsCapdata) => { + /** @type {any} */ const args = unserialize(argsCapdata); if (dnid === ROOT) { diff --git a/packages/SwingSet/src/devices/vat-admin/device-vat-admin.js b/packages/SwingSet/src/devices/vat-admin/device-vat-admin.js index 59e9d583852..3aec158d099 100644 --- a/packages/SwingSet/src/devices/vat-admin/device-vat-admin.js +++ b/packages/SwingSet/src/devices/vat-admin/device-vat-admin.js @@ -156,6 +156,7 @@ export function buildDevice(tools, endowments) { // D(devices.vatAdmin).createMeter(remaining, threshold) -> meterID if (method === 'createMeter') { + /** @type {any} */ const args = unserialize(argsCapdata); const [remaining, threshold] = args; assert.typeof(remaining, 'bigint', 'createMeter() remaining'); @@ -172,6 +173,7 @@ export function buildDevice(tools, endowments) { // D(devices.vatAdmin).addMeterRemaining(meterID, delta) if (method === 'addMeterRemaining') { + /** @type {any} */ const args = unserialize(argsCapdata); const [meterID, delta] = args; assert.typeof(meterID, 'string', 'addMeterRemaining() meterID'); @@ -182,6 +184,7 @@ export function buildDevice(tools, endowments) { // D(devices.vatAdmin).setMeterThreshold(meterID, threshold) if (method === 'setMeterThreshold') { + /** @type {any} */ const args = unserialize(argsCapdata); const [meterID, threshold] = args; assert.typeof(meterID, 'string', 'setMeterThreshold() meterID'); @@ -192,6 +195,7 @@ export function buildDevice(tools, endowments) { // D(devices.vatAdmin).getMeter(meterID) -> { remaining, threshold } if (method === 'getMeter') { + /** @type {any} */ const args = unserialize(argsCapdata); const [meterID] = args; assert.typeof(meterID, 'string', 'getMeter() meterID'); @@ -265,6 +269,7 @@ export function buildDevice(tools, endowments) { // D(devices.bundle).getBundleCap(id) -> bundlecap if (method === 'getBundleCap') { const args = unserialize(argsCapdata); + /** @type {any} */ const [bundleID] = args; assert.typeof(bundleID, 'string', 'getBundleCap() bundleID'); assert(bundleIDRE.test(bundleID), 'getBundleCap() not a bundleID'); @@ -273,6 +278,7 @@ export function buildDevice(tools, endowments) { // D(devices.bundle).getNamedBundleCap(name) -> bundlecap if (method === 'getNamedBundleCap') { const args = unserialize(argsCapdata); + /** @type {any} */ const [name] = args; assert.typeof(name, 'string', 'getNamedBundleCap() name'); let bundleID; @@ -287,6 +293,7 @@ export function buildDevice(tools, endowments) { // D(devices.bundle).getBundleIDByName(name) -> id if (method === 'getBundleIDByName') { const args = unserialize(argsCapdata); + /** @type {any} */ const [name] = args; assert.typeof(name, 'string', 'getBundleIDByName() name'); let bundleID; diff --git a/packages/SwingSet/test/devices/device-raw-0.js b/packages/SwingSet/test/devices/device-raw-0.js index 63e673f3dd3..d4e1ff1021b 100644 --- a/packages/SwingSet/test/devices/device-raw-0.js +++ b/packages/SwingSet/test/devices/device-raw-0.js @@ -17,6 +17,7 @@ export function buildDevice(tools, endowments) { const dispatch = { invoke: (dnid, method, argsCapdata) => { + /** @type {any} */ const args = unserialize(argsCapdata); if (dnid === ROOT) { diff --git a/packages/governance/src/contractGovernance/paramManager.js b/packages/governance/src/contractGovernance/paramManager.js index ed96f7cb3df..b9cca051cb5 100644 --- a/packages/governance/src/contractGovernance/paramManager.js +++ b/packages/governance/src/contractGovernance/paramManager.js @@ -49,7 +49,7 @@ const assertElectorateMatches = (paramManager, governedParams) => { * @property {(name: string, value: Invitation) => ParamManagerBuilder} addInvitation * @property {(name: string, value: bigint) => ParamManagerBuilder} addNat * @property {(name: string, value: Ratio) => ParamManagerBuilder} addRatio - * @property {(name: string, value: import('@endo/marshal').CopyRecord) => ParamManagerBuilder} addRecord + * @property {(name: string, value: import('@endo/marshal').CopyRecord) => ParamManagerBuilder} addRecord * @property {(name: string, value: string) => ParamManagerBuilder} addString * @property {(name: string, value: import('@agoric/time').Timestamp) => ParamManagerBuilder} addTimestamp * @property {(name: string, value: import('@agoric/time').RelativeTime) => ParamManagerBuilder} addRelativeTime @@ -184,7 +184,7 @@ const makeParamManagerBuilder = (publisherKit, zoe) => { return builder; }; - /** @type {(name: string, value: import('@endo/marshal').CopyRecord, builder: ParamManagerBuilder) => ParamManagerBuilder} */ + /** @type {(name: string, value: import('@endo/marshal').CopyRecord, builder: ParamManagerBuilder) => ParamManagerBuilder} */ const addRecord = (name, value, builder) => { const assertRecord = v => { passStyleOf(v); diff --git a/packages/inter-protocol/src/auction/sortedOffers.js b/packages/inter-protocol/src/auction/sortedOffers.js index 031c73e3ebe..f1d0e211d49 100644 --- a/packages/inter-protocol/src/auction/sortedOffers.js +++ b/packages/inter-protocol/src/auction/sortedOffers.js @@ -88,6 +88,7 @@ const bidScalingRatioFromKey = (bidScaleFloat, numBrand, useDecimals) => { * @returns {[normalizedPrice: Ratio, sequenceNumber: bigint]} */ export const fromPriceOfferKey = (key, numBrand, denomBrand, useDecimals) => { + // @ts-expect-error XXX const [pricePart, sequenceNumberPart] = decodeData(key); return [ priceRatioFromFloat(pricePart, numBrand, denomBrand, useDecimals), diff --git a/packages/inter-protocol/src/econCommitteeCharter.js b/packages/inter-protocol/src/econCommitteeCharter.js index e0ff7192393..6fc146cb167 100644 --- a/packages/inter-protocol/src/econCommitteeCharter.js +++ b/packages/inter-protocol/src/econCommitteeCharter.js @@ -79,6 +79,7 @@ export const start = async (zcf, privateArgs, baggage) => { const governor = instanceToGovernor.get(instance); return E(governor).voteOnParamChanges(counter, deadline, { ...path, + // @ts-expect-error XXX changes: params, }); }; diff --git a/packages/inter-protocol/src/proposals/econ-behaviors.js b/packages/inter-protocol/src/proposals/econ-behaviors.js index c5fec37281f..c3fbff712bd 100644 --- a/packages/inter-protocol/src/proposals/econ-behaviors.js +++ b/packages/inter-protocol/src/proposals/econ-behaviors.js @@ -166,6 +166,7 @@ export const setupReserve = async ({ ]); reserveKit.resolve( + // @ts-expect-error XXX harden({ label: 'AssetReserve', instance, @@ -350,6 +351,7 @@ export const startVaultFactory = async ( ); vaultFactoryKit.resolve( + // @ts-expect-error XXX harden({ label: 'VaultFactory', creatorFacet: vaultFactoryCreator, @@ -465,6 +467,7 @@ export const startRewardDistributor = async ({ const instanceKit = await E(zoe).startInstance( feeDistributor, { Fee: centralIssuer }, + // @ts-expect-error XXX feeDistributorTerms, undefined, 'feeDistributor', @@ -623,6 +626,7 @@ export const startAuctioneer = async ( ]); auctioneerKit.resolve( + // @ts-expect-error XXX harden({ label: 'auctioneer', creatorFacet: governedCreatorFacet, diff --git a/packages/inter-protocol/src/provisionPool.js b/packages/inter-protocol/src/provisionPool.js index 647aab72006..7eb37c61dd1 100644 --- a/packages/inter-protocol/src/provisionPool.js +++ b/packages/inter-protocol/src/provisionPool.js @@ -86,6 +86,7 @@ export const start = async (zcf, privateArgs, baggage) => { makeProvisionPoolKit({ // XXX governance can change the brand of the amount but should only be able to change the value // NB: changing the brand will break this pool + // @ts-expect-error XXX Brand AssetKind poolBrand: params.getPerAccountInitialAmount().brand, storageNode: privateArgs.storageNode, }), diff --git a/packages/inter-protocol/src/vaultFactory/vaultHolder.js b/packages/inter-protocol/src/vaultFactory/vaultHolder.js index 9552d27857f..c4a4acd49b7 100644 --- a/packages/inter-protocol/src/vaultFactory/vaultHolder.js +++ b/packages/inter-protocol/src/vaultFactory/vaultHolder.js @@ -52,6 +52,7 @@ export const prepareVaultHolder = (baggage, makeRecorderKit) => { */ (vault, storageNode) => { // must be the fully synchronous maker because the kit is held in durable state + // @ts-expect-error XXX Patterns const topicKit = makeRecorderKit(storageNode, PUBLIC_TOPICS.vault[1]); return { topicKit, vault }; diff --git a/packages/inter-protocol/src/vaultFactory/vaultManager.js b/packages/inter-protocol/src/vaultFactory/vaultManager.js index fbbde1eb542..c3f74b98bb0 100644 --- a/packages/inter-protocol/src/vaultFactory/vaultManager.js +++ b/packages/inter-protocol/src/vaultFactory/vaultManager.js @@ -439,7 +439,9 @@ export const prepareVaultManagerKit = ( collateralUnit, debtBrand, ); + // @ts-expect-error XXX quotes ephemera.storedQuotesNotifier = makeStoredNotifier( + // @ts-expect-error XXX quotes quoteNotifier, E(storageNode).makeChildNode('quotes'), marshaller, diff --git a/packages/inter-protocol/test/swingsetTests/psmUpgrade/bootstrap-psm-upgrade.js b/packages/inter-protocol/test/swingsetTests/psmUpgrade/bootstrap-psm-upgrade.js index e3a2d4c9e87..3cb5c471c3d 100644 --- a/packages/inter-protocol/test/swingsetTests/psmUpgrade/bootstrap-psm-upgrade.js +++ b/packages/inter-protocol/test/swingsetTests/psmUpgrade/bootstrap-psm-upgrade.js @@ -131,6 +131,7 @@ export const buildRootObject = async () => { * @param {any} devices */ bootstrap: async (vats, devices) => { + // @ts-expect-error XXX adminNode vatAdmin = await E(vats.vatAdmin).createVatAdminService(devices.vatAdmin); ({ feeMintAccess, zoeService } = await E(vats.zoe).buildZoe( vatAdmin, @@ -215,6 +216,7 @@ export const buildRootObject = async () => { governorFacets = await E(zoeService).startInstance( NonNullish(installations.puppetContractGovernor), undefined, + // @ts-expect-error XXX timer governorTerms, { governed: { diff --git a/packages/inter-protocol/test/swingsetTests/reserve/bootstrap-assetReserve-upgrade.js b/packages/inter-protocol/test/swingsetTests/reserve/bootstrap-assetReserve-upgrade.js index c6f00c8655a..fce40bbd820 100644 --- a/packages/inter-protocol/test/swingsetTests/reserve/bootstrap-assetReserve-upgrade.js +++ b/packages/inter-protocol/test/swingsetTests/reserve/bootstrap-assetReserve-upgrade.js @@ -188,6 +188,7 @@ export const buildRootObject = async () => { governorFacets = await E(zoeService).startInstance( NonNullish(installations.puppetContractGovernor), undefined, + // @ts-expect-error XXX timer governorTerms, { governed: { diff --git a/packages/notifier/test/iterable-testing-tools.js b/packages/notifier/test/iterable-testing-tools.js index 6849cd80704..1f74a720fa7 100644 --- a/packages/notifier/test/iterable-testing-tools.js +++ b/packages/notifier/test/iterable-testing-tools.js @@ -65,7 +65,7 @@ const refReason = Error('bar'); * * @param {boolean} fails Does the returned async iterable finish successfully * or fail? - * @returns {AsyncIterable} + * @returns {AsyncIterable} */ const makeTestIterable = fails => { return harden({ @@ -251,7 +251,7 @@ export const paula = iterationObserver => { * See the Alice example in the README * * @param {AsyncIterable} asyncIterable - * @returns {Promise} + * @returns {Promise} */ export const alice = async asyncIterable => { const log = []; diff --git a/packages/orchestration/src/exos/localchainAccountKit.js b/packages/orchestration/src/exos/localchainAccountKit.js index 7a023a96844..37c71421b7e 100644 --- a/packages/orchestration/src/exos/localchainAccountKit.js +++ b/packages/orchestration/src/exos/localchainAccountKit.js @@ -61,6 +61,7 @@ export const prepareLocalchainAccountKit = (baggage, makeRecorderKit, zcf) => { */ (account, storageNode) => { // must be the fully synchronous maker because the kit is held in durable state + // @ts-expect-error XXX Patterns const topicKit = makeRecorderKit(storageNode, PUBLIC_TOPICS.account[1]); return { account, topicKit }; diff --git a/packages/orchestration/src/exos/stakingAccountKit.js b/packages/orchestration/src/exos/stakingAccountKit.js index ba0096e496a..c32f492fcc3 100644 --- a/packages/orchestration/src/exos/stakingAccountKit.js +++ b/packages/orchestration/src/exos/stakingAccountKit.js @@ -117,6 +117,7 @@ export const prepareStakingAccountKit = (baggage, makeRecorderKit, zcf) => { */ (account, storageNode, chainAddress, icqConnection, bondDenom) => { // must be the fully synchronous maker because the kit is held in durable state + // @ts-expect-error XXX Patterns const topicKit = makeRecorderKit(storageNode, PUBLIC_TOPICS.account[1]); return { account, chainAddress, topicKit, icqConnection, bondDenom }; diff --git a/packages/vats/src/core/startWalletFactory.js b/packages/vats/src/core/startWalletFactory.js index 9b04c34227d..a2dd87df342 100644 --- a/packages/vats/src/core/startWalletFactory.js +++ b/packages/vats/src/core/startWalletFactory.js @@ -154,10 +154,12 @@ export const startWalletFactory = async ( slotToBoardRemote, ); + /** @type {() => any} */ const reviveOldMetrics = () => { if (!dataReviver.has(OLD_POOL_METRICS_STORAGE_PATH)) { return undefined; } + /** @type {any} */ const oldPoolMetrics = dataReviver.getItem(OLD_POOL_METRICS_STORAGE_PATH); const newBrandFromOldSlotID = makeMap([ [oldPoolMetrics.totalMintedProvided.brand.getBoardId(), feeBrand], diff --git a/packages/vats/src/core/utils.js b/packages/vats/src/core/utils.js index 4256abf1d13..69b7484cc26 100644 --- a/packages/vats/src/core/utils.js +++ b/packages/vats/src/core/utils.js @@ -362,6 +362,7 @@ export const makeVatSpace = ( { get: (_target, name, _rx) => { assert.typeof(name, 'string'); + // @ts-expect-error XXX return provideAsync(name, createVatByName).then(vat => { if (!durableStore.has(name)) { durableStore.init(name, vat); diff --git a/packages/vats/src/virtual-purse.js b/packages/vats/src/virtual-purse.js index 8f7e1c97fd4..34064e1acfe 100644 --- a/packages/vats/src/virtual-purse.js +++ b/packages/vats/src/virtual-purse.js @@ -303,6 +303,7 @@ export const prepareVirtualPurse = zone => { recoveryPurse, escrowPurse, }).purse; + // @ts-expect-error XXX return vpurse; }; diff --git a/packages/vats/test/test-bootstrapPayment.js b/packages/vats/test/test-bootstrapPayment.js index b59f636df00..efc1081e512 100644 --- a/packages/vats/test/test-bootstrapPayment.js +++ b/packages/vats/test/test-bootstrapPayment.js @@ -40,6 +40,7 @@ test.before(async (/** @type {CentralSupplyTestContext} */ t) => { }; t.context = await deeplyFulfilled( + // @ts-expect-error XXX harden({ zoe, feeMintAccess: feeMintAccessP, diff --git a/packages/vats/test/test-clientBundle.js b/packages/vats/test/test-clientBundle.js index fcc066c55c1..e44fb8a5878 100644 --- a/packages/vats/test/test-clientBundle.js +++ b/packages/vats/test/test-clientBundle.js @@ -45,6 +45,7 @@ test('connectFaucet produces payments', async t => { const { zoe, feeMintAccessP, vatAdminSvc } = await setUpZoeForTest({ feeIssuerConfig, + // @ts-expect-error XXX vatAdminSvc: makePopulatedFakeVatAdmin().vatAdminService, }); produce.zoe.resolve(zoe); diff --git a/packages/vats/test/test-vat-bank-integration.js b/packages/vats/test/test-vat-bank-integration.js index 1ef20aa8ef5..d8f6fcce584 100644 --- a/packages/vats/test/test-vat-bank-integration.js +++ b/packages/vats/test/test-vat-bank-integration.js @@ -34,9 +34,11 @@ test('mintInitialSupply, addBankAssets bootstrap actions', async t => { produce.agoricNamesAdmin.resolve(agoricNamesAdmin); const { vatAdminService } = makePopulatedFakeVatAdmin(); + // @ts-expect-error XXX const { zoeService, feeMintAccess: fma } = makeZoeKitForTest(vatAdminService); produce.zoe.resolve(zoeService); produce.feeMintAccess.resolve(fma); + // @ts-expect-error XXX produce.vatAdminSvc.resolve(vatAdminService); await installBootContracts({ consume, diff --git a/packages/wallet/api/src/lib-wallet.js b/packages/wallet/api/src/lib-wallet.js index d94f1262397..fd0947ea11a 100644 --- a/packages/wallet/api/src/lib-wallet.js +++ b/packages/wallet/api/src/lib-wallet.js @@ -754,6 +754,7 @@ export function makeWalletRoot({ * @param {string} [address] */ const addContact = async (petname, actions, address = undefined) => { + // @ts-expect-error XXX ERef const already = await E(board).has(actions); let depositFacet; if (already) { diff --git a/packages/zoe/src/contractFacet/offerHandlerStorage.js b/packages/zoe/src/contractFacet/offerHandlerStorage.js index f874a56cba0..26ff65aaff1 100644 --- a/packages/zoe/src/contractFacet/offerHandlerStorage.js +++ b/packages/zoe/src/contractFacet/offerHandlerStorage.js @@ -6,6 +6,11 @@ import { canBeDurable, provideDurableWeakMapStore } from '@agoric/vat-data'; import { defineDurableHandle } from '../makeHandle.js'; +/** + * @import {RemotableBrand} from '@endo/eventual-send'; + * @import {RemotableObject} from '@endo/pass-style'; + */ + /** * @typedef {RemotableBrand & RemotableObject & OfferHandler} PassableOfferHandler */