Skip to content

Commit

Permalink
chore(types): suppress deferals
Browse files Browse the repository at this point in the history
  • Loading branch information
turadg committed May 8, 2024
1 parent 3eeffaa commit 1749514
Show file tree
Hide file tree
Showing 25 changed files with 44 additions and 4 deletions.
1 change: 1 addition & 0 deletions packages/SwingSet/misc-tools/classify-promises.js
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
1 change: 1 addition & 0 deletions packages/SwingSet/src/controller/initializeKernel.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
1 change: 1 addition & 0 deletions packages/SwingSet/src/devices/bundle/device-bundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ export function buildDevice(tools, endowments) {

const dispatch = {
invoke: (dnid, method, argsCapdata) => {
/** @type {any} */
const args = unserialize(argsCapdata);

if (dnid === ROOT) {
Expand Down
7 changes: 7 additions & 0 deletions packages/SwingSet/src/devices/vat-admin/device-vat-admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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');
Expand All @@ -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');
Expand All @@ -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');
Expand Down Expand Up @@ -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');
Expand All @@ -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;
Expand All @@ -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;
Expand Down
1 change: 1 addition & 0 deletions packages/SwingSet/test/devices/device-raw-0.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export function buildDevice(tools, endowments) {

const dispatch = {
invoke: (dnid, method, argsCapdata) => {
/** @type {any} */
const args = unserialize(argsCapdata);

if (dnid === ROOT) {
Expand Down
4 changes: 2 additions & 2 deletions packages/governance/src/contractGovernance/paramManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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<unknown>) => ParamManagerBuilder} addRecord
* @property {(name: string, value: import('@endo/marshal').CopyRecord<any>) => 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
Expand Down Expand Up @@ -184,7 +184,7 @@ const makeParamManagerBuilder = (publisherKit, zoe) => {
return builder;
};

/** @type {(name: string, value: import('@endo/marshal').CopyRecord<unknown>, builder: ParamManagerBuilder) => ParamManagerBuilder} */
/** @type {(name: string, value: import('@endo/marshal').CopyRecord, builder: ParamManagerBuilder) => ParamManagerBuilder} */
const addRecord = (name, value, builder) => {
const assertRecord = v => {
passStyleOf(v);
Expand Down
1 change: 1 addition & 0 deletions packages/inter-protocol/src/auction/sortedOffers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
1 change: 1 addition & 0 deletions packages/inter-protocol/src/econCommitteeCharter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
};
Expand Down
4 changes: 4 additions & 0 deletions packages/inter-protocol/src/proposals/econ-behaviors.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ export const setupReserve = async ({
]);

reserveKit.resolve(
// @ts-expect-error XXX
harden({
label: 'AssetReserve',
instance,
Expand Down Expand Up @@ -350,6 +351,7 @@ export const startVaultFactory = async (
);

vaultFactoryKit.resolve(
// @ts-expect-error XXX
harden({
label: 'VaultFactory',
creatorFacet: vaultFactoryCreator,
Expand Down Expand Up @@ -465,6 +467,7 @@ export const startRewardDistributor = async ({
const instanceKit = await E(zoe).startInstance(
feeDistributor,
{ Fee: centralIssuer },
// @ts-expect-error XXX
feeDistributorTerms,
undefined,
'feeDistributor',
Expand Down Expand Up @@ -623,6 +626,7 @@ export const startAuctioneer = async (
]);

auctioneerKit.resolve(
// @ts-expect-error XXX
harden({
label: 'auctioneer',
creatorFacet: governedCreatorFacet,
Expand Down
1 change: 1 addition & 0 deletions packages/inter-protocol/src/provisionPool.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}),
Expand Down
1 change: 1 addition & 0 deletions packages/inter-protocol/src/vaultFactory/vaultHolder.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
Expand Down
2 changes: 2 additions & 0 deletions packages/inter-protocol/src/vaultFactory/vaultManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -215,6 +216,7 @@ export const buildRootObject = async () => {
governorFacets = await E(zoeService).startInstance(
NonNullish(installations.puppetContractGovernor),
undefined,
// @ts-expect-error XXX timer
governorTerms,
{
governed: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,7 @@ export const buildRootObject = async () => {
governorFacets = await E(zoeService).startInstance(
NonNullish(installations.puppetContractGovernor),
undefined,
// @ts-expect-error XXX timer
governorTerms,
{
governed: {
Expand Down
4 changes: 2 additions & 2 deletions packages/notifier/test/iterable-testing-tools.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ const refReason = Error('bar');
*
* @param {boolean} fails Does the returned async iterable finish successfully
* or fail?
* @returns {AsyncIterable<Passable>}
* @returns {AsyncIterable<any>}
*/
const makeTestIterable = fails => {
return harden({
Expand Down Expand Up @@ -251,7 +251,7 @@ export const paula = iterationObserver => {
* See the Alice example in the README
*
* @param {AsyncIterable<Passable>} asyncIterable
* @returns {Promise<Passable[]>}
* @returns {Promise<any[]>}
*/
export const alice = async asyncIterable => {
const log = [];
Expand Down
1 change: 1 addition & 0 deletions packages/orchestration/src/exos/localchainAccountKit.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
Expand Down
1 change: 1 addition & 0 deletions packages/orchestration/src/exos/stakingAccountKit.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
Expand Down
2 changes: 2 additions & 0 deletions packages/vats/src/core/startWalletFactory.js
Original file line number Diff line number Diff line change
Expand Up @@ -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],
Expand Down
1 change: 1 addition & 0 deletions packages/vats/src/core/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions packages/vats/src/virtual-purse.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,7 @@ export const prepareVirtualPurse = zone => {
recoveryPurse,
escrowPurse,
}).purse;
// @ts-expect-error XXX
return vpurse;
};

Expand Down
1 change: 1 addition & 0 deletions packages/vats/test/test-bootstrapPayment.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ test.before(async (/** @type {CentralSupplyTestContext} */ t) => {
};

t.context = await deeplyFulfilled(
// @ts-expect-error XXX
harden({
zoe,
feeMintAccess: feeMintAccessP,
Expand Down
1 change: 1 addition & 0 deletions packages/vats/test/test-clientBundle.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions packages/vats/test/test-vat-bank-integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions packages/wallet/api/src/lib-wallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
5 changes: 5 additions & 0 deletions packages/zoe/src/contractFacet/offerHandlerStorage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down

0 comments on commit 1749514

Please sign in to comment.