diff --git a/.gitignore b/.gitignore index 4868d9a80f4..a4204d8a812 100644 --- a/.gitignore +++ b/.gitignore @@ -42,8 +42,14 @@ typings/ # Output of 'npm pack' *.tgz -# Yarn Integrity file -.yarn-integrity +# Yarn (https://yarnpkg.com/getting-started/qa#which-files-should-be-gitignored) +.pnp.* +.yarn/* +!.yarn/patches +!.yarn/plugins +!.yarn/releases +!.yarn/sdks +!.yarn/versions # dotenv environment variables file .env diff --git a/a3p-integration/proposals/z:acceptance/lib/vaults.mts b/a3p-integration/proposals/z:acceptance/lib/vaults.mts new file mode 100644 index 00000000000..b85eeb76798 --- /dev/null +++ b/a3p-integration/proposals/z:acceptance/lib/vaults.mts @@ -0,0 +1,213 @@ +/* eslint-disable @jessie.js/safe-await-separator */ +/* eslint-env node */ + +import { strict as assert } from 'node:assert'; + +import { + addUser, + agops, + agoric, + ATOM_DENOM, + executeOffer, + GOV1ADDR, + GOV2ADDR, + GOV3ADDR, + provisionSmartWallet, + waitForBlock, +} from '@agoric/synthetic-chain'; + +const govAccounts = [GOV1ADDR, GOV2ADDR, GOV3ADDR]; + +export const ISTunit = 1_000_000n; // aka displayInfo: { decimalPlaces: 6 } + +const DEFAULT_TIMEOUT = 65000; + +const proposeNewAuctionParams = async ( + address: string, + startFequency: any, + clockStep: any, + priceLockPeriod: any, +) => { + const charterAcceptOfferId = await agops.ec( + 'find-continuing-id', + '--for', + `${'charter\\ member\\ invitation'}`, + '--from', + address, + ); + + return executeOffer( + address, + agops.auctioneer( + 'proposeParamChange', + '--charterAcceptOfferId', + charterAcceptOfferId, + '--start-frequency', + startFequency, + '--clock-step', + clockStep, + '--price-lock-period', + priceLockPeriod, + ), + ); +}; + +const voteForNewParams = (accounts: string[], position: number) => { + console.log('ACTIONS voting for position', position, 'using', accounts); + return Promise.all( + accounts.map((account: string) => + agops.ec('vote', '--forPosition', position, '--send-from', account), + ), + ); +}; + +const paramChangeOfferGeneration = async ( + previousOfferId: string, + voteDur: number, + debtLimit: number | bigint, +) => { + const voteDurSec = BigInt(voteDur); + const debtLimitValue = BigInt(debtLimit) * ISTunit; + const toSec = (ms: number) => BigInt(Math.round(ms / 1000)); + + const id = `propose-${Date.now()}`; + const deadline = toSec(Date.now()) + voteDurSec; + + const zip = (xs: any[], ys: { [x: string]: any }) => + xs.map((x: any, i: string | number) => [x, ys[i]]); + const fromSmallCapsEntries = (txt: string) => { + const { body, slots } = JSON.parse(txt); + const theEntries = zip(JSON.parse(body.slice(1)), slots).map( + ([[name, ref], boardID]) => { + const iface = ref.replace(/^\$\d+\./, ''); + return [name, { iface, boardID }]; + }, + ); + return Object.fromEntries(theEntries); + }; + + const slots = [] as string[]; // XXX global mutable state + const smallCaps = { + Nat: (n: any) => `+${n}`, + // XXX mutates obj + ref: (obj: { ix: string; boardID: any; iface: any }) => { + if (obj.ix) return obj.ix; + const ix = slots.length; + slots.push(obj.boardID); + obj.ix = `$${ix}.Alleged: ${obj.iface}`; + return obj.ix; + }, + }; + + const instance = fromSmallCapsEntries( + await agoric.follow('-lF', ':published.agoricNames.instance', '-o', 'text'), + ); + assert(instance.VaultFactory); + + const brand = fromSmallCapsEntries( + await agoric.follow('-lF', ':published.agoricNames.brand', '-o', 'text'), + ); + assert(brand.IST); + assert(brand.ATOM); + + const body = { + method: 'executeOffer', + offer: { + id, + invitationSpec: { + invitationMakerName: 'VoteOnParamChange', + previousOffer: previousOfferId, + source: 'continuing', + }, + offerArgs: { + deadline: smallCaps.Nat(deadline), + instance: smallCaps.ref(instance.VaultFactory), + params: { + DebtLimit: { + brand: smallCaps.ref(brand.IST), + value: smallCaps.Nat(debtLimitValue), + }, + }, + path: { + paramPath: { + key: { + collateralBrand: smallCaps.ref(brand.ATOM), + }, + }, + }, + }, + proposal: {}, + }, + }; + + const capData = { body: `#${JSON.stringify(body)}`, slots }; + return JSON.stringify(capData); +}; +export const provisionWallet = async (user: string) => { + const userAddress = await addUser(user); + + await provisionSmartWallet( + userAddress, + `20000000ubld,100000000${ATOM_DENOM}`, + ); + await waitForBlock(); +}; + +export const implementNewAuctionParams = async ( + address: string, + oracles: { address: string; id: string }[], + startFequency: number, + clockStep: number, + priceLockPeriod: number, +) => { + await waitForBlock(3); + + await proposeNewAuctionParams( + address, + startFequency, + clockStep, + priceLockPeriod, + ); + + console.log('ACTIONS voting for new auction params'); + await voteForNewParams(govAccounts, 0); + + console.log('ACTIONS wait for the vote deadline to pass'); + await new Promise(r => setTimeout(r, DEFAULT_TIMEOUT)); +}; + +export const proposeNewDebtCeiling = async ( + address: string, + debtLimit: number | bigint, +) => { + const charterAcceptOfferId = await agops.ec( + 'find-continuing-id', + '--for', + `${'charter\\ member\\ invitation'}`, + '--from', + address, + ); + + const offer = await paramChangeOfferGeneration( + charterAcceptOfferId, + 30, + debtLimit, + ); + + console.log('ACTIONS proposing new debt ceiling', offer); + + return executeOffer(address, offer); +}; + +export const setDebtLimit = async ( + address: string, + debtLimit: number | bigint, +) => { + console.log('ACTIONS Setting debt limit'); + + await proposeNewDebtCeiling(address, debtLimit); + await voteForNewParams(govAccounts, 0); + + console.log('ACTIONS wait for the vote to pass'); + await new Promise(r => setTimeout(r, DEFAULT_TIMEOUT)); +}; diff --git a/a3p-integration/proposals/z:acceptance/package.json b/a3p-integration/proposals/z:acceptance/package.json index 0891c85d62a..0c0432f19a5 100644 --- a/a3p-integration/proposals/z:acceptance/package.json +++ b/a3p-integration/proposals/z:acceptance/package.json @@ -1,12 +1,13 @@ { "agoricProposal": { - "type": "/cosmos.params.v1beta1.ParameterChangeProposal" + "type": "/agoric.swingset.CoreEvalProposal" }, "type": "module", "license": "Apache-2.0", "dependencies": { "@agoric/synthetic-chain": "^0.1.0", - "ava": "^6.1.2" + "ava": "^6.1.2", + "tsx": "^4.17.0" }, "ava": { "concurrency": 1, @@ -18,5 +19,8 @@ "scripts": { "agops": "yarn --cwd /usr/src/agoric-sdk/ --silent agops" }, - "packageManager": "yarn@4.2.2" + "packageManager": "yarn@4.2.2", + "devDependencies": { + "typescript": "^5.5.4" + } } diff --git a/a3p-integration/proposals/z:acceptance/scripts/test-vaults.mts b/a3p-integration/proposals/z:acceptance/scripts/test-vaults.mts new file mode 100755 index 00000000000..a4e5e7f9e5f --- /dev/null +++ b/a3p-integration/proposals/z:acceptance/scripts/test-vaults.mts @@ -0,0 +1,83 @@ +#!/usr/bin/env tsx +/* eslint-disable @jessie.js/safe-await-separator */ + +import { + adjustVault, + agops, + agoric, + closeVault, + getUser, + GOV1ADDR, + GOV2ADDR, + newOfferId, + openVault, +} from '@agoric/synthetic-chain'; +import assert from 'node:assert/strict'; +import { + implementNewAuctionParams, + ISTunit, + provisionWallet, + setDebtLimit, +} from '../lib/vaults.mjs'; + +const START_FREQUENCY = 600; // StartFrequency: 600s (auction runs every 10m) +const CLOCK_STEP = 20; // ClockStep: 20s (ensures auction completes in time) +const PRICE_LOCK_PERIOD = 300; +const oraclesAddresses = [GOV1ADDR, GOV2ADDR]; + +const oracles = [] as { address: string; id: string }[]; +for (const oracle of oraclesAddresses) { + const offerId = await newOfferId(); + oracles.push({ address: oracle, id: offerId }); +} + +// console.log('Ensure user2 provisioned'); +// await provisionWallet('user2'); + +// console.log('Ensure auction params have changed'); +// await implementNewAuctionParams( +// GOV1ADDR, +// oracles, +// START_FREQUENCY, +// CLOCK_STEP, +// PRICE_LOCK_PERIOD, +// ); + +// const govParams = await agoric.follow('-lF', ':published.auction.governance'); +// assert.equal(govParams.current.ClockStep.value.relValue, CLOCK_STEP.toString()); +// assert.equal( +// govParams.current.StartFrequency.value.relValue, +// START_FREQUENCY.toString(), +// ); + +console.log('Ensure debt ceiling changes'); +const limit = 45_000_000n; +await setDebtLimit(GOV1ADDR, limit); +const params = await agoric.follow( + '-lF', + ':published.vaultFactory.managers.manager0.governance', +); +assert.equal(params.current.DebtLimit.value.value, String(limit * ISTunit)); + +console.log('Open Vaults'); +const currentVaults = await agops.vaults('list', '--from', GOV1ADDR); +assert.equal(currentVaults.length, 0); + +const vaults = [ + { mint: 5.0, collateral: 9.0 }, + { mint: 6.0, collateral: 10.0 }, +]; + +for (const vault of vaults) { + await openVault(GOV1ADDR, vault.mint, vault.collateral); +} + +await adjustVault(GOV1ADDR, 'vault0', { wantCollateral: 1.0 }); +await adjustVault(GOV1ADDR, 'vault0', { wantMinted: 1.0 }); +await closeVault(GOV1ADDR, 'vault1', 6.06); + +const user2 = await getUser('user2'); +await openVault(user2, 7, 11); +await adjustVault(user2, 'vault2', { giveMinted: 1.5 }); +await adjustVault(user2, 'vault2', { giveCollateral: 2.0 }); +await closeVault(user2, 'vault2', 5.75); diff --git a/a3p-integration/proposals/z:acceptance/test.sh b/a3p-integration/proposals/z:acceptance/test.sh index 7e4b0145a04..75549f654c4 100755 --- a/a3p-integration/proposals/z:acceptance/test.sh +++ b/a3p-integration/proposals/z:acceptance/test.sh @@ -1,5 +1,5 @@ #!/bin/bash - +set -ueo pipefail # Place here any test that should be executed using the executed proposal. # The effects of this step are not persisted in further proposal layers. @@ -10,7 +10,11 @@ yarn ava initial.test.js GLOBIGNORE=initial.test.js yarn ava ./*.test.js -./create-kread-item-test.sh +npm install -g tsx +scripts/test-vaults.mts + +# DEBUGGING +# ./create-kread-item-test.sh -./state-sync-snapshots-test.sh -./genesis-test.sh +# ./state-sync-snapshots-test.sh +# ./genesis-test.sh diff --git a/a3p-integration/proposals/z:acceptance/tsconfig.json b/a3p-integration/proposals/z:acceptance/tsconfig.json index 02e3bea3c6d..795ebdd04fc 100644 --- a/a3p-integration/proposals/z:acceptance/tsconfig.json +++ b/a3p-integration/proposals/z:acceptance/tsconfig.json @@ -2,11 +2,14 @@ "compilerOptions": { "noEmit": true, "target": "esnext", - "module": "esnext", + "module": "NodeNext", + "moduleResolution": "NodeNext", "allowJs": true, "checkJs": true, "strict": false, "strictNullChecks": true, - "noImplicitThis": true + "noImplicitThis": true, + // XXX synthetic-chain has some errors + "skipLibCheck": true, } } diff --git a/a3p-integration/proposals/z:acceptance/yarn.lock b/a3p-integration/proposals/z:acceptance/yarn.lock index 708f6030037..376240ba41f 100644 --- a/a3p-integration/proposals/z:acceptance/yarn.lock +++ b/a3p-integration/proposals/z:acceptance/yarn.lock @@ -26,6 +26,174 @@ __metadata: languageName: node linkType: hard +"@esbuild/aix-ppc64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/aix-ppc64@npm:0.23.1" + conditions: os=aix & cpu=ppc64 + languageName: node + linkType: hard + +"@esbuild/android-arm64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/android-arm64@npm:0.23.1" + conditions: os=android & cpu=arm64 + languageName: node + linkType: hard + +"@esbuild/android-arm@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/android-arm@npm:0.23.1" + conditions: os=android & cpu=arm + languageName: node + linkType: hard + +"@esbuild/android-x64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/android-x64@npm:0.23.1" + conditions: os=android & cpu=x64 + languageName: node + linkType: hard + +"@esbuild/darwin-arm64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/darwin-arm64@npm:0.23.1" + conditions: os=darwin & cpu=arm64 + languageName: node + linkType: hard + +"@esbuild/darwin-x64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/darwin-x64@npm:0.23.1" + conditions: os=darwin & cpu=x64 + languageName: node + linkType: hard + +"@esbuild/freebsd-arm64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/freebsd-arm64@npm:0.23.1" + conditions: os=freebsd & cpu=arm64 + languageName: node + linkType: hard + +"@esbuild/freebsd-x64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/freebsd-x64@npm:0.23.1" + conditions: os=freebsd & cpu=x64 + languageName: node + linkType: hard + +"@esbuild/linux-arm64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/linux-arm64@npm:0.23.1" + conditions: os=linux & cpu=arm64 + languageName: node + linkType: hard + +"@esbuild/linux-arm@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/linux-arm@npm:0.23.1" + conditions: os=linux & cpu=arm + languageName: node + linkType: hard + +"@esbuild/linux-ia32@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/linux-ia32@npm:0.23.1" + conditions: os=linux & cpu=ia32 + languageName: node + linkType: hard + +"@esbuild/linux-loong64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/linux-loong64@npm:0.23.1" + conditions: os=linux & cpu=loong64 + languageName: node + linkType: hard + +"@esbuild/linux-mips64el@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/linux-mips64el@npm:0.23.1" + conditions: os=linux & cpu=mips64el + languageName: node + linkType: hard + +"@esbuild/linux-ppc64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/linux-ppc64@npm:0.23.1" + conditions: os=linux & cpu=ppc64 + languageName: node + linkType: hard + +"@esbuild/linux-riscv64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/linux-riscv64@npm:0.23.1" + conditions: os=linux & cpu=riscv64 + languageName: node + linkType: hard + +"@esbuild/linux-s390x@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/linux-s390x@npm:0.23.1" + conditions: os=linux & cpu=s390x + languageName: node + linkType: hard + +"@esbuild/linux-x64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/linux-x64@npm:0.23.1" + conditions: os=linux & cpu=x64 + languageName: node + linkType: hard + +"@esbuild/netbsd-x64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/netbsd-x64@npm:0.23.1" + conditions: os=netbsd & cpu=x64 + languageName: node + linkType: hard + +"@esbuild/openbsd-arm64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/openbsd-arm64@npm:0.23.1" + conditions: os=openbsd & cpu=arm64 + languageName: node + linkType: hard + +"@esbuild/openbsd-x64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/openbsd-x64@npm:0.23.1" + conditions: os=openbsd & cpu=x64 + languageName: node + linkType: hard + +"@esbuild/sunos-x64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/sunos-x64@npm:0.23.1" + conditions: os=sunos & cpu=x64 + languageName: node + linkType: hard + +"@esbuild/win32-arm64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/win32-arm64@npm:0.23.1" + conditions: os=win32 & cpu=arm64 + languageName: node + linkType: hard + +"@esbuild/win32-ia32@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/win32-ia32@npm:0.23.1" + conditions: os=win32 & cpu=ia32 + languageName: node + linkType: hard + +"@esbuild/win32-x64@npm:0.23.1": + version: 0.23.1 + resolution: "@esbuild/win32-x64@npm:0.23.1" + conditions: os=win32 & cpu=x64 + languageName: node + linkType: hard + "@isaacs/cliui@npm:^8.0.2": version: 8.0.2 resolution: "@isaacs/cliui@npm:8.0.2" @@ -772,6 +940,89 @@ __metadata: languageName: node linkType: hard +"esbuild@npm:~0.23.0": + version: 0.23.1 + resolution: "esbuild@npm:0.23.1" + dependencies: + "@esbuild/aix-ppc64": "npm:0.23.1" + "@esbuild/android-arm": "npm:0.23.1" + "@esbuild/android-arm64": "npm:0.23.1" + "@esbuild/android-x64": "npm:0.23.1" + "@esbuild/darwin-arm64": "npm:0.23.1" + "@esbuild/darwin-x64": "npm:0.23.1" + "@esbuild/freebsd-arm64": "npm:0.23.1" + "@esbuild/freebsd-x64": "npm:0.23.1" + "@esbuild/linux-arm": "npm:0.23.1" + "@esbuild/linux-arm64": "npm:0.23.1" + "@esbuild/linux-ia32": "npm:0.23.1" + "@esbuild/linux-loong64": "npm:0.23.1" + "@esbuild/linux-mips64el": "npm:0.23.1" + "@esbuild/linux-ppc64": "npm:0.23.1" + "@esbuild/linux-riscv64": "npm:0.23.1" + "@esbuild/linux-s390x": "npm:0.23.1" + "@esbuild/linux-x64": "npm:0.23.1" + "@esbuild/netbsd-x64": "npm:0.23.1" + "@esbuild/openbsd-arm64": "npm:0.23.1" + "@esbuild/openbsd-x64": "npm:0.23.1" + "@esbuild/sunos-x64": "npm:0.23.1" + "@esbuild/win32-arm64": "npm:0.23.1" + "@esbuild/win32-ia32": "npm:0.23.1" + "@esbuild/win32-x64": "npm:0.23.1" + dependenciesMeta: + "@esbuild/aix-ppc64": + optional: true + "@esbuild/android-arm": + optional: true + "@esbuild/android-arm64": + optional: true + "@esbuild/android-x64": + optional: true + "@esbuild/darwin-arm64": + optional: true + "@esbuild/darwin-x64": + optional: true + "@esbuild/freebsd-arm64": + optional: true + "@esbuild/freebsd-x64": + optional: true + "@esbuild/linux-arm": + optional: true + "@esbuild/linux-arm64": + optional: true + "@esbuild/linux-ia32": + optional: true + "@esbuild/linux-loong64": + optional: true + "@esbuild/linux-mips64el": + optional: true + "@esbuild/linux-ppc64": + optional: true + "@esbuild/linux-riscv64": + optional: true + "@esbuild/linux-s390x": + optional: true + "@esbuild/linux-x64": + optional: true + "@esbuild/netbsd-x64": + optional: true + "@esbuild/openbsd-arm64": + optional: true + "@esbuild/openbsd-x64": + optional: true + "@esbuild/sunos-x64": + optional: true + "@esbuild/win32-arm64": + optional: true + "@esbuild/win32-ia32": + optional: true + "@esbuild/win32-x64": + optional: true + bin: + esbuild: bin/esbuild + checksum: 10c0/08c2ed1105cc3c5e3a24a771e35532fe6089dd24a39c10097899072cef4a99f20860e41e9294e000d86380f353b04d8c50af482483d7f69f5208481cce61eec7 + languageName: node + linkType: hard + "escalade@npm:^3.1.1": version: 3.1.1 resolution: "escalade@npm:3.1.1" @@ -951,6 +1202,25 @@ __metadata: languageName: node linkType: hard +"fsevents@npm:~2.3.3": + version: 2.3.3 + resolution: "fsevents@npm:2.3.3" + dependencies: + node-gyp: "npm:latest" + checksum: 10c0/a1f0c44595123ed717febbc478aa952e47adfc28e2092be66b8ab1635147254ca6cfe1df792a8997f22716d4cbafc73309899ff7bfac2ac3ad8cf2e4ecc3ec60 + conditions: os=darwin + languageName: node + linkType: hard + +"fsevents@patch:fsevents@npm%3A~2.3.3#optional!builtin": + version: 2.3.3 + resolution: "fsevents@patch:fsevents@npm%3A2.3.3#optional!builtin::version=2.3.3&hash=df0bf1" + dependencies: + node-gyp: "npm:latest" + conditions: os=darwin + languageName: node + linkType: hard + "gauge@npm:^3.0.0": version: 3.0.2 resolution: "gauge@npm:3.0.2" @@ -989,6 +1259,15 @@ __metadata: languageName: node linkType: hard +"get-tsconfig@npm:^4.7.5": + version: 4.7.6 + resolution: "get-tsconfig@npm:4.7.6" + dependencies: + resolve-pkg-maps: "npm:^1.0.0" + checksum: 10c0/2240e1b13e996dfbb947d177f422f83d09d1f93c9ce16959ebb3c2bdf8bdf4f04f98eba043859172da1685f9c7071091f0acfa964ebbe4780394d83b7dc3f58a + languageName: node + linkType: hard + "github-from-package@npm:0.0.0": version: 0.0.0 resolution: "github-from-package@npm:0.0.0" @@ -1932,6 +2211,13 @@ __metadata: languageName: node linkType: hard +"resolve-pkg-maps@npm:^1.0.0": + version: 1.0.0 + resolution: "resolve-pkg-maps@npm:1.0.0" + checksum: 10c0/fb8f7bbe2ca281a73b7ef423a1cbc786fb244bd7a95cbe5c3fba25b27d327150beca8ba02f622baea65919a57e061eb5005204daa5f93ed590d9b77463a567ab + languageName: node + linkType: hard + "retry@npm:^0.12.0": version: 0.12.0 resolution: "retry@npm:0.12.0" @@ -1963,6 +2249,8 @@ __metadata: dependencies: "@agoric/synthetic-chain": "npm:^0.1.0" ava: "npm:^6.1.2" + tsx: "npm:^4.17.0" + typescript: "npm:^5.5.4" languageName: unknown linkType: soft @@ -2298,6 +2586,22 @@ __metadata: languageName: node linkType: hard +"tsx@npm:^4.17.0": + version: 4.17.0 + resolution: "tsx@npm:4.17.0" + dependencies: + esbuild: "npm:~0.23.0" + fsevents: "npm:~2.3.3" + get-tsconfig: "npm:^4.7.5" + dependenciesMeta: + fsevents: + optional: true + bin: + tsx: dist/cli.mjs + checksum: 10c0/ad720b81d6447c7695d24c27947fa1a2b6db9d2ef03216389edd6fa0006aa479bc0d8348a1ac9975a08edef4ce791ff5629a24d8dccbb0987f42e5407785cfa4 + languageName: node + linkType: hard + "tunnel-agent@npm:^0.6.0": version: 0.6.0 resolution: "tunnel-agent@npm:0.6.0" @@ -2314,6 +2618,26 @@ __metadata: languageName: node linkType: hard +"typescript@npm:^5.5.4": + version: 5.5.4 + resolution: "typescript@npm:5.5.4" + bin: + tsc: bin/tsc + tsserver: bin/tsserver + checksum: 10c0/422be60f89e661eab29ac488c974b6cc0a660fb2228003b297c3d10c32c90f3bcffc1009b43876a082515a3c376b1eefcce823d6e78982e6878408b9a923199c + languageName: node + linkType: hard + +"typescript@patch:typescript@npm%3A^5.5.4#optional!builtin": + version: 5.5.4 + resolution: "typescript@patch:typescript@npm%3A5.5.4#optional!builtin::version=5.5.4&hash=b45daf" + bin: + tsc: bin/tsc + tsserver: bin/tsserver + checksum: 10c0/10dd9881baba22763de859e8050d6cb6e2db854197495c6f1929b08d1eb2b2b00d0b5d9b0bcee8472f1c3f4a7ef6a5d7ebe0cfd703f853aa5ae465b8404bc1ba + languageName: node + linkType: hard + "unicorn-magic@npm:^0.1.0": version: 0.1.0 resolution: "unicorn-magic@npm:0.1.0" diff --git a/packages/SwingSet/src/types-external.js b/packages/SwingSet/src/types-external.js index a90c4ab2b7a..f1ada6e5ddb 100644 --- a/packages/SwingSet/src/types-external.js +++ b/packages/SwingSet/src/types-external.js @@ -287,7 +287,7 @@ export {}; * Vat Creation and Management * * @typedef { string } BundleID - * @typedef {any} BundleCap + * @typedef {import('./vats/plugin-manager.js').Device<'BundleCap'>} BundleCap * @typedef { { moduleFormat: 'endoZipBase64', endoZipBase64: string, endoZipBase64Sha512: string } } EndoZipBase64Bundle * * @typedef { unknown } Meter diff --git a/packages/zoe/tools/fakeVatAdmin.js b/packages/zoe/tools/fakeVatAdmin.js index b174a067309..914d33b0e31 100644 --- a/packages/zoe/tools/fakeVatAdmin.js +++ b/packages/zoe/tools/fakeVatAdmin.js @@ -18,8 +18,7 @@ import zcfBundle from '../bundles/bundle-contractFacet.js'; // this simulates a bundlecap, which is normally a swingset "device node" /** @typedef { import('@agoric/swingset-vat').BundleCap } BundleCap */ /** @type {() => BundleCap} */ -const fakeBundleCap = () => makeHandle('FakeBundleCap'); -const bogusBundleCap = () => makeHandle('BogusBundleCap'); +const fakeBundleCap = () => /** @type {any} */ (makeHandle('BundleCap')); export const zcfBundleCap = fakeBundleCap(); /** @@ -56,13 +55,13 @@ function makeFakeVatAdmin(testContextSetter = undefined, makeRemote = x => x) { const admin = Far('vatAdmin', { getBundleCap: bundleID => { if (!idToBundleCap.has(bundleID)) { - idToBundleCap.init(bundleID, bogusBundleCap()); + idToBundleCap.init(bundleID, fakeBundleCap()); } return Promise.resolve(idToBundleCap.get(bundleID)); }, waitForBundleCap: bundleID => { if (!idToBundleCap.has(bundleID)) { - idToBundleCap.init(bundleID, bogusBundleCap()); + idToBundleCap.init(bundleID, fakeBundleCap()); } return Promise.resolve(idToBundleCap.get(bundleID)); },