diff --git a/.pnp.cjs b/.pnp.cjs index a336e01def..fc68857bb8 100644 --- a/.pnp.cjs +++ b/.pnp.cjs @@ -205,10 +205,6 @@ const RAW_RUNTIME_STATE = "@babel/types",\ "npm:7.23.0"\ ],\ - [\ - "@confio/ics23",\ - "npm:0.6.8"\ - ],\ [\ "@cosmjs/amino",\ "workspace:packages/amino"\ @@ -1931,7 +1927,7 @@ const RAW_RUNTIME_STATE = ],\ [\ "long",\ - "npm:4.0.0"\ + "npm:5.2.4"\ ],\ [\ "lru-cache",\ @@ -2287,7 +2283,7 @@ const RAW_RUNTIME_STATE = ],\ [\ "protobufjs",\ - "npm:6.11.4"\ + "npm:7.4.0"\ ],\ [\ "proxy-from-env",\ @@ -3231,17 +3227,6 @@ const RAW_RUNTIME_STATE = "linkType": "HARD"\ }]\ ]],\ - ["@confio/ics23", [\ - ["npm:0.6.8", {\ - "packageLocation": "./.yarn/cache/@confio-ics23-npm-0.6.8-c87607eb2c-2f3f5032cd.zip/node_modules/@confio/ics23/",\ - "packageDependencies": [\ - ["@confio/ics23", "npm:0.6.8"],\ - ["@noble/hashes", "npm:1.0.0"],\ - ["protobufjs", "npm:6.11.4"]\ - ],\ - "linkType": "HARD"\ - }]\ - ]],\ ["@cosmjs/amino", [\ ["workspace:packages/amino", {\ "packageLocation": "./packages/amino/",\ @@ -3749,7 +3734,7 @@ const RAW_RUNTIME_STATE = ["karma-jasmine-html-reporter", "virtual:4f1584ad4aba8733a24be7c8aebbffafef25607f2d00f4b314cf96717145c692763628a31c2b85d4686fbb091ff21ebffa3cc337399c042c19a32b9bdb786464#npm:1.6.0"],\ ["nyc", "npm:15.1.0"],\ ["prettier", "npm:2.8.8"],\ - ["protobufjs", "npm:6.11.4"],\ + ["protobufjs", "npm:7.4.0"],\ ["ses", "npm:0.11.1"],\ ["source-map-support", "npm:0.5.21"],\ ["ts-node", "virtual:4f1584ad4aba8733a24be7c8aebbffafef25607f2d00f4b314cf96717145c692763628a31c2b85d4686fbb091ff21ebffa3cc337399c042c19a32b9bdb786464#npm:8.10.2"],\ @@ -3812,7 +3797,6 @@ const RAW_RUNTIME_STATE = "packageLocation": "./packages/stargate/",\ "packageDependencies": [\ ["@cosmjs/stargate", "workspace:packages/stargate"],\ - ["@confio/ics23", "npm:0.6.8"],\ ["@cosmjs/amino", "workspace:packages/amino"],\ ["@cosmjs/crypto", "workspace:packages/crypto"],\ ["@cosmjs/encoding", "workspace:packages/encoding"],\ @@ -3856,8 +3840,7 @@ const RAW_RUNTIME_STATE = ["typedoc", "virtual:4f1584ad4aba8733a24be7c8aebbffafef25607f2d00f4b314cf96717145c692763628a31c2b85d4686fbb091ff21ebffa3cc337399c042c19a32b9bdb786464#npm:0.23.28"],\ ["typescript", "patch:typescript@npm%3A4.9.5#optional!builtin::version=4.9.5&hash=289587"],\ ["webpack", "virtual:d5037fb6cb5ae0ea3e1abfa18c6b0b09006e3ee27af43c076bb3eab879c3679bba8a5c55c42f03ddd47ae58ceabbf7a06477ca582879ac7623c7c140cfd0449f#npm:5.76.1"],\ - ["webpack-cli", "virtual:d5037fb6cb5ae0ea3e1abfa18c6b0b09006e3ee27af43c076bb3eab879c3679bba8a5c55c42f03ddd47ae58ceabbf7a06477ca582879ac7623c7c140cfd0449f#npm:4.7.0"],\ - ["xstream", "npm:11.14.0"]\ + ["webpack-cli", "virtual:d5037fb6cb5ae0ea3e1abfa18c6b0b09006e3ee27af43c076bb3eab879c3679bba8a5c55c42f03ddd47ae58ceabbf7a06477ca582879ac7623c7c140cfd0449f#npm:4.7.0"]\ ],\ "linkType": "SOFT"\ }]\ @@ -9952,10 +9935,10 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["long", [\ - ["npm:4.0.0", {\ - "packageLocation": "./.yarn/cache/long-npm-4.0.0-ecd96a31ed-50a6417d15.zip/node_modules/long/",\ + ["npm:5.2.4", {\ + "packageLocation": "./.yarn/cache/long-npm-5.2.4-b96a88098c-0cf819ce2a.zip/node_modules/long/",\ "packageDependencies": [\ - ["long", "npm:4.0.0"]\ + ["long", "npm:5.2.4"]\ ],\ "linkType": "HARD"\ }]\ @@ -11067,10 +11050,10 @@ const RAW_RUNTIME_STATE = }]\ ]],\ ["protobufjs", [\ - ["npm:6.11.4", {\ - "packageLocation": "./.yarn/unplugged/protobufjs-npm-6.11.4-af11968b80/node_modules/protobufjs/",\ + ["npm:7.4.0", {\ + "packageLocation": "./.yarn/unplugged/protobufjs-npm-7.4.0-12c56a3adc/node_modules/protobufjs/",\ "packageDependencies": [\ - ["protobufjs", "npm:6.11.4"],\ + ["protobufjs", "npm:7.4.0"],\ ["@protobufjs/aspromise", "npm:1.1.2"],\ ["@protobufjs/base64", "npm:1.1.2"],\ ["@protobufjs/codegen", "npm:2.0.4"],\ @@ -11081,9 +11064,8 @@ const RAW_RUNTIME_STATE = ["@protobufjs/path", "npm:1.1.2"],\ ["@protobufjs/pool", "npm:1.1.0"],\ ["@protobufjs/utf8", "npm:1.1.0"],\ - ["@types/long", "npm:4.0.1"],\ ["@types/node", "npm:22.10.6"],\ - ["long", "npm:4.0.0"]\ + ["long", "npm:5.2.4"]\ ],\ "linkType": "HARD"\ }]\ diff --git a/.yarn/cache/@confio-ics23-npm-0.6.8-c87607eb2c-2f3f5032cd.zip b/.yarn/cache/@confio-ics23-npm-0.6.8-c87607eb2c-2f3f5032cd.zip deleted file mode 100644 index b5f9b7efc1..0000000000 --- a/.yarn/cache/@confio-ics23-npm-0.6.8-c87607eb2c-2f3f5032cd.zip +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:33c438adf8bb3b398fd5070160bcdbc5aba8a8a4682c59dc2fee3e14b6c2c605 -size 397215 diff --git a/.yarn/cache/long-npm-4.0.0-ecd96a31ed-50a6417d15.zip b/.yarn/cache/long-npm-4.0.0-ecd96a31ed-50a6417d15.zip deleted file mode 100644 index 6335569c92..0000000000 --- a/.yarn/cache/long-npm-4.0.0-ecd96a31ed-50a6417d15.zip +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:1fbe45eb010bb6a4f3e743fd9abd54bfd8dc59c23a460ce418834e204159a067 -size 178066 diff --git a/.yarn/cache/long-npm-5.2.4-b96a88098c-0cf819ce2a.zip b/.yarn/cache/long-npm-5.2.4-b96a88098c-0cf819ce2a.zip new file mode 100644 index 0000000000..6c4aa92bbb --- /dev/null +++ b/.yarn/cache/long-npm-5.2.4-b96a88098c-0cf819ce2a.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:a34a6637a3fd5742ade382fed737bc7bb267e4b56cc40c443a541302ce20e59c +size 120324 diff --git a/.yarn/cache/protobufjs-npm-6.11.4-af11968b80-c244d7b9b6.zip b/.yarn/cache/protobufjs-npm-6.11.4-af11968b80-c244d7b9b6.zip deleted file mode 100644 index 1995441527..0000000000 --- a/.yarn/cache/protobufjs-npm-6.11.4-af11968b80-c244d7b9b6.zip +++ /dev/null @@ -1,3 +0,0 @@ -version https://git-lfs.github.com/spec/v1 -oid sha256:f7752ca4b88b9262443766adfce657c5afd62e0b5fc53727c35495508bd8a36b -size 15157888 diff --git a/.yarn/cache/protobufjs-npm-7.4.0-12c56a3adc-a5460a63fe.zip b/.yarn/cache/protobufjs-npm-7.4.0-12c56a3adc-a5460a63fe.zip new file mode 100644 index 0000000000..55fdeb11cf --- /dev/null +++ b/.yarn/cache/protobufjs-npm-7.4.0-12c56a3adc-a5460a63fe.zip @@ -0,0 +1,3 @@ +version https://git-lfs.github.com/spec/v1 +oid sha256:8ddda0da80355eadc635dba0e5a27565c0314d2d2120bcf49541d9113f5a2386 +size 2785766 diff --git a/.yarn/sdks/eslint/bin/eslint.js b/.yarn/sdks/eslint/bin/eslint.js index 9ef98e400b..e6604ff595 100755 --- a/.yarn/sdks/eslint/bin/eslint.js +++ b/.yarn/sdks/eslint/bin/eslint.js @@ -1,20 +1,32 @@ #!/usr/bin/env node const {existsSync} = require(`fs`); -const {createRequire} = require(`module`); +const {createRequire, register} = require(`module`); const {resolve} = require(`path`); +const {pathToFileURL} = require(`url`); const relPnpApiPath = "../../../../.pnp.cjs"; const absPnpApiPath = resolve(__dirname, relPnpApiPath); +const absUserWrapperPath = resolve(__dirname, `./sdk.user.cjs`); const absRequire = createRequire(absPnpApiPath); +const absPnpLoaderPath = resolve(absPnpApiPath, `../.pnp.loader.mjs`); +const isPnpLoaderEnabled = existsSync(absPnpLoaderPath); + if (existsSync(absPnpApiPath)) { if (!process.versions.pnp) { // Setup the environment to be able to require eslint/bin/eslint.js require(absPnpApiPath).setup(); + if (isPnpLoaderEnabled && register) { + register(pathToFileURL(absPnpLoaderPath)); + } } } +const wrapWithUserWrapper = existsSync(absUserWrapperPath) + ? exports => absRequire(absUserWrapperPath)(exports) + : exports => exports; + // Defer to the real eslint/bin/eslint.js your application uses -module.exports = absRequire(`eslint/bin/eslint.js`); +module.exports = wrapWithUserWrapper(absRequire(`eslint/bin/eslint.js`)); diff --git a/.yarn/sdks/eslint/lib/api.js b/.yarn/sdks/eslint/lib/api.js index 653b22bae0..8addf97fb2 100644 --- a/.yarn/sdks/eslint/lib/api.js +++ b/.yarn/sdks/eslint/lib/api.js @@ -1,20 +1,32 @@ #!/usr/bin/env node const {existsSync} = require(`fs`); -const {createRequire} = require(`module`); +const {createRequire, register} = require(`module`); const {resolve} = require(`path`); +const {pathToFileURL} = require(`url`); const relPnpApiPath = "../../../../.pnp.cjs"; const absPnpApiPath = resolve(__dirname, relPnpApiPath); +const absUserWrapperPath = resolve(__dirname, `./sdk.user.cjs`); const absRequire = createRequire(absPnpApiPath); +const absPnpLoaderPath = resolve(absPnpApiPath, `../.pnp.loader.mjs`); +const isPnpLoaderEnabled = existsSync(absPnpLoaderPath); + if (existsSync(absPnpApiPath)) { if (!process.versions.pnp) { // Setup the environment to be able to require eslint require(absPnpApiPath).setup(); + if (isPnpLoaderEnabled && register) { + register(pathToFileURL(absPnpLoaderPath)); + } } } +const wrapWithUserWrapper = existsSync(absUserWrapperPath) + ? exports => absRequire(absUserWrapperPath)(exports) + : exports => exports; + // Defer to the real eslint your application uses -module.exports = absRequire(`eslint`); +module.exports = wrapWithUserWrapper(absRequire(`eslint`)); diff --git a/.yarn/sdks/eslint/package.json b/.yarn/sdks/eslint/package.json index 9c05985b44..47b191cb63 100644 --- a/.yarn/sdks/eslint/package.json +++ b/.yarn/sdks/eslint/package.json @@ -2,5 +2,8 @@ "name": "eslint", "version": "7.26.0-sdk", "main": "./lib/api.js", - "type": "commonjs" + "type": "commonjs", + "bin": { + "eslint": "./bin/eslint.js" + } } diff --git a/.yarn/sdks/prettier/bin-prettier.js b/.yarn/sdks/prettier/bin-prettier.js new file mode 100755 index 0000000000..5d06535387 --- /dev/null +++ b/.yarn/sdks/prettier/bin-prettier.js @@ -0,0 +1,32 @@ +#!/usr/bin/env node + +const {existsSync} = require(`fs`); +const {createRequire, register} = require(`module`); +const {resolve} = require(`path`); +const {pathToFileURL} = require(`url`); + +const relPnpApiPath = "../../../.pnp.cjs"; + +const absPnpApiPath = resolve(__dirname, relPnpApiPath); +const absUserWrapperPath = resolve(__dirname, `./sdk.user.cjs`); +const absRequire = createRequire(absPnpApiPath); + +const absPnpLoaderPath = resolve(absPnpApiPath, `../.pnp.loader.mjs`); +const isPnpLoaderEnabled = existsSync(absPnpLoaderPath); + +if (existsSync(absPnpApiPath)) { + if (!process.versions.pnp) { + // Setup the environment to be able to require prettier/bin-prettier.js + require(absPnpApiPath).setup(); + if (isPnpLoaderEnabled && register) { + register(pathToFileURL(absPnpLoaderPath)); + } + } +} + +const wrapWithUserWrapper = existsSync(absUserWrapperPath) + ? exports => absRequire(absUserWrapperPath)(exports) + : exports => exports; + +// Defer to the real prettier/bin-prettier.js your application uses +module.exports = wrapWithUserWrapper(absRequire(`prettier/bin-prettier.js`)); diff --git a/.yarn/sdks/prettier/index.js b/.yarn/sdks/prettier/index.js old mode 100755 new mode 100644 index 81f9bec5fe..57cb2ab17f --- a/.yarn/sdks/prettier/index.js +++ b/.yarn/sdks/prettier/index.js @@ -1,20 +1,32 @@ #!/usr/bin/env node const {existsSync} = require(`fs`); -const {createRequire} = require(`module`); +const {createRequire, register} = require(`module`); const {resolve} = require(`path`); +const {pathToFileURL} = require(`url`); const relPnpApiPath = "../../../.pnp.cjs"; const absPnpApiPath = resolve(__dirname, relPnpApiPath); +const absUserWrapperPath = resolve(__dirname, `./sdk.user.cjs`); const absRequire = createRequire(absPnpApiPath); +const absPnpLoaderPath = resolve(absPnpApiPath, `../.pnp.loader.mjs`); +const isPnpLoaderEnabled = existsSync(absPnpLoaderPath); + if (existsSync(absPnpApiPath)) { if (!process.versions.pnp) { - // Setup the environment to be able to require prettier/index.js + // Setup the environment to be able to require prettier require(absPnpApiPath).setup(); + if (isPnpLoaderEnabled && register) { + register(pathToFileURL(absPnpLoaderPath)); + } } } -// Defer to the real prettier/index.js your application uses -module.exports = absRequire(`prettier/index.js`); +const wrapWithUserWrapper = existsSync(absUserWrapperPath) + ? exports => absRequire(absUserWrapperPath)(exports) + : exports => exports; + +// Defer to the real prettier your application uses +module.exports = wrapWithUserWrapper(absRequire(`prettier`)); diff --git a/.yarn/sdks/prettier/package.json b/.yarn/sdks/prettier/package.json index 3f8599ab15..0afcaf21ad 100644 --- a/.yarn/sdks/prettier/package.json +++ b/.yarn/sdks/prettier/package.json @@ -1,6 +1,7 @@ { "name": "prettier", - "version": "2.8.1-sdk", + "version": "2.8.8-sdk", "main": "./index.js", - "type": "commonjs" + "type": "commonjs", + "bin": "./bin-prettier.js" } diff --git a/.yarn/sdks/typescript/bin/tsc b/.yarn/sdks/typescript/bin/tsc index 454b950b7e..867a7bdfe2 100755 --- a/.yarn/sdks/typescript/bin/tsc +++ b/.yarn/sdks/typescript/bin/tsc @@ -1,20 +1,32 @@ #!/usr/bin/env node const {existsSync} = require(`fs`); -const {createRequire} = require(`module`); +const {createRequire, register} = require(`module`); const {resolve} = require(`path`); +const {pathToFileURL} = require(`url`); const relPnpApiPath = "../../../../.pnp.cjs"; const absPnpApiPath = resolve(__dirname, relPnpApiPath); +const absUserWrapperPath = resolve(__dirname, `./sdk.user.cjs`); const absRequire = createRequire(absPnpApiPath); +const absPnpLoaderPath = resolve(absPnpApiPath, `../.pnp.loader.mjs`); +const isPnpLoaderEnabled = existsSync(absPnpLoaderPath); + if (existsSync(absPnpApiPath)) { if (!process.versions.pnp) { // Setup the environment to be able to require typescript/bin/tsc require(absPnpApiPath).setup(); + if (isPnpLoaderEnabled && register) { + register(pathToFileURL(absPnpLoaderPath)); + } } } +const wrapWithUserWrapper = existsSync(absUserWrapperPath) + ? exports => absRequire(absUserWrapperPath)(exports) + : exports => exports; + // Defer to the real typescript/bin/tsc your application uses -module.exports = absRequire(`typescript/bin/tsc`); +module.exports = wrapWithUserWrapper(absRequire(`typescript/bin/tsc`)); diff --git a/.yarn/sdks/typescript/bin/tsserver b/.yarn/sdks/typescript/bin/tsserver index d7a605684d..3fc5aa31cc 100755 --- a/.yarn/sdks/typescript/bin/tsserver +++ b/.yarn/sdks/typescript/bin/tsserver @@ -1,20 +1,32 @@ #!/usr/bin/env node const {existsSync} = require(`fs`); -const {createRequire} = require(`module`); +const {createRequire, register} = require(`module`); const {resolve} = require(`path`); +const {pathToFileURL} = require(`url`); const relPnpApiPath = "../../../../.pnp.cjs"; const absPnpApiPath = resolve(__dirname, relPnpApiPath); +const absUserWrapperPath = resolve(__dirname, `./sdk.user.cjs`); const absRequire = createRequire(absPnpApiPath); +const absPnpLoaderPath = resolve(absPnpApiPath, `../.pnp.loader.mjs`); +const isPnpLoaderEnabled = existsSync(absPnpLoaderPath); + if (existsSync(absPnpApiPath)) { if (!process.versions.pnp) { // Setup the environment to be able to require typescript/bin/tsserver require(absPnpApiPath).setup(); + if (isPnpLoaderEnabled && register) { + register(pathToFileURL(absPnpLoaderPath)); + } } } +const wrapWithUserWrapper = existsSync(absUserWrapperPath) + ? exports => absRequire(absUserWrapperPath)(exports) + : exports => exports; + // Defer to the real typescript/bin/tsserver your application uses -module.exports = absRequire(`typescript/bin/tsserver`); +module.exports = wrapWithUserWrapper(absRequire(`typescript/bin/tsserver`)); diff --git a/.yarn/sdks/typescript/lib/tsc.js b/.yarn/sdks/typescript/lib/tsc.js index 2f62fc96c0..da411bdba0 100644 --- a/.yarn/sdks/typescript/lib/tsc.js +++ b/.yarn/sdks/typescript/lib/tsc.js @@ -1,20 +1,32 @@ #!/usr/bin/env node const {existsSync} = require(`fs`); -const {createRequire} = require(`module`); +const {createRequire, register} = require(`module`); const {resolve} = require(`path`); +const {pathToFileURL} = require(`url`); const relPnpApiPath = "../../../../.pnp.cjs"; const absPnpApiPath = resolve(__dirname, relPnpApiPath); +const absUserWrapperPath = resolve(__dirname, `./sdk.user.cjs`); const absRequire = createRequire(absPnpApiPath); +const absPnpLoaderPath = resolve(absPnpApiPath, `../.pnp.loader.mjs`); +const isPnpLoaderEnabled = existsSync(absPnpLoaderPath); + if (existsSync(absPnpApiPath)) { if (!process.versions.pnp) { // Setup the environment to be able to require typescript/lib/tsc.js require(absPnpApiPath).setup(); + if (isPnpLoaderEnabled && register) { + register(pathToFileURL(absPnpLoaderPath)); + } } } +const wrapWithUserWrapper = existsSync(absUserWrapperPath) + ? exports => absRequire(absUserWrapperPath)(exports) + : exports => exports; + // Defer to the real typescript/lib/tsc.js your application uses -module.exports = absRequire(`typescript/lib/tsc.js`); +module.exports = wrapWithUserWrapper(absRequire(`typescript/lib/tsc.js`)); diff --git a/.yarn/sdks/typescript/lib/tsserver.js b/.yarn/sdks/typescript/lib/tsserver.js index bbb1e46501..6249c4675a 100644 --- a/.yarn/sdks/typescript/lib/tsserver.js +++ b/.yarn/sdks/typescript/lib/tsserver.js @@ -1,15 +1,38 @@ #!/usr/bin/env node const {existsSync} = require(`fs`); -const {createRequire} = require(`module`); +const {createRequire, register} = require(`module`); const {resolve} = require(`path`); +const {pathToFileURL} = require(`url`); const relPnpApiPath = "../../../../.pnp.cjs"; const absPnpApiPath = resolve(__dirname, relPnpApiPath); +const absUserWrapperPath = resolve(__dirname, `./sdk.user.cjs`); const absRequire = createRequire(absPnpApiPath); -const moduleWrapper = tsserver => { +const absPnpLoaderPath = resolve(absPnpApiPath, `../.pnp.loader.mjs`); +const isPnpLoaderEnabled = existsSync(absPnpLoaderPath); + +if (existsSync(absPnpApiPath)) { + if (!process.versions.pnp) { + // Setup the environment to be able to require typescript/lib/tsserver.js + require(absPnpApiPath).setup(); + if (isPnpLoaderEnabled && register) { + register(pathToFileURL(absPnpLoaderPath)); + } + } +} + +const wrapWithUserWrapper = existsSync(absUserWrapperPath) + ? exports => absRequire(absUserWrapperPath)(exports) + : exports => exports; + +const moduleWrapper = exports => { + return wrapWithUserWrapper(moduleWrapperFn(exports)); +}; + +const moduleWrapperFn = tsserver => { if (!process.versions.pnp) { return tsserver; } @@ -214,11 +237,11 @@ const moduleWrapper = tsserver => { return tsserver; }; -if (existsSync(absPnpApiPath)) { - if (!process.versions.pnp) { - // Setup the environment to be able to require typescript/lib/tsserver.js - require(absPnpApiPath).setup(); - } +const [major, minor] = absRequire(`typescript/package.json`).version.split(`.`, 2).map(value => parseInt(value, 10)); +// In TypeScript@>=5.5 the tsserver uses the public TypeScript API so that needs to be patched as well. +// Ref /~https://github.com/microsoft/TypeScript/pull/55326 +if (major > 5 || (major === 5 && minor >= 5)) { + moduleWrapper(absRequire(`typescript`)); } // Defer to the real typescript/lib/tsserver.js your application uses diff --git a/.yarn/sdks/typescript/lib/tsserverlibrary.js b/.yarn/sdks/typescript/lib/tsserverlibrary.js index a68f028fe1..0e50e0a2b0 100644 --- a/.yarn/sdks/typescript/lib/tsserverlibrary.js +++ b/.yarn/sdks/typescript/lib/tsserverlibrary.js @@ -1,15 +1,38 @@ #!/usr/bin/env node const {existsSync} = require(`fs`); -const {createRequire} = require(`module`); +const {createRequire, register} = require(`module`); const {resolve} = require(`path`); +const {pathToFileURL} = require(`url`); const relPnpApiPath = "../../../../.pnp.cjs"; const absPnpApiPath = resolve(__dirname, relPnpApiPath); +const absUserWrapperPath = resolve(__dirname, `./sdk.user.cjs`); const absRequire = createRequire(absPnpApiPath); -const moduleWrapper = tsserver => { +const absPnpLoaderPath = resolve(absPnpApiPath, `../.pnp.loader.mjs`); +const isPnpLoaderEnabled = existsSync(absPnpLoaderPath); + +if (existsSync(absPnpApiPath)) { + if (!process.versions.pnp) { + // Setup the environment to be able to require typescript/lib/tsserverlibrary.js + require(absPnpApiPath).setup(); + if (isPnpLoaderEnabled && register) { + register(pathToFileURL(absPnpLoaderPath)); + } + } +} + +const wrapWithUserWrapper = existsSync(absUserWrapperPath) + ? exports => absRequire(absUserWrapperPath)(exports) + : exports => exports; + +const moduleWrapper = exports => { + return wrapWithUserWrapper(moduleWrapperFn(exports)); +}; + +const moduleWrapperFn = tsserver => { if (!process.versions.pnp) { return tsserver; } @@ -214,11 +237,11 @@ const moduleWrapper = tsserver => { return tsserver; }; -if (existsSync(absPnpApiPath)) { - if (!process.versions.pnp) { - // Setup the environment to be able to require typescript/lib/tsserverlibrary.js - require(absPnpApiPath).setup(); - } +const [major, minor] = absRequire(`typescript/package.json`).version.split(`.`, 2).map(value => parseInt(value, 10)); +// In TypeScript@>=5.5 the tsserver uses the public TypeScript API so that needs to be patched as well. +// Ref /~https://github.com/microsoft/TypeScript/pull/55326 +if (major > 5 || (major === 5 && minor >= 5)) { + moduleWrapper(absRequire(`typescript`)); } // Defer to the real typescript/lib/tsserverlibrary.js your application uses diff --git a/.yarn/sdks/typescript/lib/typescript.js b/.yarn/sdks/typescript/lib/typescript.js index e14fa87bea..7b6cc22079 100644 --- a/.yarn/sdks/typescript/lib/typescript.js +++ b/.yarn/sdks/typescript/lib/typescript.js @@ -1,20 +1,32 @@ #!/usr/bin/env node const {existsSync} = require(`fs`); -const {createRequire} = require(`module`); +const {createRequire, register} = require(`module`); const {resolve} = require(`path`); +const {pathToFileURL} = require(`url`); const relPnpApiPath = "../../../../.pnp.cjs"; const absPnpApiPath = resolve(__dirname, relPnpApiPath); +const absUserWrapperPath = resolve(__dirname, `./sdk.user.cjs`); const absRequire = createRequire(absPnpApiPath); +const absPnpLoaderPath = resolve(absPnpApiPath, `../.pnp.loader.mjs`); +const isPnpLoaderEnabled = existsSync(absPnpLoaderPath); + if (existsSync(absPnpApiPath)) { if (!process.versions.pnp) { - // Setup the environment to be able to require typescript/lib/typescript.js + // Setup the environment to be able to require typescript require(absPnpApiPath).setup(); + if (isPnpLoaderEnabled && register) { + register(pathToFileURL(absPnpLoaderPath)); + } } } -// Defer to the real typescript/lib/typescript.js your application uses -module.exports = absRequire(`typescript/lib/typescript.js`); +const wrapWithUserWrapper = existsSync(absUserWrapperPath) + ? exports => absRequire(absUserWrapperPath)(exports) + : exports => exports; + +// Defer to the real typescript your application uses +module.exports = wrapWithUserWrapper(absRequire(`typescript`)); diff --git a/.yarn/sdks/typescript/package.json b/.yarn/sdks/typescript/package.json index 14f22f2889..4196676c07 100644 --- a/.yarn/sdks/typescript/package.json +++ b/.yarn/sdks/typescript/package.json @@ -2,5 +2,9 @@ "name": "typescript", "version": "4.9.5-sdk", "main": "./lib/typescript.js", - "type": "commonjs" + "type": "commonjs", + "bin": { + "tsc": "./bin/tsc", + "tsserver": "./bin/tsserver" + } } diff --git a/CHANGELOG.md b/CHANGELOG.md index f26bc83ce8..ecd5eb5351 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,11 @@ and this project adheres to ### Changed - Upgrade to yarn 4 and drop Node.js 16 support ([#1552]) +- @cosmjs/stargate: Removed support for verified queries. This feature depends + on a JavaScript implementation of ICS-23 but + [@confio/ics23 is unmaintained](/~https://github.com/cosmos/cosmjs/issues/1618) + without replacement. +- @cosmjs/proto-signing: Upgrade protobufjs to 7.4. [#1552]: /~https://github.com/cosmos/cosmjs/issues/1552 diff --git a/packages/proto-signing/package.json b/packages/proto-signing/package.json index 435cea7b48..6f348bb5d3 100644 --- a/packages/proto-signing/package.json +++ b/packages/proto-signing/package.json @@ -74,7 +74,7 @@ "karma-jasmine-html-reporter": "^1.5.4", "nyc": "^15.1.0", "prettier": "^2.8.1", - "protobufjs": "~6.11.4", + "protobufjs": "^7.4.0", "ses": "^0.11.0", "source-map-support": "^0.5.19", "ts-node": "^8", diff --git a/packages/stargate/package.json b/packages/stargate/package.json index 13f1f7c2a3..cf09c5ac35 100644 --- a/packages/stargate/package.json +++ b/packages/stargate/package.json @@ -38,7 +38,6 @@ "pack-web": "yarn build-or-skip && webpack --mode development --config webpack.web.config.js" }, "dependencies": { - "@confio/ics23": "^0.6.8", "@cosmjs/amino": "workspace:^", "@cosmjs/encoding": "workspace:^", "@cosmjs/math": "workspace:^", @@ -46,8 +45,7 @@ "@cosmjs/stream": "workspace:^", "@cosmjs/tendermint-rpc": "workspace:^", "@cosmjs/utils": "workspace:^", - "cosmjs-types": "^0.9.0", - "xstream": "^11.14.0" + "cosmjs-types": "^0.9.0" }, "devDependencies": { "@cosmjs/crypto": "workspace:^", diff --git a/packages/stargate/src/modules/ibc/queries.ts b/packages/stargate/src/modules/ibc/queries.ts index cbf2faacdc..33c27017ba 100644 --- a/packages/stargate/src/modules/ibc/queries.ts +++ b/packages/stargate/src/modules/ibc/queries.ts @@ -1,6 +1,4 @@ /* eslint-disable @typescript-eslint/naming-convention */ -import { toAscii } from "@cosmjs/encoding"; -import { Uint64 } from "@cosmjs/math"; import { Any } from "cosmjs-types/google/protobuf/any"; import { QueryClientImpl as TransferQuery, @@ -8,7 +6,6 @@ import { QueryDenomTracesResponse, QueryParamsResponse as QueryTransferParamsResponse, } from "cosmjs-types/ibc/applications/transfer/v1/query"; -import { Channel } from "cosmjs-types/ibc/core/channel/v1/channel"; import { QueryChannelClientStateResponse, QueryChannelConsensusStateResponse, @@ -166,22 +163,6 @@ export interface IbcExtension { readonly allDenomTraces: () => Promise; readonly params: () => Promise; }; - readonly verified: { - readonly channel: { - readonly channel: (portId: string, channelId: string) => Promise; - readonly packetCommitment: ( - portId: string, - channelId: string, - sequence: number, - ) => Promise; - readonly packetAcknowledgement: ( - portId: string, - channelId: string, - sequence: number, - ) => Promise; - readonly nextSequenceReceive: (portId: string, channelId: string) => Promise; - }; - }; }; } @@ -502,40 +483,6 @@ export function setupIbcExtension(base: QueryClient): IbcExtension { }, params: async () => transferQueryService.Params({}), }, - verified: { - channel: { - channel: async (portId: string, channelId: string) => { - // keeper: /~https://github.com/cosmos/cosmos-sdk/blob/3bafd8255a502e5a9cee07391cf8261538245dfd/x/ibc/04-channel/keeper/keeper.go#L55-L65 - // key: /~https://github.com/cosmos/cosmos-sdk/blob/ef0a7344af345882729598bc2958a21143930a6b/x/ibc/24-host/keys.go#L117-L120 - const key = toAscii(`channelEnds/ports/${portId}/channels/${channelId}`); - const { value } = await base.queryStoreVerified("ibc", key); - return value.length ? Channel.decode(value) : null; - }, - packetCommitment: async (portId: string, channelId: string, sequence: number) => { - // keeper: /~https://github.com/cosmos/cosmos-sdk/blob/3bafd8255a502e5a9cee07391cf8261538245dfd/x/ibc/04-channel/keeper/keeper.go#L128-L133 - // key: /~https://github.com/cosmos/cosmos-sdk/blob/ef0a7344af345882729598bc2958a21143930a6b/x/ibc/24-host/keys.go#L183-L185 - const key = toAscii(`commitments/ports/${portId}/channels/${channelId}/packets/${sequence}`); - const { value } = await base.queryStoreVerified("ibc", key); - // keeper code doesn't parse, but returns raw - return value; - }, - packetAcknowledgement: async (portId: string, channelId: string, sequence: number) => { - // keeper: /~https://github.com/cosmos/cosmos-sdk/blob/3bafd8255a502e5a9cee07391cf8261538245dfd/x/ibc/04-channel/keeper/keeper.go#L159-L166 - // key: /~https://github.com/cosmos/cosmos-sdk/blob/ef0a7344af345882729598bc2958a21143930a6b/x/ibc/24-host/keys.go#L153-L156 - const key = toAscii(`acks/ports/${portId}/channels/${channelId}/acknowledgements/${sequence}`); - const { value } = await base.queryStoreVerified("ibc", key); - // keeper code doesn't parse, but returns raw - return value; - }, - nextSequenceReceive: async (portId: string, channelId: string) => { - // keeper: /~https://github.com/cosmos/cosmos-sdk/blob/3bafd8255a502e5a9cee07391cf8261538245dfd/x/ibc/04-channel/keeper/keeper.go#L92-L101 - // key: /~https://github.com/cosmos/cosmos-sdk/blob/ef0a7344af345882729598bc2958a21143930a6b/x/ibc/24-host/keys.go#L133-L136 - const key = toAscii(`seqAcks/ports/${portId}/channels/${channelId}/nextSequenceAck`); - const { value } = await base.queryStoreVerified("ibc", key); - return value.length ? Uint64.fromBytes(value).toNumber() : null; - }, - }, - }, }, }; } diff --git a/packages/stargate/src/queryclient/queryclient.spec.ts b/packages/stargate/src/queryclient/queryclient.spec.ts index cfbf318521..891f0c50b9 100644 --- a/packages/stargate/src/queryclient/queryclient.spec.ts +++ b/packages/stargate/src/queryclient/queryclient.spec.ts @@ -1,10 +1,8 @@ /* eslint-disable @typescript-eslint/naming-convention */ import { coin } from "@cosmjs/amino"; -import { toAscii } from "@cosmjs/encoding"; import { DirectSecp256k1HdWallet } from "@cosmjs/proto-signing"; import { CometClient, Tendermint34Client } from "@cosmjs/tendermint-rpc"; import { assert } from "@cosmjs/utils"; -import { Metadata } from "cosmjs-types/cosmos/bank/v1beta1/bank"; import { QueryAllBalancesRequest, QueryAllBalancesResponse, @@ -19,7 +17,6 @@ import { makeRandomAddress, pendingWithoutSimapp, simapp, - simapp44Enabled, unused, } from "../testutils.spec"; import { QueryClient } from "./queryclient"; @@ -29,69 +26,7 @@ async function makeClient(rpcUrl: string): Promise<[QueryClient, CometClient]> { return [QueryClient.withExtensions(cometClient), cometClient]; } -/** - * See - * - /~https://github.com/cosmos/cosmos-sdk/blob/v0.42.10/x/bank/types/key.go#L27 - * - /~https://github.com/cosmos/cosmos-sdk/blob/v0.44.2/x/bank/types/key.go#L28 - */ -const denomMetadataPrefix = new Uint8Array([0x01]); - describe("QueryClient", () => { - describe("queryStoreVerified", () => { - it("works via WebSockets", async () => { - pendingWithoutSimapp(); - const [client, cometClient] = await makeClient(simapp.tendermintUrlWs); - - // "keys before 0.45 had denom two times in the key" - // /~https://github.com/cosmos/cosmos-sdk/blob/10ad61a4dd/x/bank/migrations/v045/store_test.go#L91 - let queryKey: Uint8Array; - if (simapp44Enabled()) { - queryKey = Uint8Array.from([ - ...denomMetadataPrefix, - ...toAscii(simapp.denomFee), - ...toAscii(simapp.denomFee), - ]); - } else { - queryKey = Uint8Array.from([...denomMetadataPrefix, ...toAscii(simapp.denomFee)]); - } - const { key, value, height } = await client.queryStoreVerified("bank", queryKey); - expect(height).toBeGreaterThanOrEqual(1); - expect(key).toEqual(queryKey); - const response = Metadata.decode(value); - expect(response.base).toEqual(simapp.denomFee); - expect(response.description).toEqual("The fee token of this test chain"); - - cometClient.disconnect(); - }); - - it("works via http", async () => { - pendingWithoutSimapp(); - const [client, cometClient] = await makeClient(simapp.tendermintUrlHttp); - - // "keys before 0.45 had denom two times in the key" - // /~https://github.com/cosmos/cosmos-sdk/blob/10ad61a4dd/x/bank/migrations/v045/store_test.go#L91 - let queryKey: Uint8Array; - if (simapp44Enabled()) { - queryKey = Uint8Array.from([ - ...denomMetadataPrefix, - ...toAscii(simapp.denomFee), - ...toAscii(simapp.denomFee), - ]); - } else { - queryKey = Uint8Array.from([...denomMetadataPrefix, ...toAscii(simapp.denomFee)]); - } - - const { key, value, height } = await client.queryStoreVerified("bank", queryKey); - expect(height).toBeGreaterThanOrEqual(1); - expect(key).toEqual(queryKey); - const response = Metadata.decode(value); - expect(response.base).toEqual(simapp.denomFee); - expect(response.description).toEqual("The fee token of this test chain"); - - cometClient.disconnect(); - }); - }); - describe("queryAbci", () => { it("works via WebSockets", async () => { pendingWithoutSimapp(); diff --git a/packages/stargate/src/queryclient/queryclient.ts b/packages/stargate/src/queryclient/queryclient.ts index e839666cb0..3157825e25 100644 --- a/packages/stargate/src/queryclient/queryclient.ts +++ b/packages/stargate/src/queryclient/queryclient.ts @@ -1,24 +1,10 @@ /* eslint-disable no-dupe-class-members, @typescript-eslint/ban-types, @typescript-eslint/naming-convention */ -import { iavlSpec, ics23, tendermintSpec, verifyExistence, verifyNonExistence } from "@confio/ics23"; -import { toAscii, toHex } from "@cosmjs/encoding"; -import { firstEvent } from "@cosmjs/stream"; -import { CometClient, tendermint34 } from "@cosmjs/tendermint-rpc"; -import { arrayContentEquals, assert, assertDefined, isNonNullObject, sleep } from "@cosmjs/utils"; +import { CometClient } from "@cosmjs/tendermint-rpc"; +import { assert, isNonNullObject } from "@cosmjs/utils"; import { ProofOps } from "cosmjs-types/tendermint/crypto/proof"; -import { Stream } from "xstream"; type QueryExtensionSetup

= (base: QueryClient) => P; -function checkAndParseOp(op: tendermint34.ProofOp, kind: string, key: Uint8Array): ics23.CommitmentProof { - if (op.type !== kind) { - throw new Error(`Op expected to be ${kind}, got "${op.type}`); - } - if (!arrayContentEquals(key, op.key)) { - throw new Error(`Proven key different than queried key.\nQuery: ${toHex(key)}\nProven: ${toHex(op.key)}`); - } - return ics23.CommitmentProof.decode(op.data); -} - export interface ProvenQuery { readonly key: Uint8Array; readonly value: Uint8Array; @@ -512,90 +498,6 @@ export class QueryClient { this.cometClient = cometClient; } - /** - * Queries the database store with a proof, which is then verified. - * - * Please note: the current implementation trusts block headers it gets from the PRC endpoint. - */ - public async queryStoreVerified( - store: string, - queryKey: Uint8Array, - desiredHeight?: number, - ): Promise { - const { height, proof, key, value } = await this.queryRawProof(store, queryKey, desiredHeight); - - const subProof = checkAndParseOp(proof.ops[0], "ics23:iavl", queryKey); - const storeProof = checkAndParseOp(proof.ops[1], "ics23:simple", toAscii(store)); - - // this must always be existence, if the store is not a typo - assert(storeProof.exist); - assert(storeProof.exist.value); - - // this may be exist or non-exist, depends on response - if (!value || value.length === 0) { - // non-existence check - assert(subProof.nonexist); - // the subproof must map the desired key to the "value" of the storeProof - verifyNonExistence(subProof.nonexist, iavlSpec, storeProof.exist.value, queryKey); - } else { - // existence check - assert(subProof.exist); - assert(subProof.exist.value); - // the subproof must map the desired key to the "value" of the storeProof - verifyExistence(subProof.exist, iavlSpec, storeProof.exist.value, queryKey, value); - } - - // the store proof must map its declared value (root of subProof) to the appHash of the next block - const header = await this.getNextHeader(height); - verifyExistence(storeProof.exist, tendermintSpec, header.appHash, toAscii(store), storeProof.exist.value); - - return { key, value, height }; - } - - public async queryRawProof( - store: string, - queryKey: Uint8Array, - desiredHeight?: number, - ): Promise { - const { key, value, height, proof, code, log } = await this.cometClient.abciQuery({ - // we need the StoreKey for the module, not the module name - // /~https://github.com/cosmos/cosmos-sdk/blob/8cab43c8120fec5200c3459cbf4a92017bb6f287/x/auth/types/keys.go#L12 - path: `/store/${store}/key`, - data: queryKey, - prove: true, - height: desiredHeight, - }); - - if (code) { - throw new Error(`Query failed with (${code}): ${log}`); - } - - if (!arrayContentEquals(queryKey, key)) { - throw new Error(`Response key ${toHex(key)} doesn't match query key ${toHex(queryKey)}`); - } - - if (!height) { - throw new Error("No query height returned"); - } - if (!proof || proof.ops.length !== 2) { - throw new Error(`Expected 2 proof ops, got ${proof?.ops.length ?? 0}. Are you using stargate?`); - } - - // we don't need the results, but we can ensure the data is the proper format - checkAndParseOp(proof.ops[0], "ics23:iavl", key); - checkAndParseOp(proof.ops[1], "ics23:simple", toAscii(store)); - - return { - key: key, - value: value, - height: height, - // need to clone this: readonly input / writeable output - proof: { - ops: [...proof.ops], - }, - }; - } - /** * Performs an ABCI query to Tendermint without requesting a proof. * @@ -628,45 +530,4 @@ export class QueryClient { height: response.height, }; } - - // this must return the header for height+1 - // throws an error if height is 0 or undefined - private async getNextHeader(height?: number): Promise { - assertDefined(height); - if (height === 0) { - throw new Error("Query returned height 0, cannot prove it"); - } - - const searchHeight = height + 1; - let nextHeader: tendermint34.Header | undefined; - let headersSubscription: Stream | undefined; - try { - headersSubscription = this.cometClient.subscribeNewBlockHeader(); - } catch { - // Ignore exception caused by non-WebSocket Tendermint clients - } - - if (headersSubscription) { - const firstHeader = await firstEvent(headersSubscription); - // The first header we get might not be n+1 but n+2 or even higher. In such cases we fall back on a query. - if (firstHeader.height === searchHeight) { - nextHeader = firstHeader; - } - } - - while (!nextHeader) { - // start from current height to avoid backend error for minHeight in the future - const correctHeader = (await this.cometClient.blockchain(height, searchHeight)).blockMetas - .map((meta) => meta.header) - .find((h) => h.height === searchHeight); - if (correctHeader) { - nextHeader = correctHeader; - } else { - await sleep(1000); - } - } - - assert(nextHeader.height === searchHeight, "Got wrong header. This is a bug in the logic above."); - return nextHeader; - } } diff --git a/yarn.lock b/yarn.lock index 283e58874e..f46f7ff6b3 100644 --- a/yarn.lock +++ b/yarn.lock @@ -279,16 +279,6 @@ __metadata: languageName: node linkType: hard -"@confio/ics23@npm:^0.6.8": - version: 0.6.8 - resolution: "@confio/ics23@npm:0.6.8" - dependencies: - "@noble/hashes": "npm:^1.0.0" - protobufjs: "npm:^6.8.8" - checksum: 10c0/2f3f5032cd6a34c9b2fbd64bbf7e1cdec75ca71f348a770f7b5474b5027b12202bfbcd404eca931efddb5901f769af035a87cb8bddbf3f23d7e5d93c9d3d7f6f - languageName: node - linkType: hard - "@cosmjs/amino@workspace:^, @cosmjs/amino@workspace:packages/amino": version: 0.0.0-use.local resolution: "@cosmjs/amino@workspace:packages/amino" @@ -779,7 +769,7 @@ __metadata: karma-jasmine-html-reporter: "npm:^1.5.4" nyc: "npm:^15.1.0" prettier: "npm:^2.8.1" - protobufjs: "npm:~6.11.4" + protobufjs: "npm:^7.4.0" ses: "npm:^0.11.0" source-map-support: "npm:^0.5.19" ts-node: "npm:^8" @@ -838,7 +828,6 @@ __metadata: version: 0.0.0-use.local resolution: "@cosmjs/stargate@workspace:packages/stargate" dependencies: - "@confio/ics23": "npm:^0.6.8" "@cosmjs/amino": "workspace:^" "@cosmjs/crypto": "workspace:^" "@cosmjs/encoding": "workspace:^" @@ -883,7 +872,6 @@ __metadata: typescript: "npm:~4.9" webpack: "npm:^5.76.0" webpack-cli: "npm:^4.6.0" - xstream: "npm:^11.14.0" languageName: unknown linkType: soft @@ -1250,7 +1238,7 @@ __metadata: languageName: node linkType: hard -"@noble/hashes@npm:^1, @noble/hashes@npm:^1.0.0": +"@noble/hashes@npm:^1": version: 1.0.0 resolution: "@noble/hashes@npm:1.0.0" checksum: 10c0/b6244bb44d2c8774437034c5e416fb72188bbb16e1298fc3223c1a71f918d78496df79523d10d6953a8a6e3009dde745d022bb9aca2e5a5b92eede01b2d9664e @@ -5396,10 +5384,10 @@ __metadata: languageName: node linkType: hard -"long@npm:^4.0.0": - version: 4.0.0 - resolution: "long@npm:4.0.0" - checksum: 10c0/50a6417d15b06104dbe4e3d4a667c39b137f130a9108ea8752b352a4cfae047531a3ac351c181792f3f8768fe17cca6b0f406674a541a86fb638aaac560d83ed +"long@npm:^5.0.0": + version: 5.2.4 + resolution: "long@npm:5.2.4" + checksum: 10c0/0cf819ce2a7bbe48663e79233917552c7667b11e68d4d9ea4ebb99173042509d9af461e5211c22939b913332c264d9a1135937ea533cbd05bc4f8cf46f6d2e07 languageName: node linkType: hard @@ -6416,9 +6404,9 @@ __metadata: languageName: node linkType: hard -"protobufjs@npm:^6.8.8, protobufjs@npm:~6.11.4": - version: 6.11.4 - resolution: "protobufjs@npm:6.11.4" +"protobufjs@npm:^7.4.0": + version: 7.4.0 + resolution: "protobufjs@npm:7.4.0" dependencies: "@protobufjs/aspromise": "npm:^1.1.2" "@protobufjs/base64": "npm:^1.1.2" @@ -6430,13 +6418,9 @@ __metadata: "@protobufjs/path": "npm:^1.1.2" "@protobufjs/pool": "npm:^1.1.0" "@protobufjs/utf8": "npm:^1.1.0" - "@types/long": "npm:^4.0.1" "@types/node": "npm:>=13.7.0" - long: "npm:^4.0.0" - bin: - pbjs: bin/pbjs - pbts: bin/pbts - checksum: 10c0/c244d7b9b6d3258193da5c0d1e558dfb47f208ae345e209f90ec45c9dca911b90fa17e937892a9a39a4136ab9886981aae9efdf6039f7baff4f7225f5eeb9812 + long: "npm:^5.0.0" + checksum: 10c0/a5460a63fe596523b9a067cbce39a6b310d1a71750fda261f076535662aada97c24450e18c5bc98a27784f70500615904ff1227e1742183509f0db4fdede669b languageName: node linkType: hard