Bump to @confio/ics23 v0.6.3

This commit is contained in:
Ethan Frey 2020-08-18 00:15:38 +02:00 committed by Simon Warta
parent 15b1f7d836
commit 598469bfac
4 changed files with 9 additions and 54 deletions

View File

@ -45,7 +45,7 @@
"postdefine-proto": "prettier --write \"src/codec/generated/codecimpl.*\""
},
"dependencies": {
"@confio/ics23": "^0.6.0",
"@confio/ics23": "^0.6.3",
"@cosmjs/encoding": "^0.22.1",
"@cosmjs/launchpad": "^0.22.1",
"@cosmjs/math": "^0.22.1",

View File

@ -1,45 +1,10 @@
/* eslint-disable no-dupe-class-members, @typescript-eslint/ban-types, @typescript-eslint/naming-convention */
import { ics23, verifyExistence, verifyNonExistence } from "@confio/ics23";
import { iavlSpec, ics23, tendermintSpec, verifyExistence, verifyNonExistence } from "@confio/ics23";
import { fromAscii, toAscii, toHex } from "@cosmjs/encoding";
import { firstEvent } from "@cosmjs/stream";
import { Client as TendermintClient } from "@cosmjs/tendermint-rpc";
import { arrayContentEquals, assert, isNonNullObject } from "@cosmjs/utils";
// TODO: import these from @confio/ics23 when exported
export const IavlSpec: ics23.IProofSpec = {
leafSpec: {
prefix: Uint8Array.from([0]),
hash: ics23.HashOp.SHA256,
prehashValue: ics23.HashOp.SHA256,
prehashKey: ics23.HashOp.NO_HASH,
length: ics23.LengthOp.VAR_PROTO,
},
innerSpec: {
childOrder: [0, 1],
minPrefixLength: 4,
maxPrefixLength: 12,
childSize: 33,
hash: ics23.HashOp.SHA256,
},
};
export const TendermintSpec: ics23.IProofSpec = {
leafSpec: {
prefix: Uint8Array.from([0]),
hash: ics23.HashOp.SHA256,
prehashValue: ics23.HashOp.SHA256,
prehashKey: ics23.HashOp.NO_HASH,
length: ics23.LengthOp.VAR_PROTO,
},
innerSpec: {
childOrder: [0, 1],
minPrefixLength: 1,
maxPrefixLength: 1,
childSize: 32,
hash: ics23.HashOp.SHA256,
},
};
type QueryExtensionSetup<P> = (base: QueryClient) => P;
export class QueryClient {
@ -233,13 +198,13 @@ export class QueryClient {
// 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, key);
verifyNonExistence(subProof.nonexist, iavlSpec, storeProof.exist.value, key);
} 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, key, response.value);
verifyExistence(subProof.exist, iavlSpec, storeProof.exist.value, key, response.value);
}
// the storeproof must map it's declared value (root of subProof) to the appHash of the next block
@ -253,7 +218,7 @@ export class QueryClient {
throw new Error(`Query returned height ${response.height}, but next header was ${header.height}`);
}
verifyExistence(storeProof.exist, TendermintSpec, header.appHash, toAscii(store), storeProof.exist.value);
verifyExistence(storeProof.exist, tendermintSpec, header.appHash, toAscii(store), storeProof.exist.value);
return response.value;
}

View File

@ -1,7 +1,4 @@
import { ics23 } from "@confio/ics23";
import { Client as TendermintClient } from "@cosmjs/tendermint-rpc";
export declare const IavlSpec: ics23.IProofSpec;
export declare const TendermintSpec: ics23.IProofSpec;
declare type QueryExtensionSetup<P> = (base: QueryClient) => P;
export declare class QueryClient {
/** Constructs a QueryClient with 0 extensions */

View File

@ -177,22 +177,15 @@
lodash "^4.17.13"
to-fast-properties "^2.0.0"
"@confio/ics23@^0.6.0":
version "0.6.0"
resolved "https://registry.yarnpkg.com/@confio/ics23/-/ics23-0.6.0.tgz#8c3e6508159bdbee02b12beeee9b369ea68ef6ba"
integrity sha512-P/NcAO3pz7xXg4cpwaKRUIN4PuOOxwY94n7WD+wod7UG5YlMLzb8Upv6nZo9/brnKXW4gXB2DccLTtV0Um1Wvw==
"@confio/ics23@^0.6.3":
version "0.6.3"
resolved "https://registry.yarnpkg.com/@confio/ics23/-/ics23-0.6.3.tgz#d27da1efca21253dee1b7d038913d72a99a17ca1"
integrity sha512-SQDH9tTzXIbC1AVTrjL7BEXfsYwERXNOB7F995LhfJDrP44cC5sl3Prh+lkfKOjn1jkgxknVUyaGx3tMG88gjQ==
dependencies:
protobufjs "^6.8.8"
ripemd160 "^2.0.2"
sha.js "^2.4.11"
"@cosmjs/stream@^0.22.2":
version "0.22.2"
resolved "https://registry.yarnpkg.com/@cosmjs/stream/-/stream-0.22.2.tgz#060c00374d06586a23b53f1f3a7f0bd4aa98557d"
integrity sha512-X3EG8HNn3nW+2iXjff6r8a77crermJ/aSijLxzw1in9+hipF6hG4UmSxN14knSPF6lfqSp80oFoKR6GT1/2r5w==
dependencies:
xstream "^11.10.0"
"@evocateur/libnpmaccess@^3.1.2":
version "3.1.2"
resolved "https://registry.yarnpkg.com/@evocateur/libnpmaccess/-/libnpmaccess-3.1.2.tgz#ecf7f6ce6b004e9f942b098d92200be4a4b1c845"