Merge pull request #1623 from cosmos/rm-verified-queries

Remove support for verified queries
This commit is contained in:
Simon Warta 2025-01-15 13:51:48 +01:00 committed by GitHub
commit 0b6a3bf04c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
26 changed files with 243 additions and 364 deletions

40
.pnp.cjs generated
View File

@ -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<compat/typescript>::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"\
}]\

Binary file not shown.

BIN
.yarn/cache/long-npm-4.0.0-ecd96a31ed-50a6417d15.zip (Stored with Git LFS) vendored

Binary file not shown.

BIN
.yarn/cache/long-npm-5.2.4-b96a88098c-0cf819ce2a.zip (Stored with Git LFS) vendored Normal file

Binary file not shown.

Binary file not shown.

BIN
.yarn/cache/protobufjs-npm-7.4.0-12c56a3adc-a5460a63fe.zip (Stored with Git LFS) vendored Normal file

Binary file not shown.

View File

@ -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`));

View File

@ -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`));

View File

@ -2,5 +2,8 @@
"name": "eslint",
"version": "7.26.0-sdk",
"main": "./lib/api.js",
"type": "commonjs"
"type": "commonjs",
"bin": {
"eslint": "./bin/eslint.js"
}
}

32
.yarn/sdks/prettier/bin-prettier.js vendored Executable file
View File

@ -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`));

20
.yarn/sdks/prettier/index.js vendored Executable file → Normal file
View File

@ -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`));

View File

@ -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"
}

View File

@ -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`));

View File

@ -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`));

View File

@ -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`));

View File

@ -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

View File

@ -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

View File

@ -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`));

View File

@ -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"
}
}

View File

@ -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

View File

@ -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",

View File

@ -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:^",

View File

@ -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<QueryDenomTracesResponse>;
readonly params: () => Promise<QueryTransferParamsResponse>;
};
readonly verified: {
readonly channel: {
readonly channel: (portId: string, channelId: string) => Promise<Channel | null>;
readonly packetCommitment: (
portId: string,
channelId: string,
sequence: number,
) => Promise<Uint8Array>;
readonly packetAcknowledgement: (
portId: string,
channelId: string,
sequence: number,
) => Promise<Uint8Array>;
readonly nextSequenceReceive: (portId: string, channelId: string) => Promise<number | null>;
};
};
};
}
@ -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;
},
},
},
},
};
}

View File

@ -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();

View File

@ -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<P> = (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<QueryStoreResponse> {
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<ProvenQuery> {
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<tendermint34.Header> {
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<tendermint34.NewBlockHeaderEvent> | 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;
}
}

View File

@ -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