Merge pull request #471 from CosmWasm/377-update-simapp

Update simapp
This commit is contained in:
Simon Warta 2020-10-15 14:19:06 +02:00 committed by GitHub
commit dd1a94c471
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
57 changed files with 32695 additions and 42577 deletions

View File

@ -40,7 +40,7 @@
"coverage": "nyc --reporter=text --reporter=lcov yarn test --quiet",
"pack-web": "yarn build-or-skip && webpack --mode development --config webpack.web.config.js",
"preget-proto": "rm -rf proto",
"get-proto": "REF=20c80cfd44a068a592148d648c50de3459fd6295 ./scripts/get-proto.sh",
"get-proto": "REF=v0.40.0-rc0 ./scripts/get-proto.sh",
"predefine-proto": "./scripts/predefine-proto.sh",
"define-proto": "./scripts/define-proto.sh",
"postdefine-proto": "prettier --write \"src/codec/generated/codecimpl.*\""

View File

@ -9,7 +9,7 @@ ZIP_FILE="$COSMOS_DIR/tmp.zip"
REF=${REF:-"master"}
SUFFIX=${REF}
[[ $SUFFIX =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]] && SUFFIX=${SUFFIX#v}
[[ $SUFFIX =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-.+)?$ ]] && SUFFIX=${SUFFIX#v}
mkdir -p "$COSMOS_DIR"

View File

@ -6,7 +6,6 @@ GENERATED_DIR="./tmp"
ROOT_PROTO_DIR="./proto/cosmos/cosmos-sdk"
COSMOS_PROTO_DIR="$ROOT_PROTO_DIR/proto/cosmos"
TENDERMINT_PROTO_DIR="$ROOT_PROTO_DIR/third_party/proto/tendermint"
GOOGLE_PROTO_DIR="$ROOT_PROTO_DIR/third_party/proto/google"
mkdir -p "$GENERATED_DIR"
yarn pbjs \
@ -20,15 +19,14 @@ yarn pbjs \
--no-verify \
--no-convert \
--force-long \
"$COSMOS_PROTO_DIR/cosmos.proto" \
"$COSMOS_PROTO_DIR/bank/bank.proto" \
"$COSMOS_PROTO_DIR/crypto/crypto.proto" \
"$COSMOS_PROTO_DIR/tx/tx.proto" \
"$COSMOS_PROTO_DIR/tx/signing/signing.proto" \
"$TENDERMINT_PROTO_DIR/abci/types/types.proto" \
"$TENDERMINT_PROTO_DIR/crypto/merkle/merkle.proto" \
"$TENDERMINT_PROTO_DIR/libs/kv/types.proto" \
"$GOOGLE_PROTO_DIR/protobuf/any.proto"
"$COSMOS_PROTO_DIR/bank/v1beta1/bank.proto" \
"$COSMOS_PROTO_DIR/bank/v1beta1/tx.proto" \
"$COSMOS_PROTO_DIR/base/v1beta1/coin.proto" \
"$COSMOS_PROTO_DIR/crypto/multisig/v1beta1/multisig.proto" \
"$COSMOS_PROTO_DIR/crypto/secp256k1/keys.proto" \
"$COSMOS_PROTO_DIR/tx/v1beta1/tx.proto" \
"$COSMOS_PROTO_DIR/tx/signing/v1beta1/signing.proto" \
"$TENDERMINT_PROTO_DIR/crypto/keys.proto"
# Work around https://github.com/protobufjs/protobuf.js/issues/1477
# shellcheck disable=SC2016

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -7,7 +7,7 @@ import { cosmos, google } from "./codec";
import { cosmosField, registered } from "./decorator";
import { Registry } from "./registry";
const { TxBody } = cosmos.tx;
const { TxBody } = cosmos.tx.v1beta1;
const { Any } = google.protobuf;
describe("decorator demo", () => {

View File

@ -12,9 +12,9 @@ type MsgDemo = {
readonly example: string;
};
const { Coin } = cosmos;
const { TxBody } = cosmos.tx;
const { MsgSend } = cosmos.bank;
const { Coin } = cosmos.base.v1beta1;
const { TxBody } = cosmos.tx.v1beta1;
const { MsgSend } = cosmos.bank.v1beta1;
const { Any } = google.protobuf;
function getTypeName(typeUrl: string): string {
@ -29,13 +29,13 @@ describe("protobuf demo", () => {
amount: "1234567890",
});
const msgSend = MsgSend.create({
fromAddress: Uint8Array.from(Array.from({ length: 20 }, () => 1)),
toAddress: Uint8Array.from(Array.from({ length: 20 }, () => 2)),
fromAddress: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6",
toAddress: "cosmos1qypqxpq9qcrsszg2pvxq6rs0zqg3yyc5lzv7xu",
amount: [coin],
});
const msgSendBytes = MsgSend.encode(msgSend).finish();
const msgSendWrapped = Any.create({
type_url: "/cosmos.bank.MsgSend",
type_url: "/cosmos.bank.v1beta1.MsgSend",
value: msgSendBytes,
});
const txBody = TxBody.create({
@ -53,8 +53,8 @@ describe("protobuf demo", () => {
const msgSendDecoded = MsgSend.decode(msg.value);
// fromAddress and toAddress are now Buffers
expect(Uint8Array.from(msgSendDecoded.fromAddress)).toEqual(msgSend.fromAddress);
expect(Uint8Array.from(msgSendDecoded.toAddress)).toEqual(msgSend.toAddress);
expect(msgSendDecoded.fromAddress).toEqual(msgSend.fromAddress);
expect(msgSendDecoded.toAddress).toEqual(msgSend.toAddress);
expect(msgSendDecoded.amount).toEqual(msgSend.amount);
});

View File

@ -2,4 +2,5 @@ export { Coin } from "./msgs";
export { cosmosField } from "./decorator";
export { Registry } from "./registry";
export { DirectSecp256k1Wallet } from "./directsecp256k1wallet";
export { decodePubkey, encodePubkey } from "./pubkey";
export { makeAuthInfo, makeSignBytes } from "./signing";

View File

@ -60,12 +60,12 @@ describe("registry magic demo", () => {
extensionOptions: [],
};
const txBodyBytes = myRegistry.encode({
typeUrl: "/cosmos.tx.TxBody",
typeUrl: "/cosmos.tx.v1beta1.TxBody",
value: txBodyFields,
});
const txBodyDecoded = myRegistry.decode({
typeUrl: "/cosmos.tx.TxBody",
typeUrl: "/cosmos.tx.v1beta1.TxBody",
value: txBodyBytes,
});
expect(txBodyDecoded.memo).toEqual(txBodyFields.memo);

View File

@ -1,29 +1,27 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { fromHex } from "@cosmjs/encoding";
import { cosmos } from "./codec";
import { Coin, MsgSend } from "./msgs";
describe("msgs", () => {
it("encodes decorated MsgSend equally to static code", () => {
const alice = fromHex("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA");
const bob = fromHex("BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB");
const alice = "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6";
const bob = "cosmos1qypqxpq9qcrsszg2pvxq6rs0zqg3yyc5lzv7xu";
const amount = [
new Coin({ denom: "utoken", amount: "123" }),
new Coin({ denom: "ustake", amount: "654" }),
];
const donation = new MsgSend({ from_address: alice, to_address: bob, amount });
const expected = cosmos.bank.MsgSend.encode(
cosmos.bank.MsgSend.create({
const expected = cosmos.bank.v1beta1.MsgSend.encode(
cosmos.bank.v1beta1.MsgSend.create({
fromAddress: alice,
toAddress: bob,
amount: [
cosmos.Coin.create({
cosmos.base.v1beta1.Coin.create({
denom: "utoken",
amount: "123",
}),
cosmos.Coin.create({
cosmos.base.v1beta1.Coin.create({
denom: "ustake",
amount: "654",
}),

View File

@ -6,7 +6,7 @@ import { Registry } from "./registry";
export const defaultRegistry = new Registry();
@registered(defaultRegistry, "/cosmos.Coin")
@registered(defaultRegistry, "/cosmos.base.v1beta1.Coin")
export class Coin extends Message {
@cosmosField.string(1)
public readonly denom?: string;
@ -15,13 +15,13 @@ export class Coin extends Message {
public readonly amount?: string;
}
@registered(defaultRegistry, "/cosmos.bank.MsgSend")
@registered(defaultRegistry, "/cosmos.bank.v1beta1.MsgSend")
export class MsgSend extends Message {
@cosmosField.bytes(1)
public readonly from_address?: Uint8Array;
@cosmosField.string(1)
public readonly from_address?: string;
@cosmosField.bytes(2)
public readonly to_address?: Uint8Array;
@cosmosField.string(2)
public readonly to_address?: string;
@cosmosField.repeatedMessage(3, Coin)
public readonly amount?: readonly Coin[];

View File

@ -0,0 +1,54 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { fromBase64 } from "@cosmjs/encoding";
import { google } from "./codec";
import { decodePubkey, encodePubkey } from "./pubkey";
const { Any } = google.protobuf;
describe("pubkey", () => {
const defaultPubkeyBase64 = "AtQaCqFnshaZQp6rIkvAPyzThvCvXSDO+9AzbxVErqJP";
const defaultPubkeyBytes = fromBase64(defaultPubkeyBase64);
const defaultPubkeyProtoBytes = Uint8Array.from([0x0a, defaultPubkeyBytes.length, ...defaultPubkeyBytes]);
describe("encodePubkey", () => {
it("works for secp256k1", () => {
const pubkey = { type: "tendermint/PubKeySecp256k1", value: defaultPubkeyBase64 };
expect(encodePubkey(pubkey)).toEqual(
Any.create({
type_url: "/cosmos.crypto.secp256k1.PubKey",
value: defaultPubkeyProtoBytes,
}),
);
});
it("throws for unsupported pubkey types", () => {
const pubkey = {
type: "tendermint/PubKeyUnknown",
value: defaultPubkeyBase64,
};
expect(() => encodePubkey(pubkey)).toThrowError(/not recognized/i);
});
});
describe("decodePubkey", () => {
it("works for secp256k1", () => {
const pubkey = {
type_url: "/cosmos.crypto.secp256k1.PubKey",
value: defaultPubkeyProtoBytes,
};
expect(decodePubkey(pubkey)).toEqual({
type: "tendermint/PubKeySecp256k1",
value: defaultPubkeyBase64,
});
});
it("throws for unsupported pubkey types", () => {
const pubkey = {
type_url: "/cosmos.crypto.unknown.PubKey",
value: defaultPubkeyProtoBytes,
};
expect(() => decodePubkey(pubkey)).toThrowError(/not recognized/i);
});
});
});

View File

@ -0,0 +1,38 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { fromBase64 } from "@cosmjs/encoding";
import { encodeSecp256k1Pubkey, PubKey } from "@cosmjs/launchpad";
import { cosmos, google } from "./codec";
const { Any } = google.protobuf;
export function encodePubkey(pubkey: PubKey): google.protobuf.IAny {
switch (pubkey.type) {
case "tendermint/PubKeySecp256k1": {
const pubkeyProto = cosmos.crypto.secp256k1.PubKey.create({
key: fromBase64(pubkey.value),
});
return Any.create({
type_url: "/cosmos.crypto.secp256k1.PubKey",
value: Uint8Array.from(cosmos.crypto.secp256k1.PubKey.encode(pubkeyProto).finish()),
});
}
default:
throw new Error(`Pubkey type ${pubkey.type} not recognized`);
}
}
export function decodePubkey(pubkey?: google.protobuf.IAny | null): PubKey | null {
if (!pubkey || !pubkey.value) {
return null;
}
switch (pubkey.type_url) {
case "/cosmos.crypto.secp256k1.PubKey": {
const { key } = cosmos.crypto.secp256k1.PubKey.decode(pubkey.value);
return encodeSecp256k1Pubkey(key);
}
default:
throw new Error(`Pubkey type_url ${pubkey.type_url} not recognized`);
}
}

View File

@ -6,27 +6,27 @@ import { cosmos, google } from "./codec";
import { MsgDemo as MsgDemoType } from "./demo";
import { Registry } from "./registry";
const { TxBody } = cosmos.tx;
const { TxBody } = cosmos.tx.v1beta1;
const { Any } = google.protobuf;
describe("registry demo", () => {
it("works with a default msg", () => {
const registry = new Registry();
const Coin = registry.lookupType("/cosmos.Coin")!;
const MsgSend = registry.lookupType("/cosmos.bank.MsgSend")!;
const Coin = registry.lookupType("/cosmos.base.v1beta1.Coin")!;
const MsgSend = registry.lookupType("/cosmos.bank.v1beta1.MsgSend")!;
const coin = Coin.create({
denom: "ucosm",
amount: "1234567890",
});
const msgSend = (MsgSend.create({
fromAddress: Uint8Array.from(Array.from({ length: 20 }, () => 1)),
toAddress: Uint8Array.from(Array.from({ length: 20 }, () => 2)),
fromAddress: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6",
toAddress: "cosmos1qypqxpq9qcrsszg2pvxq6rs0zqg3yyc5lzv7xu",
amount: [coin],
}) as unknown) as cosmos.bank.MsgSend;
}) as unknown) as cosmos.bank.v1beta1.MsgSend;
const msgSendBytes = MsgSend.encode(msgSend).finish();
const msgSendWrapped = Any.create({
type_url: "/cosmos.bank.MsgSend",
type_url: "/cosmos.bank.v1beta1.MsgSend",
value: msgSendBytes,
});
const txBody = TxBody.create({
@ -46,8 +46,8 @@ describe("registry demo", () => {
const msgSendDecoded = decoder.decode(msg.value);
// fromAddress and toAddress are now Buffers
expect(Uint8Array.from(msgSendDecoded.fromAddress)).toEqual(msgSend.fromAddress);
expect(Uint8Array.from(msgSendDecoded.toAddress)).toEqual(msgSend.toAddress);
expect(msgSendDecoded.fromAddress).toEqual(msgSend.fromAddress);
expect(msgSendDecoded.toAddress).toEqual(msgSend.toAddress);
expect(msgSendDecoded.amount).toEqual(msgSend.amount);
});

View File

@ -29,9 +29,9 @@ export interface TxBodyValue {
}
const defaultTypeUrls = {
cosmosCoin: "/cosmos.Coin",
cosmosMsgSend: "/cosmos.bank.MsgSend",
cosmosTxBody: "/cosmos.tx.TxBody",
cosmosCoin: "/cosmos.base.v1beta1.Coin",
cosmosMsgSend: "/cosmos.bank.v1beta1.MsgSend",
cosmosTxBody: "/cosmos.tx.v1beta1.TxBody",
googleAny: "/google.protobuf.Any",
};
@ -41,8 +41,8 @@ export class Registry {
public constructor(customTypes: Iterable<[string, GeneratedType]> = []) {
const { cosmosCoin, cosmosMsgSend } = defaultTypeUrls;
this.types = new Map<string, GeneratedType>([
[cosmosCoin, cosmos.Coin],
[cosmosMsgSend, cosmos.bank.MsgSend],
[cosmosCoin, cosmos.base.v1beta1.Coin],
[cosmosMsgSend, cosmos.bank.v1beta1.MsgSend],
...customTypes,
]);
}
@ -73,7 +73,7 @@ export class Registry {
}
public encodeTxBody(txBodyFields: TxBodyValue): Uint8Array {
const { TxBody } = cosmos.tx;
const { TxBody } = cosmos.tx.v1beta1;
const { Any } = google.protobuf;
const wrappedMessages = txBodyFields.messages.map((message) => {
@ -104,8 +104,8 @@ export class Registry {
return decoded;
}
public decodeTxBody(txBody: Uint8Array): cosmos.tx.TxBody {
const { TxBody } = cosmos.tx;
public decodeTxBody(txBody: Uint8Array): cosmos.tx.v1beta1.TxBody {
const { TxBody } = cosmos.tx.v1beta1;
const decodedTxBody = TxBody.decode(txBody);
return {

View File

@ -1,20 +1,15 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { Bech32, fromBase64, fromHex, toHex } from "@cosmjs/encoding";
import { fromBase64, fromHex, toHex } from "@cosmjs/encoding";
import { cosmos } from "./codec";
import { cosmos, google } from "./codec";
import { DirectSecp256k1Wallet } from "./directsecp256k1wallet";
import { defaultRegistry } from "./msgs";
import { Registry, TxBodyValue } from "./registry";
import { makeAuthInfo, makeSignBytes } from "./signing";
const { AuthInfo, Tx, TxBody } = cosmos.tx;
const { PublicKey } = cosmos.crypto;
export function pendingWithoutSimapp(): void {
if (!process.env.SIMAPP_ENABLED) {
return pending("Set SIMAPP_ENABLED to enable Simapp based tests");
}
}
const { Tx, TxRaw } = cosmos.tx.v1beta1;
const { PubKey } = cosmos.crypto.secp256k1;
const { Any } = google.protobuf;
const faucet = {
mnemonic:
@ -26,71 +21,76 @@ const faucet = {
address: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6",
};
// Test vectors were generated using this command with Ethans custom fork of Cosmos-SDK with printf:
// simd tx bank send --sign-mode direct --chain-id simd-testing testgen cosmos1qypqxpq9qcrsszg2pvxq6rs0zqg3yyc5lzv7xu 1234567ucosm -b block
const testVectors = [
{
sequence: 0,
signedTxBytes:
"0a580a560a142f636f736d6f732e62616e6b2e4d736753656e64123e0a140d82b1e7c96dbfa42462fe612932e6bff111d51b12140102030405060708090a0b0c0d0e0f10111213141a100a0575636f736d12073132333435363712330a2b0a230a21034f04181eeba35391b858633a765c4a0c189697b40d216354d50890d350c7029012040a020801120410c09a0c1a40692d88f681d5d69924a53668e8ecec535ca0ca170d1febfb1dd87de9959b07340427d6bba22526d6c30cc622f27dc5eb1ce04cfc0ff98716154066ec69db62e5",
"0a93010a90010a1c2f636f736d6f732e62616e6b2e763162657461312e4d736753656e6412700a2d636f736d6f7331706b707472653766646b6c366766727a6c65736a6a766878686c63337234676d6d6b38727336122d636f736d6f7331717970717870713971637273737a673270767871367273307a716733797963356c7a763778751a100a0575636f736d12073132333435363712650a4e0a460a1f2f636f736d6f732e63727970746f2e736563703235366b312e5075624b657912230a21034f04181eeba35391b858633a765c4a0c189697b40d216354d50890d350c7029012040a02080112130a0d0a0575636f736d12043230303010c09a0c1a40c9dd20e07464d3a688ff4b710b1fbc027e495e797cfa0b4804da2ed117959227772de059808f765aa29b8f92edf30f4c2c5a438e30d3fe6897daa7141e3ce6f9",
signBytes:
"0a580a560a142f636f736d6f732e62616e6b2e4d736753656e64123e0a140d82b1e7c96dbfa42462fe612932e6bff111d51b12140102030405060708090a0b0c0d0e0f10111213141a100a0575636f736d12073132333435363712330a2b0a230a21034f04181eeba35391b858633a765c4a0c189697b40d216354d50890d350c7029012040a020801120410c09a0c1a0c73696d642d74657374696e672001",
"0a93010a90010a1c2f636f736d6f732e62616e6b2e763162657461312e4d736753656e6412700a2d636f736d6f7331706b707472653766646b6c366766727a6c65736a6a766878686c63337234676d6d6b38727336122d636f736d6f7331717970717870713971637273737a673270767871367273307a716733797963356c7a763778751a100a0575636f736d12073132333435363712650a4e0a460a1f2f636f736d6f732e63727970746f2e736563703235366b312e5075624b657912230a21034f04181eeba35391b858633a765c4a0c189697b40d216354d50890d350c7029012040a02080112130a0d0a0575636f736d12043230303010c09a0c1a0c73696d642d74657374696e672001",
signature:
"692d88f681d5d69924a53668e8ecec535ca0ca170d1febfb1dd87de9959b07340427d6bba22526d6c30cc622f27dc5eb1ce04cfc0ff98716154066ec69db62e5",
"c9dd20e07464d3a688ff4b710b1fbc027e495e797cfa0b4804da2ed117959227772de059808f765aa29b8f92edf30f4c2c5a438e30d3fe6897daa7141e3ce6f9",
},
{
sequence: 1,
signedTxBytes:
"0a580a560a142f636f736d6f732e62616e6b2e4d736753656e64123e0a140d82b1e7c96dbfa42462fe612932e6bff111d51b12140102030405060708090a0b0c0d0e0f10111213141a100a0575636f736d12073132333435363712330a2b0a230a21034f04181eeba35391b858633a765c4a0c189697b40d216354d50890d350c7029012040a020801120410c09a0c1a40811c3c7dd85b1478b15e3cc710503045559d805d2bf538e5015dbcd868a440a94c7fc0b12b755a838cc3f9b8245d9f926e0432d07ee97557cff7c50c73f64a58",
"0a93010a90010a1c2f636f736d6f732e62616e6b2e763162657461312e4d736753656e6412700a2d636f736d6f7331706b707472653766646b6c366766727a6c65736a6a766878686c63337234676d6d6b38727336122d636f736d6f7331717970717870713971637273737a673270767871367273307a716733797963356c7a763778751a100a0575636f736d12073132333435363712670a500a460a1f2f636f736d6f732e63727970746f2e736563703235366b312e5075624b657912230a21034f04181eeba35391b858633a765c4a0c189697b40d216354d50890d350c7029012040a020801180112130a0d0a0575636f736d12043230303010c09a0c1a40525adc7e61565a509c60497b798c549fbf217bb5cd31b24cc9b419d098cc95330c99ecc4bc72448f85c365a4e3f91299a3d40412fb3751bab82f1940a83a0a4c",
signBytes:
"0a580a560a142f636f736d6f732e62616e6b2e4d736753656e64123e0a140d82b1e7c96dbfa42462fe612932e6bff111d51b12140102030405060708090a0b0c0d0e0f10111213141a100a0575636f736d12073132333435363712330a2b0a230a21034f04181eeba35391b858633a765c4a0c189697b40d216354d50890d350c7029012040a020801120410c09a0c1a0c73696d642d74657374696e6720012801",
"0a93010a90010a1c2f636f736d6f732e62616e6b2e763162657461312e4d736753656e6412700a2d636f736d6f7331706b707472653766646b6c366766727a6c65736a6a766878686c63337234676d6d6b38727336122d636f736d6f7331717970717870713971637273737a673270767871367273307a716733797963356c7a763778751a100a0575636f736d12073132333435363712670a500a460a1f2f636f736d6f732e63727970746f2e736563703235366b312e5075624b657912230a21034f04181eeba35391b858633a765c4a0c189697b40d216354d50890d350c7029012040a020801180112130a0d0a0575636f736d12043230303010c09a0c1a0c73696d642d74657374696e672001",
signature:
"811c3c7dd85b1478b15e3cc710503045559d805d2bf538e5015dbcd868a440a94c7fc0b12b755a838cc3f9b8245d9f926e0432d07ee97557cff7c50c73f64a58",
"525adc7e61565a509c60497b798c549fbf217bb5cd31b24cc9b419d098cc95330c99ecc4bc72448f85c365a4e3f91299a3d40412fb3751bab82f1940a83a0a4c",
},
{
sequence: 2,
signedTxBytes:
"0a580a560a142f636f736d6f732e62616e6b2e4d736753656e64123e0a140d82b1e7c96dbfa42462fe612932e6bff111d51b12140102030405060708090a0b0c0d0e0f10111213141a100a0575636f736d12073132333435363712330a2b0a230a21034f04181eeba35391b858633a765c4a0c189697b40d216354d50890d350c7029012040a020801120410c09a0c1a405e2e11567c181db4f38788ff6d417b1f7d147f3d6bd8274989bf181c35b3fb97218f64172030dd5a84dd38933765609d70771cbba60168d8ded611f14ec4fb12",
"0a93010a90010a1c2f636f736d6f732e62616e6b2e763162657461312e4d736753656e6412700a2d636f736d6f7331706b707472653766646b6c366766727a6c65736a6a766878686c63337234676d6d6b38727336122d636f736d6f7331717970717870713971637273737a673270767871367273307a716733797963356c7a763778751a100a0575636f736d12073132333435363712670a500a460a1f2f636f736d6f732e63727970746f2e736563703235366b312e5075624b657912230a21034f04181eeba35391b858633a765c4a0c189697b40d216354d50890d350c7029012040a020801180212130a0d0a0575636f736d12043230303010c09a0c1a40f3f2ca73806f2abbf6e0fe85f9b8af66f0e9f7f79051fdb8abe5bb8633b17da132e82d577b9d5f7a6dae57a144efc9ccc6eef15167b44b3b22a57240109762af",
signBytes:
"0a580a560a142f636f736d6f732e62616e6b2e4d736753656e64123e0a140d82b1e7c96dbfa42462fe612932e6bff111d51b12140102030405060708090a0b0c0d0e0f10111213141a100a0575636f736d12073132333435363712330a2b0a230a21034f04181eeba35391b858633a765c4a0c189697b40d216354d50890d350c7029012040a020801120410c09a0c1a0c73696d642d74657374696e6720012802",
"0a93010a90010a1c2f636f736d6f732e62616e6b2e763162657461312e4d736753656e6412700a2d636f736d6f7331706b707472653766646b6c366766727a6c65736a6a766878686c63337234676d6d6b38727336122d636f736d6f7331717970717870713971637273737a673270767871367273307a716733797963356c7a763778751a100a0575636f736d12073132333435363712670a500a460a1f2f636f736d6f732e63727970746f2e736563703235366b312e5075624b657912230a21034f04181eeba35391b858633a765c4a0c189697b40d216354d50890d350c7029012040a020801180212130a0d0a0575636f736d12043230303010c09a0c1a0c73696d642d74657374696e672001",
signature:
"5e2e11567c181db4f38788ff6d417b1f7d147f3d6bd8274989bf181c35b3fb97218f64172030dd5a84dd38933765609d70771cbba60168d8ded611f14ec4fb12",
"f3f2ca73806f2abbf6e0fe85f9b8af66f0e9f7f79051fdb8abe5bb8633b17da132e82d577b9d5f7a6dae57a144efc9ccc6eef15167b44b3b22a57240109762af",
},
];
describe("signing", () => {
const chainId = "simd-testing";
const toAddress = Uint8Array.from({ length: 20 }, (_, i) => i + 1);
const toAddress = "cosmos1qypqxpq9qcrsszg2pvxq6rs0zqg3yyc5lzv7xu";
const sendAmount = "1234567";
const sendDenom = "ucosm";
const feeAmount = [
{
amount: "2000",
denom: "ucosm",
},
];
const gasLimit = 200000;
it("correctly parses test vectors", async () => {
const wallet = await DirectSecp256k1Wallet.fromMnemonic(faucet.mnemonic);
const [{ address, pubkey: pubkeyBytes }] = await wallet.getAccounts();
const prefixedPubkeyBytes = Uint8Array.from([0x0a, pubkeyBytes.length, ...pubkeyBytes]);
testVectors.forEach(({ signedTxBytes }) => {
const parsedTestTx = Tx.decode(fromHex(signedTxBytes));
expect(parsedTestTx.signatures.length).toEqual(1);
expect(parsedTestTx.authInfo?.signerInfos?.length).toEqual(1);
expect(parsedTestTx.authInfo?.signerInfos![0].publicKey!.secp256k1).toEqual(pubkeyBytes);
expect(parsedTestTx.authInfo?.signerInfos![0].modeInfo!.single!.mode).toEqual(
cosmos.tx.signing.SignMode.SIGN_MODE_DIRECT,
expect(parsedTestTx.authInfo!.signerInfos!.length).toEqual(1);
expect(Uint8Array.from(parsedTestTx.authInfo!.signerInfos![0].publicKey!.value ?? [])).toEqual(
prefixedPubkeyBytes,
);
expect(parsedTestTx.authInfo?.fee!.amount).toEqual([]);
expect(parsedTestTx.authInfo?.fee!.gasLimit!.toString()).toEqual(gasLimit.toString());
expect(parsedTestTx.body?.extensionOptions).toEqual([]);
expect(parsedTestTx.body?.nonCriticalExtensionOptions).toEqual([]);
expect(parsedTestTx.authInfo?.signerInfos![0].modeInfo!.single!.mode).toEqual(
cosmos.tx.signing.v1beta1.SignMode.SIGN_MODE_DIRECT,
);
expect({ ...parsedTestTx.authInfo!.fee!.amount![0] }).toEqual({ denom: "ucosm", amount: "2000" });
expect(parsedTestTx.authInfo!.fee!.gasLimit!.toString()).toEqual(gasLimit.toString());
expect(parsedTestTx.body!.extensionOptions).toEqual([]);
expect(parsedTestTx.body!.nonCriticalExtensionOptions).toEqual([]);
expect(parsedTestTx.body!.messages!.length).toEqual(1);
const parsedTestTxMsg = defaultRegistry.decode({
typeUrl: parsedTestTx.body!.messages![0].type_url!,
value: parsedTestTx.body!.messages![0].value!,
});
expect(parsedTestTxMsg.from_address).toEqual(Bech32.decode(address).data);
expect(parsedTestTxMsg.from_address).toEqual(address);
expect(parsedTestTxMsg.to_address).toEqual(toAddress);
expect(parsedTestTxMsg.amount.length).toEqual(1);
expect(parsedTestTxMsg.amount[0].denom).toEqual(sendDenom);
@ -102,16 +102,17 @@ describe("signing", () => {
const myRegistry = new Registry();
const wallet = await DirectSecp256k1Wallet.fromMnemonic(faucet.mnemonic);
const [{ address, pubkey: pubkeyBytes }] = await wallet.getAccounts();
const publicKey = PublicKey.create({
secp256k1: pubkeyBytes,
const publicKey = PubKey.create({
key: pubkeyBytes,
});
const publicKeyBytes = PubKey.encode(publicKey).finish();
const txBodyFields: TxBodyValue = {
messages: [
{
typeUrl: "/cosmos.bank.MsgSend",
typeUrl: "/cosmos.bank.v1beta1.MsgSend",
value: {
fromAddress: Bech32.decode(address).data,
fromAddress: address,
toAddress: toAddress,
amount: [
{
@ -124,27 +125,26 @@ describe("signing", () => {
],
};
const txBodyBytes = myRegistry.encode({
typeUrl: "/cosmos.tx.TxBody",
typeUrl: "/cosmos.tx.v1beta1.TxBody",
value: txBodyFields,
});
const txBody = TxBody.decode(txBodyBytes);
const authInfoBytes = makeAuthInfo([publicKey], gasLimit);
const publicKeyAny = Any.create({ type_url: "/cosmos.crypto.secp256k1.PubKey", value: publicKeyBytes });
const accountNumber = 1;
await Promise.all(
testVectors.map(async ({ sequence, signBytes, signedTxBytes }) => {
const signDocBytes = makeSignBytes(txBodyBytes, authInfoBytes, chainId, accountNumber, sequence);
const authInfoBytes = makeAuthInfo([publicKeyAny], feeAmount, gasLimit, sequence);
const signDocBytes = makeSignBytes(txBodyBytes, authInfoBytes, chainId, accountNumber);
expect(toHex(signDocBytes)).toEqual(signBytes);
const signature = await wallet.sign(address, signDocBytes);
// TODO: Why is this not a TxRaw? https://github.com/CosmWasm/cosmjs/issues/383
const txRaw = Tx.create({
body: txBody,
authInfo: AuthInfo.decode(authInfoBytes),
const txRaw = TxRaw.create({
bodyBytes: txBodyBytes,
authInfoBytes: authInfoBytes,
signatures: [fromBase64(signature.signature)],
});
const txRawBytes = Uint8Array.from(Tx.encode(txRaw).finish());
const txRawBytes = Uint8Array.from(TxRaw.encode(txRaw).finish());
const txBytesHex = toHex(txRawBytes);
expect(txBytesHex).toEqual(signedTxBytes);
}),

View File

@ -2,24 +2,30 @@
import Long from "long";
import { omitDefaults } from "./adr27";
import { cosmos } from "./codec";
import { cosmos, google } from "./codec";
const { SignDoc, AuthInfo } = cosmos.tx;
const { SignDoc, AuthInfo } = cosmos.tx.v1beta1;
/**
* Creates and serializes an AuthInfo document using SIGN_MODE_DIRECT.
*/
export function makeAuthInfo(pubkeys: readonly cosmos.crypto.IPublicKey[], gasLimit: number): Uint8Array {
export function makeAuthInfo(
pubkeys: readonly google.protobuf.IAny[],
feeAmount: cosmos.base.v1beta1.Coin[],
gasLimit: number,
sequence: number,
): Uint8Array {
const authInfo = {
signerInfos: pubkeys.map(
(pubkey): cosmos.tx.ISignerInfo => ({
(pubkey): cosmos.tx.v1beta1.ISignerInfo => ({
publicKey: pubkey,
modeInfo: {
single: { mode: cosmos.tx.signing.SignMode.SIGN_MODE_DIRECT },
single: { mode: cosmos.tx.signing.v1beta1.SignMode.SIGN_MODE_DIRECT },
},
sequence: sequence ? Long.fromNumber(sequence) : undefined,
}),
),
fee: { gasLimit: Long.fromNumber(gasLimit) },
fee: { amount: feeAmount, gasLimit: Long.fromNumber(gasLimit) },
};
return Uint8Array.from(AuthInfo.encode(authInfo).finish());
}
@ -29,7 +35,6 @@ export function makeSignBytes(
authInfo: Uint8Array,
chainId: string,
accountNumber: number,
sequence: number,
): Uint8Array {
const signDoc = SignDoc.create(
omitDefaults({
@ -37,7 +42,6 @@ export function makeSignBytes(
authInfoBytes: authInfo,
chainId: chainId,
accountNumber: accountNumber,
accountSequence: sequence,
}),
);
return Uint8Array.from(SignDoc.encode(signDoc).finish());

File diff suppressed because it is too large Load Diff

View File

@ -2,4 +2,5 @@ export { Coin } from "./msgs";
export { cosmosField } from "./decorator";
export { Registry } from "./registry";
export { DirectSecp256k1Wallet } from "./directsecp256k1wallet";
export { decodePubkey, encodePubkey } from "./pubkey";
export { makeAuthInfo, makeSignBytes } from "./signing";

View File

@ -6,7 +6,7 @@ export declare class Coin extends Message {
readonly amount?: string;
}
export declare class MsgSend extends Message {
readonly from_address?: Uint8Array;
readonly to_address?: Uint8Array;
readonly from_address?: string;
readonly to_address?: string;
readonly amount?: readonly Coin[];
}

View File

@ -0,0 +1,4 @@
import { PubKey } from "@cosmjs/launchpad";
import { google } from "./codec";
export declare function encodePubkey(pubkey: PubKey): google.protobuf.IAny;
export declare function decodePubkey(pubkey?: google.protobuf.IAny | null): PubKey | null;

View File

@ -37,5 +37,5 @@ export declare class Registry {
encode({ typeUrl, value }: EncodeObject): Uint8Array;
encodeTxBody(txBodyFields: TxBodyValue): Uint8Array;
decode({ typeUrl, value }: DecodeObject): any;
decodeTxBody(txBody: Uint8Array): cosmos.tx.TxBody;
decodeTxBody(txBody: Uint8Array): cosmos.tx.v1beta1.TxBody;
}

View File

@ -1,15 +1,16 @@
import { cosmos } from "./codec";
import { cosmos, google } from "./codec";
/**
* Creates and serializes an AuthInfo document using SIGN_MODE_DIRECT.
*/
export declare function makeAuthInfo(
pubkeys: readonly cosmos.crypto.IPublicKey[],
pubkeys: readonly google.protobuf.IAny[],
feeAmount: cosmos.base.v1beta1.Coin[],
gasLimit: number,
sequence: number,
): Uint8Array;
export declare function makeSignBytes(
txBody: Uint8Array,
authInfo: Uint8Array,
chainId: string,
accountNumber: number,
sequence: number,
): Uint8Array;

View File

@ -39,7 +39,7 @@
"coverage": "nyc --reporter=text --reporter=lcov yarn test --quiet",
"pack-web": "yarn build-or-skip && webpack --mode development --config webpack.web.config.js",
"preget-proto": "rm -rf proto",
"get-proto": "REF=20c80cfd44a068a592148d648c50de3459fd6295 ./scripts/get-proto.sh",
"get-proto": "REF=v0.40.0-rc0 ./scripts/get-proto.sh",
"predefine-proto": "./scripts/predefine-proto.sh",
"define-proto": "./scripts/define-proto.sh",
"postdefine-proto": "prettier --write \"src/codec/generated/codecimpl.*\""

View File

@ -9,7 +9,7 @@ ZIP_FILE="$COSMOS_DIR/tmp.zip"
REF=${REF:-"master"}
SUFFIX=${REF}
[[ $SUFFIX =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]] && SUFFIX=${SUFFIX#v}
[[ $SUFFIX =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-.+)?$ ]] && SUFFIX=${SUFFIX#v}
mkdir -p "$COSMOS_DIR"

View File

@ -7,34 +7,35 @@ ROOT_PROTO_DIR="./proto/cosmos/cosmos-sdk"
COSMOS_PROTO_DIR="$ROOT_PROTO_DIR/proto/cosmos"
IBC_PROTO_DIR="$ROOT_PROTO_DIR/proto/ibc"
TENDERMINT_PROTO_DIR="$ROOT_PROTO_DIR/third_party/proto/tendermint"
GOOGLE_PROTO_DIR="$ROOT_PROTO_DIR/third_party/proto/google"
mkdir -p "$GENERATED_DIR"
# Can't use --sparse for some reason. Seems related to https://github.com/protobufjs/protobuf.js/issues/1165
yarn pbjs \
-t static-module \
--es6 \
-w commonjs \
-o "$GENERATED_DIR/codecimpl.js" \
--sparse \
--no-beautify \
--no-delimited \
--no-verify \
--no-convert \
--force-long \
"$COSMOS_PROTO_DIR/cosmos.proto" \
"$COSMOS_PROTO_DIR/auth/{auth,query}.proto" \
"$COSMOS_PROTO_DIR/bank/{bank,query}.proto" \
"$COSMOS_PROTO_DIR/crypto/crypto.proto" \
"$COSMOS_PROTO_DIR/query/pagination.proto" \
"$COSMOS_PROTO_DIR/tx/tx.proto" \
"$COSMOS_PROTO_DIR/tx/signing/signing.proto" \
"$IBC_PROTO_DIR/channel/{channel,query}.proto" \
"$IBC_PROTO_DIR/commitment/commitment.proto" \
"$IBC_PROTO_DIR/connection/{connection,query}.proto" \
"$TENDERMINT_PROTO_DIR/abci/types/types.proto" \
"$TENDERMINT_PROTO_DIR/crypto/merkle/merkle.proto" \
"$TENDERMINT_PROTO_DIR/libs/kv/types.proto" \
"$GOOGLE_PROTO_DIR/protobuf/any.proto"
"$COSMOS_PROTO_DIR/auth/v1beta1/auth.proto" \
"$COSMOS_PROTO_DIR/auth/v1beta1/query.proto" \
"$COSMOS_PROTO_DIR/bank/v1beta1/query.proto" \
"$COSMOS_PROTO_DIR/base/query/v1beta1/pagination.proto" \
"$COSMOS_PROTO_DIR/base/v1beta1/coin.proto" \
"$COSMOS_PROTO_DIR/crypto/multisig/v1beta1/multisig.proto" \
"$COSMOS_PROTO_DIR/crypto/secp256k1/keys.proto" \
"$COSMOS_PROTO_DIR/tx/signing/v1beta1/signing.proto" \
"$COSMOS_PROTO_DIR/tx/v1beta1/tx.proto" \
"$IBC_PROTO_DIR/core/channel/v1/channel.proto" \
"$IBC_PROTO_DIR/core/channel/v1/query.proto" \
"$IBC_PROTO_DIR/core/client/v1/client.proto" \
"$IBC_PROTO_DIR/core/commitment/v1/commitment.proto" \
"$IBC_PROTO_DIR/core/connection/v1/connection.proto" \
"$IBC_PROTO_DIR/core/connection/v1/query.proto" \
"$TENDERMINT_PROTO_DIR/crypto/proof.proto"
# Work around https://github.com/protobufjs/protobuf.js/issues/1477
# shellcheck disable=SC2016

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,12 +1,15 @@
import { encodeAminoPubkey } from "@cosmjs/launchpad";
/* eslint-disable @typescript-eslint/naming-convention */
import { encodePubkey } from "@cosmjs/proto-signing";
import { Client as TendermintClient } from "@cosmjs/tendermint-rpc";
import { assert } from "@cosmjs/utils";
import Long from "long";
import { google } from "../codec";
import { nonExistentAddress, pendingWithoutSimapp, simapp, unused, validator } from "../testutils.spec";
import { AuthExtension, setupAuthExtension } from "./auth";
import { QueryClient } from "./queryclient";
import { toAccAddress } from "./utils";
const { Any } = google.protobuf;
async function makeClientWithAuth(rpcUrl: string): Promise<[QueryClient & AuthExtension, TendermintClient]> {
const tmClient = await TendermintClient.connect(rpcUrl);
@ -18,12 +21,11 @@ describe("AuthExtension", () => {
it("works for unused account", async () => {
pendingWithoutSimapp();
const [client, tmClient] = await makeClientWithAuth(simapp.tendermintUrl);
const account = await client.auth.account(unused.address);
assert(account);
expect(account).toEqual({
address: toAccAddress(unused.address),
address: unused.address,
// pubKey not set
accountNumber: Long.fromNumber(unused.accountNumber, true),
// sequence not set
@ -35,12 +37,13 @@ describe("AuthExtension", () => {
it("works for account with pubkey and non-zero sequence", async () => {
pendingWithoutSimapp();
const [client, tmClient] = await makeClientWithAuth(simapp.tendermintUrl);
const account = await client.auth.account(validator.address);
assert(account);
const pubkey = encodePubkey(validator.pubkey);
expect(account).toEqual({
address: toAccAddress(validator.address),
pubKey: encodeAminoPubkey(validator.pubkey),
address: validator.address,
pubKey: Any.create(pubkey),
// accountNumber not set
sequence: Long.fromNumber(validator.sequence, true),
});
@ -51,8 +54,8 @@ describe("AuthExtension", () => {
it("returns null for non-existent address", async () => {
pendingWithoutSimapp();
const [client, tmClient] = await makeClientWithAuth(simapp.tendermintUrl);
const account = await client.auth.account(nonExistentAddress);
expect(account).toBeNull();
tmClient.disconnect();
@ -64,11 +67,11 @@ describe("AuthExtension", () => {
it("works for unused account", async () => {
pendingWithoutSimapp();
const [client, tmClient] = await makeClientWithAuth(simapp.tendermintUrl);
const account = await client.auth.unverified.account(unused.address);
assert(account);
expect(account).toEqual({
address: toAccAddress(unused.address),
address: unused.address,
// pubKey not set
accountNumber: Long.fromNumber(unused.accountNumber, true),
// sequence not set
@ -80,12 +83,13 @@ describe("AuthExtension", () => {
it("works for account with pubkey and non-zero sequence", async () => {
pendingWithoutSimapp();
const [client, tmClient] = await makeClientWithAuth(simapp.tendermintUrl);
const account = await client.auth.unverified.account(validator.address);
assert(account);
const pubkey = encodePubkey(validator.pubkey);
expect(account).toEqual({
address: toAccAddress(validator.address),
pubKey: encodeAminoPubkey(validator.pubkey),
address: validator.address,
pubKey: Any.create(pubkey),
// accountNumber not set
sequence: Long.fromNumber(validator.sequence, true),
});

View File

@ -1,14 +1,17 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { assert } from "@cosmjs/utils";
import { cosmos, google } from "../codec";
import { QueryClient } from "./queryclient";
import { toAccAddress, toObject } from "./utils";
const { BaseAccount, Query } = cosmos.auth.v1beta1;
export interface AuthExtension {
readonly auth: {
readonly account: (address: string) => Promise<cosmos.auth.IBaseAccount | null>;
readonly account: (address: string) => Promise<cosmos.auth.v1beta1.IBaseAccount | null>;
readonly unverified: {
readonly account: (address: string) => Promise<cosmos.auth.IBaseAccount | null>;
readonly account: (address: string) => Promise<cosmos.auth.v1beta1.IBaseAccount | null>;
};
};
}
@ -16,9 +19,9 @@ export interface AuthExtension {
export function setupAuthExtension(base: QueryClient): AuthExtension {
// Use this service to get easy typed access to query methods
// This cannot be used to for proof verification
const queryService = cosmos.auth.Query.create((method: any, requestData, callback) => {
const queryService = Query.create((method: any, requestData, callback) => {
// Parts of the path are unavailable, so we hardcode them here. See https://github.com/protobufjs/protobuf.js/issues/1229
const path = `/cosmos.auth.Query/${method.name}`;
const path = `/cosmos.auth.v1beta1.Query/${method.name}`;
base
.queryUnverified(path, requestData)
.then((response) => callback(null, response))
@ -34,8 +37,8 @@ export function setupAuthExtension(base: QueryClient): AuthExtension {
if (responseData.length === 0) return null;
const account = google.protobuf.Any.decode(responseData);
switch (account.type_url) {
case "/cosmos.auth.BaseAccount": {
return toObject(cosmos.auth.BaseAccount.decode(account.value));
case "/cosmos.auth.v1beta1.BaseAccount": {
return toObject(BaseAccount.decode(account.value));
}
default:
throw new Error(`Unsupported type: '${account.type_url}'`);
@ -43,12 +46,12 @@ export function setupAuthExtension(base: QueryClient): AuthExtension {
},
unverified: {
account: async (address: string) => {
const { account } = await queryService.account({ address: toAccAddress(address) });
const { account } = await queryService.account({ address: address });
if (!account) return null;
switch (account.type_url) {
case "/cosmos.auth.BaseAccount": {
case "/cosmos.auth.v1beta1.BaseAccount": {
assert(account.value);
return toObject(cosmos.auth.BaseAccount.decode(account.value));
return toObject(BaseAccount.decode(account.value));
}
default:
throw new Error(`Unsupported type: '${account.type_url}'`);

View File

@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { toAscii } from "@cosmjs/encoding";
import { assert } from "@cosmjs/utils";
@ -5,14 +6,17 @@ import { cosmos } from "../codec";
import { QueryClient } from "./queryclient";
import { toAccAddress, toObject } from "./utils";
const { Coin } = cosmos.base.v1beta1;
const { Query } = cosmos.bank.v1beta1;
export interface BankExtension {
readonly bank: {
readonly balance: (address: string, denom: string) => Promise<cosmos.ICoin | null>;
readonly balance: (address: string, denom: string) => Promise<cosmos.base.v1beta1.ICoin | null>;
readonly unverified: {
readonly balance: (address: string, denom: string) => Promise<cosmos.ICoin>;
readonly allBalances: (address: string) => Promise<cosmos.ICoin[]>;
readonly totalSupply: () => Promise<cosmos.ICoin[]>;
readonly supplyOf: (denom: string) => Promise<cosmos.ICoin>;
readonly balance: (address: string, denom: string) => Promise<cosmos.base.v1beta1.ICoin>;
readonly allBalances: (address: string) => Promise<cosmos.base.v1beta1.ICoin[]>;
readonly totalSupply: () => Promise<cosmos.base.v1beta1.ICoin[]>;
readonly supplyOf: (denom: string) => Promise<cosmos.base.v1beta1.ICoin>;
};
};
}
@ -20,9 +24,9 @@ export interface BankExtension {
export function setupBankExtension(base: QueryClient): BankExtension {
// Use this service to get easy typed access to query methods
// This cannot be used to for proof verification
const queryService = cosmos.bank.Query.create((method: any, requestData, callback) => {
const queryService = Query.create((method: any, requestData, callback) => {
// Parts of the path are unavailable, so we hardcode them here. See https://github.com/protobufjs/protobuf.js/issues/1229
const path = `/cosmos.bank.Query/${method.name}`;
const path = `/cosmos.bank.v1beta1.Query/${method.name}`;
base
.queryUnverified(path, requestData)
.then((response) => callback(null, response))
@ -40,16 +44,16 @@ export function setupBankExtension(base: QueryClient): BankExtension {
// https://github.com/cosmos/cosmos-sdk/blob/2879c0702c87dc9dd828a8c42b9224dc054e28ad/store/prefix/store.go#L37-L43
const key = Uint8Array.from([...toAscii("balances"), ...toAccAddress(address), ...toAscii(denom)]);
const responseData = await base.queryVerified("bank", key);
return responseData.length ? toObject(cosmos.Coin.decode(responseData)) : null;
return responseData.length ? toObject(Coin.decode(responseData)) : null;
},
unverified: {
balance: async (address: string, denom: string) => {
const { balance } = await queryService.balance({ address: toAccAddress(address), denom: denom });
const { balance } = await queryService.balance({ address: address, denom: denom });
assert(balance);
return toObject(balance);
},
allBalances: async (address: string) => {
const { balances } = await queryService.allBalances({ address: toAccAddress(address) });
const { balances } = await queryService.allBalances({ address: address });
return balances.map(toObject);
},
totalSupply: async () => {

View File

@ -88,13 +88,26 @@ describe("IbcExtension", () => {
});
});
describe("unrelayedPackets", () => {
describe("unreceivedPackets", () => {
it("can be called", async () => {
pending("Fails with 'Query failed with (1): internal'. Make it work.");
pendingWithoutSimapp();
const [client, tmClient] = await makeClientWithIbc(simapp.tendermintUrl);
const response = await client.ibc.unverified.unrelayedPackets("foo", "bar", [0, 1], true);
const response = await client.ibc.unverified.unreceivedPackets("foo", "bar", [0, 1]);
expect(response).toBeTruthy(); // TODO: implement checks
tmClient.disconnect();
});
});
describe("unrelayedAcks", () => {
it("can be called", async () => {
pending("Fails with 'Query failed with (1): internal'. Make it work.");
pendingWithoutSimapp();
const [client, tmClient] = await makeClientWithIbc(simapp.tendermintUrl);
const response = await client.ibc.unverified.unrelayedAcks("foo", "bar", [0, 1]);
expect(response).toBeTruthy(); // TODO: implement checks
tmClient.disconnect();

View File

@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { toAscii } from "@cosmjs/encoding";
import { Uint64 } from "@cosmjs/math";
import Long from "long";
@ -6,9 +7,12 @@ import { ibc } from "../codec";
import { QueryClient } from "./queryclient";
import { toObject } from "./utils";
const { Query: ChannelQuery } = ibc.core.channel.v1;
const { Query: ConnectionQuery } = ibc.core.connection.v1;
export interface IbcExtension {
readonly ibc: {
readonly channel: (portId: string, channelId: string) => Promise<ibc.channel.IChannel | null>;
readonly channel: (portId: string, channelId: string) => Promise<ibc.core.channel.v1.IChannel | null>;
readonly packetCommitment: (portId: string, channelId: string, sequence: number) => Promise<Uint8Array>;
readonly packetAcknowledgement: (
portId: string,
@ -17,44 +21,51 @@ export interface IbcExtension {
) => Promise<Uint8Array>;
readonly nextSequenceReceive: (portId: string, channelId: string) => Promise<number | null>;
readonly unverified: {
// Queries for ibc.channel
readonly channel: (portId: string, channelId: string) => Promise<ibc.channel.IQueryChannelResponse>;
readonly channels: () => Promise<ibc.channel.IQueryChannelsResponse>;
// Queries for ibc.core.channel.v1
readonly channel: (
portId: string,
channelId: string,
) => Promise<ibc.core.channel.v1.IQueryChannelResponse>;
readonly channels: () => Promise<ibc.core.channel.v1.IQueryChannelsResponse>;
readonly connectionChannels: (
connection: string,
) => Promise<ibc.channel.IQueryConnectionChannelsResponse>;
) => Promise<ibc.core.channel.v1.IQueryConnectionChannelsResponse>;
readonly packetCommitment: (
portId: string,
channelId: string,
sequence: number,
) => Promise<ibc.channel.IQueryPacketCommitmentResponse>;
) => Promise<ibc.core.channel.v1.IQueryPacketCommitmentResponse>;
readonly packetCommitments: (
portId: string,
channelId: string,
) => Promise<ibc.channel.IQueryPacketCommitmentsResponse>;
) => Promise<ibc.core.channel.v1.IQueryPacketCommitmentsResponse>;
readonly packetAcknowledgement: (
portId: string,
channelId: string,
sequence: number,
) => Promise<ibc.channel.IQueryPacketAcknowledgementResponse>;
readonly unrelayedPackets: (
) => Promise<ibc.core.channel.v1.IQueryPacketAcknowledgementResponse>;
readonly unreceivedPackets: (
portId: string,
channelId: string,
packetCommitmentSequences: readonly number[],
acknowledgements: boolean,
) => Promise<ibc.channel.IQueryUnrelayedPacketsResponse>;
) => Promise<ibc.core.channel.v1.IQueryUnreceivedPacketsResponse>;
readonly unrelayedAcks: (
portId: string,
channelId: string,
packetCommitmentSequences: readonly number[],
) => Promise<ibc.core.channel.v1.IQueryUnrelayedAcksResponse>;
readonly nextSequenceReceive: (
portId: string,
channelId: string,
) => Promise<ibc.channel.IQueryNextSequenceReceiveResponse>;
) => Promise<ibc.core.channel.v1.IQueryNextSequenceReceiveResponse>;
// Queries for ibc.connection
// Queries for ibc.core.connection.v1
readonly connection: (connectionId: string) => Promise<ibc.connection.IQueryConnectionResponse>;
readonly connections: () => Promise<ibc.connection.IQueryConnectionsResponse>;
readonly connection: (connectionId: string) => Promise<ibc.core.connection.v1.IQueryConnectionResponse>;
readonly connections: () => Promise<ibc.core.connection.v1.IQueryConnectionsResponse>;
readonly clientConnections: (
clientId: string,
) => Promise<ibc.connection.IQueryClientConnectionsResponse>;
) => Promise<ibc.core.connection.v1.IQueryClientConnectionsResponse>;
};
};
}
@ -63,18 +74,18 @@ export function setupIbcExtension(base: QueryClient): IbcExtension {
// Use this service to get easy typed access to query methods
// This cannot be used to for proof verification
const channelQuerySerice = ibc.channel.Query.create((method: any, requestData, callback) => {
const channelQuerySerice = ChannelQuery.create((method: any, requestData, callback) => {
// Parts of the path are unavailable, so we hardcode them here. See https://github.com/protobufjs/protobuf.js/issues/1229
const path = `/ibc.channel.Query/${method.name}`;
const path = `/ibc.core.channel.v1.Query/${method.name}`;
base
.queryUnverified(path, requestData)
.then((response) => callback(null, response))
.catch((error) => callback(error));
});
const connectionQuerySerice = ibc.connection.Query.create((method: any, requestData, callback) => {
const connectionQuerySerice = ConnectionQuery.create((method: any, requestData, callback) => {
// Parts of the path are unavailable, so we hardcode them here. See https://github.com/protobufjs/protobuf.js/issues/1229
const path = `/ibc.connection.Query/${method.name}`;
const path = `/ibc.core.connection.v1.Query/${method.name}`;
base
.queryUnverified(path, requestData)
.then((response) => callback(null, response))
@ -88,7 +99,7 @@ export function setupIbcExtension(base: QueryClient): IbcExtension {
// 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 responseData = await base.queryVerified("ibc", key);
return responseData.length ? toObject(ibc.channel.Channel.decode(responseData)) : null;
return responseData.length ? toObject(ibc.core.channel.v1.Channel.decode(responseData)) : 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
@ -115,7 +126,7 @@ export function setupIbcExtension(base: QueryClient): IbcExtension {
},
unverified: {
// Queries for ibc.channel
// Queries for ibc.core.channel.v1
channel: async (portId: string, channelId: string) => {
const response = await channelQuerySerice.channel({ portId: portId, channelId: channelId });
return toObject(response);
@ -151,17 +162,27 @@ export function setupIbcExtension(base: QueryClient): IbcExtension {
});
return toObject(response);
},
unrelayedPackets: async (
unreceivedPackets: async (
portId: string,
channelId: string,
packetCommitmentSequences: readonly number[],
acknowledgements: boolean,
) => {
const response = await channelQuerySerice.unrelayedPackets({
const response = await channelQuerySerice.unreceivedPackets({
portId: portId,
channelId: channelId,
packetCommitmentSequences: packetCommitmentSequences.map((s) => Long.fromNumber(s)),
});
return toObject(response);
},
unrelayedAcks: async (
portId: string,
channelId: string,
packetCommitmentSequences: readonly number[],
) => {
const response = await channelQuerySerice.unrelayedAcks({
portId: portId,
channelId: channelId,
packetCommitmentSequences: packetCommitmentSequences.map((s) => Long.fromNumber(s)),
acknowledgements: acknowledgements,
});
return toObject(response);
},
@ -173,7 +194,7 @@ export function setupIbcExtension(base: QueryClient): IbcExtension {
return toObject(response);
},
// Queries for ibc.connection
// Queries for ibc.core.connection.v1
connection: async (connectionId: string) => {
const response = await connectionQuerySerice.connection({ connectionId: connectionId });

View File

@ -1,3 +1,4 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { toAscii } from "@cosmjs/encoding";
import { Client as TendermintClient } from "@cosmjs/tendermint-rpc";
@ -6,6 +7,9 @@ import { nonNegativeIntegerMatcher, pendingWithoutSimapp, simapp, unused } from
import { QueryClient } from "./queryclient";
import { toAccAddress } from "./utils";
const { Coin } = cosmos.base.v1beta1;
const { QueryAllBalancesRequest, QueryAllBalancesResponse } = cosmos.bank.v1beta1;
async function makeClient(rpcUrl: string): Promise<[QueryClient, TendermintClient]> {
const tmClient = await TendermintClient.connect(rpcUrl);
return [QueryClient.withExtensions(tmClient), tmClient];
@ -23,7 +27,7 @@ describe("QueryClient", () => {
...toAscii(simapp.denomFee),
]);
const data = await client.queryVerified("bank", key);
const response = cosmos.Coin.decode(data);
const response = Coin.decode(data);
expect(response.amount).toMatch(nonNegativeIntegerMatcher);
expect(response.denom).toEqual(simapp.denomFee);
@ -40,7 +44,7 @@ describe("QueryClient", () => {
...toAscii(simapp.denomFee),
]);
const data = await client.queryVerified("bank", key);
const response = cosmos.Coin.decode(data);
const response = Coin.decode(data);
expect(response.amount).toMatch(nonNegativeIntegerMatcher);
expect(response.denom).toEqual(simapp.denomFee);
@ -54,10 +58,10 @@ describe("QueryClient", () => {
const [client, tmClient] = await makeClient(simapp.tendermintUrlWs);
const requestData = Uint8Array.from(
cosmos.bank.QueryAllBalancesRequest.encode({ address: toAccAddress(unused.address) }).finish(),
QueryAllBalancesRequest.encode({ address: unused.address }).finish(),
);
const data = await client.queryUnverified(`/cosmos.bank.Query/AllBalances`, requestData);
const response = cosmos.bank.QueryAllBalancesResponse.decode(data);
const data = await client.queryUnverified(`/cosmos.bank.v1beta1.Query/AllBalances`, requestData);
const response = QueryAllBalancesResponse.decode(data);
expect(response.balances.length).toEqual(2);
tmClient.disconnect();
@ -68,10 +72,10 @@ describe("QueryClient", () => {
const [client, tmClient] = await makeClient(simapp.tendermintUrlHttp);
const requestData = Uint8Array.from(
cosmos.bank.QueryAllBalancesRequest.encode({ address: toAccAddress(unused.address) }).finish(),
QueryAllBalancesRequest.encode({ address: unused.address }).finish(),
);
const data = await client.queryUnverified(`/cosmos.bank.Query/AllBalances`, requestData);
const response = cosmos.bank.QueryAllBalancesResponse.decode(data);
const data = await client.queryUnverified(`/cosmos.bank.v1beta1.Query/AllBalances`, requestData);
const response = QueryAllBalancesResponse.decode(data);
expect(response.balances.length).toEqual(2);
tmClient.disconnect();

View File

@ -174,36 +174,45 @@ export class QueryClient {
throw new Error(`Response key ${toHex(response.key)} doesn't match query key ${toHex(key)}`);
}
assert(response.proof);
if (response.proof.ops.length !== 2) {
throw new Error(`Expected 2 proof ops, got ${response.proof.ops.length}. Are you using stargate?`);
if (response.proof) {
if (response.proof.ops.length !== 2) {
throw new Error(
`Expected 2 proof ops, got ${response.proof?.ops.length ?? 0}. Are you using stargate?`,
);
}
const subProof = checkAndParseOp(response.proof.ops[0], "ics23:iavl", key);
const storeProof = checkAndParseOp(response.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 (!response.value || response.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, 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);
}
// the storeproof must map it's declared value (root of subProof) to the appHash of the next block
const header = await this.getNextHeader(response.height);
verifyExistence(
storeProof.exist,
tendermintSpec,
header.appHash,
toAscii(store),
storeProof.exist.value,
);
}
const subProof = checkAndParseOp(response.proof.ops[0], "ics23:iavl", key);
const storeProof = checkAndParseOp(response.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 (!response.value || response.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, 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);
}
// the storeproof must map it's declared value (root of subProof) to the appHash of the next block
const header = await this.getNextHeader(response.height);
verifyExistence(storeProof.exist, tendermintSpec, header.appHash, toAscii(store), storeProof.exist.value);
return response.value;
}

View File

@ -1,7 +1,13 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { Bech32, fromBase64 } from "@cosmjs/encoding";
import { fromBase64, toBase64 } from "@cosmjs/encoding";
import { Coin, coins } from "@cosmjs/launchpad";
import { DirectSecp256k1Wallet, makeAuthInfo, makeSignBytes, Registry } from "@cosmjs/proto-signing";
import {
DirectSecp256k1Wallet,
encodePubkey,
makeAuthInfo,
makeSignBytes,
Registry,
} from "@cosmjs/proto-signing";
import { assert, sleep } from "@cosmjs/utils";
import { cosmos } from "./codec";
@ -13,8 +19,7 @@ import {
} from "./stargateclient";
import { faucet, makeRandomAddress, pendingWithoutSimapp, simapp, simappEnabled } from "./testutils.spec";
const { AuthInfo, Tx, TxBody } = cosmos.tx;
const { PublicKey } = cosmos.crypto;
const { TxRaw } = cosmos.tx.v1beta1;
interface TestTxSend {
readonly sender: string;
@ -36,16 +41,19 @@ async function sendTokens(
readonly tx: Uint8Array;
}> {
const [{ address: walletAddress, pubkey: pubkeyBytes }] = await wallet.getAccounts();
const publicKey = PublicKey.create({ secp256k1: pubkeyBytes });
const pubkey = encodePubkey({
type: "tendermint/PubKeySecp256k1",
value: toBase64(pubkeyBytes),
});
const txBodyFields = {
typeUrl: "/cosmos.tx.TxBody",
typeUrl: "/cosmos.tx.v1beta1.TxBody",
value: {
messages: [
{
typeUrl: "/cosmos.bank.MsgSend",
typeUrl: "/cosmos.bank.v1beta1.MsgSend",
value: {
fromAddress: Bech32.decode(walletAddress).data,
toAddress: Bech32.decode(recipient).data,
fromAddress: walletAddress,
toAddress: recipient,
amount: amount,
},
},
@ -54,20 +62,25 @@ async function sendTokens(
},
};
const txBodyBytes = registry.encode(txBodyFields);
const txBody = TxBody.decode(txBodyBytes);
const authInfoBytes = makeAuthInfo([publicKey], 200000);
const { accountNumber, sequence } = (await client.getSequence(walletAddress))!;
const feeAmount = [
{
amount: "2000",
denom: "ucosm",
},
];
const gasLimit = 200000;
const authInfoBytes = makeAuthInfo([pubkey], feeAmount, gasLimit, sequence);
const chainId = await client.getChainId();
const signDocBytes = makeSignBytes(txBodyBytes, authInfoBytes, chainId, accountNumber, sequence);
const signDocBytes = makeSignBytes(txBodyBytes, authInfoBytes, chainId, accountNumber);
const signature = await wallet.sign(walletAddress, signDocBytes);
// TODO: Why is this not a TxRaw? https://github.com/CosmWasm/cosmjs/issues/383
const txRaw = Tx.create({
body: txBody,
authInfo: AuthInfo.decode(authInfoBytes),
const txRaw = TxRaw.create({
bodyBytes: txBodyBytes,
authInfoBytes: authInfoBytes,
signatures: [fromBase64(signature.signature)],
});
const txRawBytes = Uint8Array.from(Tx.encode(txRaw).finish());
const txRawBytes = Uint8Array.from(TxRaw.encode(txRaw).finish());
const broadcastResponse = await client.broadcastTx(txRawBytes);
return {
broadcastResponse: broadcastResponse,

View File

@ -1,6 +1,12 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { Bech32, fromBase64 } from "@cosmjs/encoding";
import { DirectSecp256k1Wallet, makeAuthInfo, makeSignBytes, Registry } from "@cosmjs/proto-signing";
import { fromBase64, toBase64 } from "@cosmjs/encoding";
import {
DirectSecp256k1Wallet,
encodePubkey,
makeAuthInfo,
makeSignBytes,
Registry,
} from "@cosmjs/proto-signing";
import { assert, sleep } from "@cosmjs/utils";
import { ReadonlyDate } from "readonly-date";
@ -8,7 +14,7 @@ import { cosmos } from "./codec";
import { assertIsBroadcastTxSuccess, PrivateStargateClient, StargateClient } from "./stargateclient";
import {
faucet,
makeRandomAddressBytes,
makeRandomAddress,
nonExistentAddress,
pendingWithoutSimapp,
simapp,
@ -17,8 +23,7 @@ import {
validator,
} from "./testutils.spec";
const { AuthInfo, Tx, TxBody } = cosmos.tx;
const { PublicKey } = cosmos.crypto;
const { TxRaw } = cosmos.tx.v1beta1;
describe("StargateClient", () => {
describe("connect", () => {
@ -253,17 +258,20 @@ describe("StargateClient", () => {
const client = await StargateClient.connect(simapp.tendermintUrl);
const wallet = await DirectSecp256k1Wallet.fromMnemonic(faucet.mnemonic);
const [{ address, pubkey: pubkeyBytes }] = await wallet.getAccounts();
const publicKey = PublicKey.create({ secp256k1: pubkeyBytes });
const pubkey = encodePubkey({
type: "tendermint/PubKeySecp256k1",
value: toBase64(pubkeyBytes),
});
const registry = new Registry();
const txBodyFields = {
typeUrl: "/cosmos.tx.TxBody",
typeUrl: "/cosmos.tx.v1beta1.TxBody",
value: {
messages: [
{
typeUrl: "/cosmos.bank.MsgSend",
typeUrl: "/cosmos.bank.v1beta1.MsgSend",
value: {
fromAddress: Bech32.decode(address).data,
toAddress: makeRandomAddressBytes(),
fromAddress: address,
toAddress: makeRandomAddress(),
amount: [
{
denom: "ucosm",
@ -276,20 +284,25 @@ describe("StargateClient", () => {
},
};
const txBodyBytes = registry.encode(txBodyFields);
const txBody = TxBody.decode(txBodyBytes);
const authInfoBytes = makeAuthInfo([publicKey], 200000);
const { accountNumber, sequence } = (await client.getSequence(address))!;
const feeAmount = [
{
amount: "2000",
denom: "ucosm",
},
];
const gasLimit = 200000;
const authInfoBytes = makeAuthInfo([pubkey], feeAmount, gasLimit, sequence);
const chainId = await client.getChainId();
const { accountNumber, sequence } = (await client.getSequence(address))!;
const signDocBytes = makeSignBytes(txBodyBytes, authInfoBytes, chainId, accountNumber, sequence);
const signDocBytes = makeSignBytes(txBodyBytes, authInfoBytes, chainId, accountNumber);
const signature = await wallet.sign(address, signDocBytes);
// TODO: Why is this not a TxRaw? https://github.com/CosmWasm/cosmjs/issues/383
const txRaw = Tx.create({
body: txBody,
authInfo: AuthInfo.decode(authInfoBytes),
const txRaw = TxRaw.create({
bodyBytes: txBodyBytes,
authInfoBytes: authInfoBytes,
signatures: [fromBase64(signature.signature)],
});
const txRawBytes = Uint8Array.from(Tx.encode(txRaw).finish());
const txRawBytes = Uint8Array.from(TxRaw.encode(txRaw).finish());
const txResult = await client.broadcastTx(txRawBytes);
assertIsBroadcastTxSuccess(txResult);

View File

@ -1,9 +1,8 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { Bech32, toHex } from "@cosmjs/encoding";
import { toHex } from "@cosmjs/encoding";
import {
Block,
Coin,
decodeAminoPubkey,
isSearchByHeightQuery,
isSearchByIdQuery,
PubKey,
@ -11,6 +10,7 @@ import {
SearchTxQuery,
} from "@cosmjs/launchpad";
import { Uint53, Uint64 } from "@cosmjs/math";
import { decodePubkey } from "@cosmjs/proto-signing";
import { broadcastTxCommitSuccess, Client as TendermintClient, QueryString } from "@cosmjs/tendermint-rpc";
import { assert, assertDefined } from "@cosmjs/utils";
import Long from "long";
@ -85,20 +85,19 @@ function uint64FromProto(input: number | Long | null | undefined): Uint64 {
return Uint64.fromString(input.toString());
}
function accountFromProto(input: cosmos.auth.IBaseAccount, prefix: string): Account {
function accountFromProto(input: cosmos.auth.v1beta1.IBaseAccount): Account {
const { address, pubKey, accountNumber, sequence } = input;
// Pubkey is still Amino-encoded in BaseAccount (https://github.com/cosmos/cosmos-sdk/issues/6886)
const pubkey = pubKey && pubKey.length ? decodeAminoPubkey(pubKey) : null;
const pubkey = decodePubkey(pubKey);
assert(address);
return {
address: Bech32.encode(prefix, address),
address: address,
pubkey: pubkey,
accountNumber: uint64FromProto(accountNumber).toNumber(),
sequence: uint64FromProto(sequence).toNumber(),
};
}
function coinFromProto(input: cosmos.ICoin): Coin {
function coinFromProto(input: cosmos.base.v1beta1.ICoin): Coin {
assertDefined(input.amount);
assertDefined(input.denom);
assert(input.amount !== null);
@ -146,10 +145,8 @@ export class StargateClient {
}
public async getAccount(searchAddress: string): Promise<Account | null> {
const { prefix } = Bech32.decode(searchAddress);
const account = await this.queryClient.auth.account(searchAddress);
return account ? accountFromProto(account, prefix) : null;
return account ? accountFromProto(account) : null;
}
public async getSequence(address: string): Promise<SequenceResponse | null> {

View File

@ -56,10 +56,10 @@ export const validator = {
/** From first gentx's auth_info.signer_infos in scripts/simapp/template/.simapp/config/genesis.json */
pubkey: {
type: "tendermint/PubKeySecp256k1",
value: "AnFadRAdh6Fl7robHe8jywDMKSWQQjB7SlpoqGsX9Ghw",
value: "A/Ltk7FONB0PJOKrLECIxJe5LcJMy9DcWG6X2WVA2xAi",
},
/** delegator_address from /cosmos.staking.MsgCreateValidator in scripts/simapp/template/.simapp/config/genesis.json */
address: "cosmos12gm9sa666hywxu9nzzmp7hyl7a55hvg769w2kz",
/** delegator_address from /cosmos.staking.v1beta1.MsgCreateValidator in scripts/simapp/template/.simapp/config/genesis.json */
address: "cosmos1gyavpqh80z2v7tcgeycfvf0st2nvjrfcp05dad",
accountNumber: 0,
sequence: 1,
};

File diff suppressed because it is too large Load Diff

View File

@ -2,9 +2,9 @@ import { cosmos } from "../codec";
import { QueryClient } from "./queryclient";
export interface AuthExtension {
readonly auth: {
readonly account: (address: string) => Promise<cosmos.auth.IBaseAccount | null>;
readonly account: (address: string) => Promise<cosmos.auth.v1beta1.IBaseAccount | null>;
readonly unverified: {
readonly account: (address: string) => Promise<cosmos.auth.IBaseAccount | null>;
readonly account: (address: string) => Promise<cosmos.auth.v1beta1.IBaseAccount | null>;
};
};
}

View File

@ -2,12 +2,12 @@ import { cosmos } from "../codec";
import { QueryClient } from "./queryclient";
export interface BankExtension {
readonly bank: {
readonly balance: (address: string, denom: string) => Promise<cosmos.ICoin | null>;
readonly balance: (address: string, denom: string) => Promise<cosmos.base.v1beta1.ICoin | null>;
readonly unverified: {
readonly balance: (address: string, denom: string) => Promise<cosmos.ICoin>;
readonly allBalances: (address: string) => Promise<cosmos.ICoin[]>;
readonly totalSupply: () => Promise<cosmos.ICoin[]>;
readonly supplyOf: (denom: string) => Promise<cosmos.ICoin>;
readonly balance: (address: string, denom: string) => Promise<cosmos.base.v1beta1.ICoin>;
readonly allBalances: (address: string) => Promise<cosmos.base.v1beta1.ICoin[]>;
readonly totalSupply: () => Promise<cosmos.base.v1beta1.ICoin[]>;
readonly supplyOf: (denom: string) => Promise<cosmos.base.v1beta1.ICoin>;
};
};
}

View File

@ -2,7 +2,7 @@ import { ibc } from "../codec";
import { QueryClient } from "./queryclient";
export interface IbcExtension {
readonly ibc: {
readonly channel: (portId: string, channelId: string) => Promise<ibc.channel.IChannel | null>;
readonly channel: (portId: string, channelId: string) => Promise<ibc.core.channel.v1.IChannel | null>;
readonly packetCommitment: (portId: string, channelId: string, sequence: number) => Promise<Uint8Array>;
readonly packetAcknowledgement: (
portId: string,
@ -11,40 +11,47 @@ export interface IbcExtension {
) => Promise<Uint8Array>;
readonly nextSequenceReceive: (portId: string, channelId: string) => Promise<number | null>;
readonly unverified: {
readonly channel: (portId: string, channelId: string) => Promise<ibc.channel.IQueryChannelResponse>;
readonly channels: () => Promise<ibc.channel.IQueryChannelsResponse>;
readonly channel: (
portId: string,
channelId: string,
) => Promise<ibc.core.channel.v1.IQueryChannelResponse>;
readonly channels: () => Promise<ibc.core.channel.v1.IQueryChannelsResponse>;
readonly connectionChannels: (
connection: string,
) => Promise<ibc.channel.IQueryConnectionChannelsResponse>;
) => Promise<ibc.core.channel.v1.IQueryConnectionChannelsResponse>;
readonly packetCommitment: (
portId: string,
channelId: string,
sequence: number,
) => Promise<ibc.channel.IQueryPacketCommitmentResponse>;
) => Promise<ibc.core.channel.v1.IQueryPacketCommitmentResponse>;
readonly packetCommitments: (
portId: string,
channelId: string,
) => Promise<ibc.channel.IQueryPacketCommitmentsResponse>;
) => Promise<ibc.core.channel.v1.IQueryPacketCommitmentsResponse>;
readonly packetAcknowledgement: (
portId: string,
channelId: string,
sequence: number,
) => Promise<ibc.channel.IQueryPacketAcknowledgementResponse>;
readonly unrelayedPackets: (
) => Promise<ibc.core.channel.v1.IQueryPacketAcknowledgementResponse>;
readonly unreceivedPackets: (
portId: string,
channelId: string,
packetCommitmentSequences: readonly number[],
acknowledgements: boolean,
) => Promise<ibc.channel.IQueryUnrelayedPacketsResponse>;
) => Promise<ibc.core.channel.v1.IQueryUnreceivedPacketsResponse>;
readonly unrelayedAcks: (
portId: string,
channelId: string,
packetCommitmentSequences: readonly number[],
) => Promise<ibc.core.channel.v1.IQueryUnrelayedAcksResponse>;
readonly nextSequenceReceive: (
portId: string,
channelId: string,
) => Promise<ibc.channel.IQueryNextSequenceReceiveResponse>;
readonly connection: (connectionId: string) => Promise<ibc.connection.IQueryConnectionResponse>;
readonly connections: () => Promise<ibc.connection.IQueryConnectionsResponse>;
) => Promise<ibc.core.channel.v1.IQueryNextSequenceReceiveResponse>;
readonly connection: (connectionId: string) => Promise<ibc.core.connection.v1.IQueryConnectionResponse>;
readonly connections: () => Promise<ibc.core.connection.v1.IQueryConnectionsResponse>;
readonly clientConnections: (
clientId: string,
) => Promise<ibc.connection.IQueryClientConnectionsResponse>;
) => Promise<ibc.core.connection.v1.IQueryClientConnectionsResponse>;
};
};
}

View File

@ -271,13 +271,13 @@ function decodeBlockId(data: RpcBlockId): responses.BlockId {
interface RpcBlockVersion {
readonly block: IntegerString;
readonly app: IntegerString;
readonly app?: IntegerString;
}
function decodeBlockVersion(data: RpcBlockVersion): responses.Version {
return {
block: Integer.parse(data.block),
app: Integer.parse(data.app),
app: Integer.parse(data.app ?? 0),
};
}

View File

@ -1,4 +1,4 @@
# Choose from https://hub.docker.com/r/interchainio/simapp/tags
REPOSITORY="interchainio/simapp"
VERSION="nightly-2020-08-11"
VERSION="nightly-2020-10-12"
CONTAINER_NAME="simapp"

View File

@ -0,0 +1 @@
eyJhbGciOiJQQkVTMi1IUzI1NitBMTI4S1ciLCJjcmVhdGVkIjoiMjAyMC0xMC0xNCAxMzoyNzoxMS44NDYwOTU0NDMgKzAwMDAgVVRDIG09KzAuMTgyOTA4OTQ1IiwiZW5jIjoiQTI1NkdDTSIsInAyYyI6ODE5MiwicDJzIjoiYU9vdGFTMEhPbU92QWJLcCJ9.NjqqqELGGfi6ALkTw2G9oZU6SQU73aXd85Dy5rHDqz0M6F7ojb4TFA.VE4cs6N6FNHiqNLA.8Lkl-9v_b5KeXnlFH9cw7ySV6QVvoVqstUGOALd0ySJSajFf3ZIbt_ALecY7-HI6svnYKHA63jJEY_MKsL_fNoPueqcP5HgTH-1-UEjmoCKoiTnrAHmkeFA3utkUe2e20m-dNxE2ejzIJnaNFfu5X0UfAtQfrIar_AjtcqqMhVTupc9bB6kMXNMa9b-vNDOfC7JxfBjjDwIi4xWWb8IYut9BBuuMwvg1i2yvpZB4VqQ_d4EE3b0RFmeK.iWFG0QjhcltUz971Ig7A9A

View File

@ -1 +0,0 @@
eyJhbGciOiJQQkVTMi1IUzI1NitBMTI4S1ciLCJjcmVhdGVkIjoiMjAyMC0wOC0xMCAwNDozNDo1My44NTQ3MDIxICswMDAwIFVUQyBtPSswLjI5MDI1MTAwMSIsImVuYyI6IkEyNTZHQ00iLCJwMmMiOjgxOTIsInAycyI6IkhvMjN3ckNGOVpfcHlCUDUifQ.Z5qsfCNObumg_vwCiJ2D9Bvdod0bbanl8KDx9Af85MkSRsxI7mNFww.kzxxnpnP-PwmHl_F.ZSjnQ-fX3PsGxnGaqnVDADzbaQbHOU7xj-EYlImsaJ8w1CijR6UuJCARmeQldWz0xFHi9qfJ08GLfN0E-Zho6nhM_-UKE5D1dyk_vqfvcVusPLte-1z2yuxyrMBHS_E2s1qehmbwjE2m3qohrDsid73Ixgb27La2iTVDL40N9C4iOV3uv0L5YI-TOBT35dhFqpYwavXR6mbE9k-sFyU-J45Y6jpNfIWlhfpVb220RFiKv6FEGVDRrMgt.BgboYLH4EliMSzGWFozUmg

View File

@ -34,9 +34,32 @@ halt-height = 0
# Note: Commitment of state will be attempted on the corresponding block.
halt-time = 0
# MinRetainBlocks defines the minimum block height offset from the current
# block being committed, such that all blocks past this offset are pruned
# from Tendermint. It is used as part of the process of determining the
# ResponseCommit.RetainHeight value during ABCI Commit. A value of 0 indicates
# that no blocks should be pruned.
#
# This configuration value is only responsible for pruning Tendermint blocks.
# It has no bearing on application state pruning which is determined by the
# "pruning-*" configurations.
#
# Note: Tendermint block pruning is dependant on this parameter in conunction
# with the unbonding (safety threshold) period, state pruning and state sync
# snapshot parameters to determine the correct minimum value of
# ResponseCommit.RetainHeight.
min-retain-blocks = 0
# InterBlockCache enables inter-block caching.
inter-block-cache = true
# IndexEvents defines the set of events in the form {eventType}.{attributeKey},
# which informs Tendermint what to index. If empty, all events will be indexed.
#
# Example:
# ["message.sender", "message.recipient"]
index-events = []
###############################################################################
### Telemetry Configuration ###
###############################################################################
@ -112,3 +135,18 @@ enable = true
# Address defines the gRPC server address to bind to.
address = "0.0.0.0:9090"
###############################################################################
### State Sync Configuration ###
###############################################################################
# State sync snapshots allow other nodes to rapidly join the network without replaying historical
# blocks, instead downloading and applying a snapshot of the application state at a given height.
[state-sync]
# snapshot-interval specifies the block interval at which local state sync snapshots are
# taken (0 to disable). Must be a multiple of pruning-keep-every.
snapshot-interval = 0
# snapshot-keep-recent specifies the number of recent snapshots to keep and serve (0 to keep all).
snapshot-keep-recent = 2

View File

@ -6,7 +6,9 @@
# "$HOME/.tendermint" by default, but could be changed via $TMHOME env variable
# or --home cmd flag.
##### main base config options #####
#######################################################################
### Main Base Config Options ###
#######################################################################
# TCP or UNIX socket address of the ABCI application,
# or the name of an ABCI application compiled in with the Tendermint binary
@ -20,7 +22,7 @@ moniker = "simd-moniker"
# and verifying their commits
fast_sync = true
# Database backend: goleveldb | cleveldb | boltdb | rocksdb
# Database backend: goleveldb | cleveldb | boltdb | rocksdb | badgerdb
# * goleveldb (github.com/syndtr/goleveldb - most popular implementation)
# - pure go
# - stable
@ -36,13 +38,16 @@ fast_sync = true
# - EXPERIMENTAL
# - requires gcc
# - use rocksdb build tag (go build -tags rocksdb)
# * badgerdb (uses github.com/dgraph-io/badger)
# - EXPERIMENTAL
# - use badgerdb build tag (go build -tags badgerdb)
db_backend = "goleveldb"
# Database directory
db_dir = "data"
# Output level for logging, including package level options
log_level = "main:info,state:info,*:error"
log_level = "main:info,state:info,statesync:info,*:error"
# Output format: 'plain' (colored text) or 'json'
log_format = "plain"
@ -68,16 +73,18 @@ node_key_file = "config/node_key.json"
# Mechanism to connect to the ABCI application: socket | grpc
abci = "socket"
# TCP or UNIX socket address for the profiling server to listen on
prof_laddr = "localhost:6060"
# If true, query the ABCI app on connecting to a new peer
# so the app can decide if we should keep the connection or not
filter_peers = false
##### advanced configuration options #####
##### rpc server configuration options #####
#######################################################################
### Advanced Configuration Options ###
#######################################################################
#######################################################
### RPC Server Configuration Options ###
#######################################################
[rpc]
# TCP or UNIX socket address for the RPC server to listen on
@ -156,7 +163,12 @@ tls_cert_file = ""
# Otherwise, HTTP server is run.
tls_key_file = ""
##### peer to peer configuration options #####
# pprof listen address (https://golang.org/pkg/net/http/pprof)
pprof_laddr = "localhost:6060"
#######################################################
### P2P Configuration Options ###
#######################################################
[p2p]
# Address to listen for incoming connections
@ -227,7 +239,9 @@ allow_duplicate_ip = false
handshake_timeout = "20s"
dial_timeout = "3s"
##### mempool configuration options #####
#######################################################
### Mempool Configurattion Option ###
#######################################################
[mempool]
recheck = true
@ -246,31 +260,83 @@ max_txs_bytes = 1073741824
cache_size = 10000
# Maximum size of a single transaction.
# NOTE: the max size of a tx transmitted over the network is {max_tx_bytes} + {amino overhead}.
# NOTE: the max size of a tx transmitted over the network is {max_tx_bytes}.
max_tx_bytes = 1048576
##### fast sync configuration options #####
# Maximum size of a batch of transactions to send to a peer
# Including space needed by encoding (one varint per transaction).
max_batch_bytes = 10485760
#######################################################
### State Sync Configuration Options ###
#######################################################
[statesync]
# State sync rapidly bootstraps a new node by discovering, fetching, and restoring a state machine
# snapshot from peers instead of fetching and replaying historical blocks. Requires some peers in
# the network to take and serve state machine snapshots. State sync is not attempted if the node
# has any local state (LastBlockHeight > 0). The node will have a truncated block history,
# starting from the height of the snapshot.
enable = false
# RPC servers (comma-separated) for light client verification of the synced state machine and
# retrieval of state data for node bootstrapping. Also needs a trusted height and corresponding
# header hash obtained from a trusted source, and a period during which validators can be trusted.
#
# For Cosmos SDK-based chains, trust_period should usually be about 2/3 of the unbonding time (~2
# weeks) during which they can be financially punished (slashed) for misbehavior.
rpc_servers = ""
trust_height = 0
trust_hash = ""
trust_period = "168h0m0s"
# Time to spend discovering snapshots before initiating a restore.
discovery_time = "15s"
# Temporary directory for state sync snapshot chunks, defaults to the OS tempdir (typically /tmp).
# Will create a new, randomly named directory within, and remove it when done.
temp_dir = ""
#######################################################
### Fast Sync Configuration Connections ###
#######################################################
[fastsync]
# Fast Sync version to use:
# 1) "v0" (default) - the legacy fast sync implementation
# 2) "v1" - refactor of v0 version for better testability
# 3) "v2" - refactor of v1 version for better usability
# 2) "v2" - complete redesign of v0, optimized for testability & readability
version = "v0"
##### consensus configuration options #####
#######################################################
### Consensus Configuration Options ###
#######################################################
[consensus]
wal_file = "data/cs.wal/wal"
# How long we wait for a proposal block before prevoting nil
timeout_propose = "300ms"
# How much timeout_propose increases with each round
timeout_propose_delta = "100ms"
# How long we wait after receiving +2/3 prevotes for “anything” (ie. not a single block or nil)
timeout_prevote = "300ms"
# How much the timeout_prevote increases with each round
timeout_prevote_delta = "100ms"
# How long we wait after receiving +2/3 precommits for “anything” (ie. not a single block or nil)
timeout_precommit = "300ms"
# How much the timeout_precommit increases with each round
timeout_precommit_delta = "100ms"
# How long we wait after committing a block, before starting on the new
# height (this gives us a chance to receive some more precommits, even
# though we already have +2/3).
timeout_commit = "1s"
# How many blocks to look back to check existence of the node's consensus votes before joining consensus
# When non-zero, the node will panic upon restart
# if the same consensus key was used to sign {double_sign_check_height} last blocks.
# So, validators should stop the state machine, wait for some blocks, and then restart the state machine to avoid panic.
double_sign_check_height = 0
# Make progress as soon as we have all the precommits (as if TimeoutCommit = 0)
skip_timeout_commit = false
@ -282,39 +348,25 @@ create_empty_blocks_interval = "0s"
peer_gossip_sleep_duration = "100ms"
peer_query_maj23_sleep_duration = "2s"
##### transactions indexer configuration options #####
#######################################################
### Transaction Indexer Configuration Options ###
#######################################################
[tx_index]
# What indexer to use for transactions
#
# The application will set which txs to index. In some cases a node operator will be able
# to decide which txs to index based on configuration set in the application.
#
# Options:
# 1) "null"
# 2) "kv" (default) - the simplest possible indexer, backed by key-value storage (defaults to levelDB; see DBBackend).
# - When "kv" is chosen "tx.height" and "tx.hash" will always be indexed.
indexer = "kv"
# Comma-separated list of compositeKeys to index (by default the only key is "tx.hash")
# Remember that Event has the following structure: type.key
# type: [
# key: value,
# ...
# ]
#
# You can also index transactions by height by adding "tx.height" key here.
#
# It's recommended to index only a subset of keys due to possible memory
# bloat. This is, of course, depends on the indexer's DB and the volume of
# transactions.
index_keys = ""
# When set to true, tells indexer to index all compositeKeys (predefined keys:
# "tx.hash", "tx.height" and all keys from DeliverTx responses).
#
# Note this may be not desirable (see the comment above). IndexKeys has a
# precedence over IndexAllKeys (i.e. when given both, IndexKeys will be
# indexed).
index_all_keys = true
##### instrumentation configuration options #####
#######################################################
### Instrumentation Configuration Options ###
#######################################################
[instrumentation]
# When true, Prometheus metrics are served under /metrics on

View File

@ -4,112 +4,130 @@
"auth": {
"accounts": [
{
"type": "cosmos-sdk/BaseAccount",
"value": {
"address": "cosmos12gm9sa666hywxu9nzzmp7hyl7a55hvg769w2kz"
}
"@type": "/cosmos.auth.v1beta1.BaseAccount",
"account_number": "0",
"address": "cosmos1gyavpqh80z2v7tcgeycfvf0st2nvjrfcp05dad",
"pub_key": null,
"sequence": "0"
},
{
"type": "cosmos-sdk/BaseAccount",
"value": {
"address": "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6"
}
"@type": "/cosmos.auth.v1beta1.BaseAccount",
"account_number": "0",
"address": "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6",
"pub_key": null,
"sequence": "0"
},
{
"type": "cosmos-sdk/BaseAccount",
"value": {
"address": "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5"
}
"@type": "/cosmos.auth.v1beta1.BaseAccount",
"account_number": "0",
"address": "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5",
"pub_key": null,
"sequence": "0"
},
{
"type": "cosmos-sdk/BaseAccount",
"value": {
"address": "cosmos1xy4yqngt0nlkdcenxymg8tenrghmek4nmqm28k"
}
"@type": "/cosmos.auth.v1beta1.BaseAccount",
"account_number": "0",
"address": "cosmos1xy4yqngt0nlkdcenxymg8tenrghmek4nmqm28k",
"pub_key": null,
"sequence": "0"
},
{
"type": "cosmos-sdk/BaseAccount",
"value": {
"address": "cosmos142u9fgcjdlycfcez3lw8x6x5h7rfjlnfhpw2lx"
}
"@type": "/cosmos.auth.v1beta1.BaseAccount",
"account_number": "0",
"address": "cosmos142u9fgcjdlycfcez3lw8x6x5h7rfjlnfhpw2lx",
"pub_key": null,
"sequence": "0"
},
{
"type": "cosmos-sdk/BaseAccount",
"value": {
"address": "cosmos1hsm76p4ahyhl5yh3ve9ur49r5kemhp2r0dcjvx"
}
"@type": "/cosmos.auth.v1beta1.BaseAccount",
"account_number": "0",
"address": "cosmos1hsm76p4ahyhl5yh3ve9ur49r5kemhp2r0dcjvx",
"pub_key": null,
"sequence": "0"
},
{
"type": "cosmos-sdk/BaseAccount",
"value": {
"address": "cosmos14qemq0vw6y3gc3u3e0aty2e764u4gs5le3hada"
}
"@type": "/cosmos.auth.v1beta1.BaseAccount",
"account_number": "0",
"address": "cosmos14qemq0vw6y3gc3u3e0aty2e764u4gs5le3hada",
"pub_key": null,
"sequence": "0"
},
{
"type": "cosmos-sdk/BaseAccount",
"value": {
"address": "cosmos1hhg2rlu9jscacku2wwckws7932qqqu8x3gfgw0"
}
"@type": "/cosmos.auth.v1beta1.BaseAccount",
"account_number": "0",
"address": "cosmos1hhg2rlu9jscacku2wwckws7932qqqu8x3gfgw0",
"pub_key": null,
"sequence": "0"
},
{
"type": "cosmos-sdk/BaseAccount",
"value": {
"address": "cosmos1xv9tklw7d82sezh9haa573wufgy59vmwe6xxe5"
}
"@type": "/cosmos.auth.v1beta1.BaseAccount",
"account_number": "0",
"address": "cosmos1xv9tklw7d82sezh9haa573wufgy59vmwe6xxe5",
"pub_key": null,
"sequence": "0"
},
{
"type": "cosmos-sdk/BaseAccount",
"value": {
"address": "cosmos17yg9mssjenmc3jkqth6ulcwj9cxujrxxzezwta"
}
"@type": "/cosmos.auth.v1beta1.BaseAccount",
"account_number": "0",
"address": "cosmos17yg9mssjenmc3jkqth6ulcwj9cxujrxxzezwta",
"pub_key": null,
"sequence": "0"
},
{
"type": "cosmos-sdk/BaseAccount",
"value": {
"address": "cosmos1f7j7ryulwjfe9ljplvhtcaxa6wqgula3etktce"
}
"@type": "/cosmos.auth.v1beta1.BaseAccount",
"account_number": "0",
"address": "cosmos1f7j7ryulwjfe9ljplvhtcaxa6wqgula3etktce",
"pub_key": null,
"sequence": "0"
},
{
"type": "cosmos-sdk/BaseAccount",
"value": {
"address": "cosmos1lvrwcvrqlc5ktzp2c4t22xgkx29q3y83lktgzl"
}
"@type": "/cosmos.auth.v1beta1.BaseAccount",
"account_number": "0",
"address": "cosmos1lvrwcvrqlc5ktzp2c4t22xgkx29q3y83lktgzl",
"pub_key": null,
"sequence": "0"
},
{
"type": "cosmos-sdk/BaseAccount",
"value": {
"address": "cosmos1vkv9sfwaak76weyamqx0flmng2vuquxqcuqukh"
}
"@type": "/cosmos.auth.v1beta1.BaseAccount",
"account_number": "0",
"address": "cosmos1vkv9sfwaak76weyamqx0flmng2vuquxqcuqukh",
"pub_key": null,
"sequence": "0"
},
{
"type": "cosmos-sdk/BaseAccount",
"value": {
"address": "cosmos106jwym4s9aujcmes26myzzwqsccw09sdm0v5au"
}
"@type": "/cosmos.auth.v1beta1.BaseAccount",
"account_number": "0",
"address": "cosmos106jwym4s9aujcmes26myzzwqsccw09sdm0v5au",
"pub_key": null,
"sequence": "0"
},
{
"type": "cosmos-sdk/BaseAccount",
"value": {
"address": "cosmos1c7wpeen2uv8thayf7g8q2rgpm29clj0dgrdtzw"
}
"@type": "/cosmos.auth.v1beta1.BaseAccount",
"account_number": "0",
"address": "cosmos1c7wpeen2uv8thayf7g8q2rgpm29clj0dgrdtzw",
"pub_key": null,
"sequence": "0"
},
{
"type": "cosmos-sdk/BaseAccount",
"value": {
"address": "cosmos1mjxpv9ft30wer7ma7kwfxhm42l379xutplrdk6"
}
"@type": "/cosmos.auth.v1beta1.BaseAccount",
"account_number": "0",
"address": "cosmos1mjxpv9ft30wer7ma7kwfxhm42l379xutplrdk6",
"pub_key": null,
"sequence": "0"
},
{
"type": "cosmos-sdk/BaseAccount",
"value": {
"address": "cosmos1cjsxept9rkggzxztslae9ndgpdyt2408lk850u"
}
"@type": "/cosmos.auth.v1beta1.BaseAccount",
"account_number": "0",
"address": "cosmos1cjsxept9rkggzxztslae9ndgpdyt2408lk850u",
"pub_key": null,
"sequence": "0"
},
{
"type": "cosmos-sdk/BaseAccount",
"value": {
"address": "cosmos17d0jcz59jf68g52vq38tuuncmwwjk42u6mcxej"
}
"@type": "/cosmos.auth.v1beta1.BaseAccount",
"account_number": "0",
"address": "cosmos17d0jcz59jf68g52vq38tuuncmwwjk42u6mcxej",
"pub_key": null,
"sequence": "0"
}
],
"params": {
@ -162,7 +180,7 @@
]
},
{
"address": "cosmos1f7j7ryulwjfe9ljplvhtcaxa6wqgula3etktce",
"address": "cosmos1gyavpqh80z2v7tcgeycfvf0st2nvjrfcp05dad",
"coins": [
{
"amount": "1000000000",
@ -175,7 +193,7 @@
]
},
{
"address": "cosmos12gm9sa666hywxu9nzzmp7hyl7a55hvg769w2kz",
"address": "cosmos1f7j7ryulwjfe9ljplvhtcaxa6wqgula3etktce",
"coins": [
{
"amount": "1000000000",
@ -357,9 +375,10 @@
]
}
],
"denom_metadata": null,
"denom_metadata": [],
"params": {
"default_send_enabled": true
"default_send_enabled": true,
"send_enabled": []
},
"supply": []
},
@ -386,18 +405,24 @@
"community_tax": "0.020000000000000000",
"withdraw_addr_enabled": true
},
"previous_proposer": "",
"validator_accumulated_commissions": [],
"validator_current_rewards": [],
"validator_historical_rewards": [],
"validator_slash_events": []
},
"evidence": {},
"evidence": {
"evidence": []
},
"genutil": {
"gentxs": [
"gen_txs": [
{
"auth_info": {
"fee": {
"gas_limit": "200000"
"amount": [],
"gas_limit": "200000",
"granter": "",
"payer": ""
},
"signer_infos": [
{
@ -407,44 +432,53 @@
}
},
"public_key": {
"secp256k1": "AnFadRAdh6Fl7robHe8jywDMKSWQQjB7SlpoqGsX9Ghw"
}
"@type": "/cosmos.crypto.secp256k1.PubKey",
"key": "A/Ltk7FONB0PJOKrLECIxJe5LcJMy9DcWG6X2WVA2xAi"
},
"sequence": "0"
}
]
},
"body": {
"memo": "b02715f69ce88507acaa543f7de0d3f7e6cd20f8@172.17.0.2:26656",
"extension_options": [],
"memo": "6045e08a4e3d552bbc115b23f12071887a2408a4@172.17.0.2:26656",
"messages": [
{
"@type": "/cosmos.staking.MsgCreateValidator",
"@type": "/cosmos.staking.v1beta1.MsgCreateValidator",
"commission": {
"max_change_rate": "0.010000000000000000",
"max_rate": "0.200000000000000000",
"rate": "0.100000000000000000"
},
"delegator_address": "cosmos12gm9sa666hywxu9nzzmp7hyl7a55hvg769w2kz",
"delegator_address": "cosmos1gyavpqh80z2v7tcgeycfvf0st2nvjrfcp05dad",
"description": {
"moniker": "simd-moniker"
"details": "",
"identity": "",
"moniker": "simd-moniker",
"security_contact": "",
"website": ""
},
"min_self_delegation": "1",
"pubkey": "cosmosvalconspub1zcjduepqcf6dt4wct4uk93lu0nc4vp8x8le8tqfe3wcmys53jn6lfa3fqvwsqktz95",
"validator_address": "cosmosvaloper12gm9sa666hywxu9nzzmp7hyl7a55hvg7l36l63",
"pubkey": "cosmosvalconspub1zcjduepqdmqcx90ra47mhk65afzl2f3ezlvuxhf9a3j5kzl0hp2ck226mxts8jzajn",
"validator_address": "cosmosvaloper1gyavpqh80z2v7tcgeycfvf0st2nvjrfcymqc37",
"value": {
"amount": "3000000",
"denom": "ustake"
}
}
]
],
"non_critical_extension_options": [],
"timeout_height": "0"
},
"signatures": [
"VdidVRYryEAL1v3bMIyHpwswMVSPJncCoC+7+VJdKwR5e8ymOeY+qG7q0QVcWj2x1Z72fw5O5w58anw9msnmzg=="
"8pVuzBir0VJOA1X7KuCjazKN0WcGO68B0jZvKfPomis7d44Lrqo+MC6ALrtDHtA7tJMQf3cXrsdnF3ImcJQ5Rw=="
]
}
]
},
"gov": {
"deposit_params": {
"max_deposit_period": "172800000000000",
"max_deposit_period": "172800s",
"min_deposit": [
{
"amount": "10000000",
@ -452,17 +486,17 @@
}
]
},
"deposits": null,
"proposals": null,
"deposits": [],
"proposals": [],
"starting_proposal_id": "1",
"tally_params": {
"quorum": "0.334000000000000000",
"threshold": "0.500000000000000000",
"veto": "0.334000000000000000"
"veto_threshold": "0.334000000000000000"
},
"votes": null,
"votes": [],
"voting_params": {
"voting_period": "172800000000000"
"voting_period": "172800s"
}
},
"ibc": {
@ -476,7 +510,8 @@
},
"client_genesis": {
"clients": [],
"clients_consensus": []
"clients_consensus": [],
"create_localhost": true
},
"connection_genesis": {
"client_connection_paths": [],
@ -501,7 +536,7 @@
"slashing": {
"missed_blocks": [],
"params": {
"downtime_jail_duration": "600000000000",
"downtime_jail_duration": "600s",
"min_signed_per_window": "0.500000000000000000",
"signed_blocks_window": "100",
"slash_fraction_double_sign": "0.050000000000000000",
@ -510,21 +545,27 @@
"signing_infos": []
},
"staking": {
"delegations": null,
"delegations": [],
"exported": false,
"last_total_power": "0",
"last_validator_powers": null,
"last_validator_powers": [],
"params": {
"bond_denom": "ustake",
"historical_entries": 100,
"max_entries": 7,
"max_validators": 100,
"unbonding_time": "1814400000000000"
"unbonding_time": "1814400s"
},
"redelegations": null,
"unbonding_delegations": null,
"validators": null
"redelegations": [],
"unbonding_delegations": [],
"validators": []
},
"transfer": {
"denom_traces": [],
"params": {
"receive_enabled": true,
"send_enabled": true
},
"port_id": "transfer"
},
"upgrade": {}
@ -538,13 +579,16 @@
},
"evidence": {
"max_age_duration": "172800000000000",
"max_age_num_blocks": "100000"
"max_age_num_blocks": "100000",
"max_num": 50
},
"validator": {
"pub_key_types": [
"ed25519"
]
}
},
"version": {}
},
"genesis_time": "2020-08-10T04:34:53.3772058Z"
"genesis_time": "2020-10-14T13:27:11.507897335Z",
"initial_height": "1"
}

View File

@ -0,0 +1 @@
{"body":{"messages":[{"@type":"/cosmos.staking.v1beta1.MsgCreateValidator","description":{"moniker":"simd-moniker","identity":"","website":"","security_contact":"","details":""},"commission":{"rate":"0.100000000000000000","max_rate":"0.200000000000000000","max_change_rate":"0.010000000000000000"},"min_self_delegation":"1","delegator_address":"cosmos1gyavpqh80z2v7tcgeycfvf0st2nvjrfcp05dad","validator_address":"cosmosvaloper1gyavpqh80z2v7tcgeycfvf0st2nvjrfcymqc37","pubkey":"cosmosvalconspub1zcjduepqdmqcx90ra47mhk65afzl2f3ezlvuxhf9a3j5kzl0hp2ck226mxts8jzajn","value":{"denom":"ustake","amount":"3000000"}}],"memo":"6045e08a4e3d552bbc115b23f12071887a2408a4@172.17.0.2:26656","timeout_height":"0","extension_options":[],"non_critical_extension_options":[]},"auth_info":{"signer_infos":[{"public_key":{"@type":"/cosmos.crypto.secp256k1.PubKey","key":"A/Ltk7FONB0PJOKrLECIxJe5LcJMy9DcWG6X2WVA2xAi"},"mode_info":{"single":{"mode":"SIGN_MODE_DIRECT"}},"sequence":"0"}],"fee":{"amount":[],"gas_limit":"200000","payer":"","granter":""}},"signatures":["8pVuzBir0VJOA1X7KuCjazKN0WcGO68B0jZvKfPomis7d44Lrqo+MC6ALrtDHtA7tJMQf3cXrsdnF3ImcJQ5Rw=="]}

View File

@ -1 +0,0 @@
{"body":{"messages":[{"@type":"/cosmos.staking.MsgCreateValidator","description":{"moniker":"simd-moniker"},"commission":{"rate":"0.100000000000000000","max_rate":"0.200000000000000000","max_change_rate":"0.010000000000000000"},"min_self_delegation":"1","delegator_address":"cosmos12gm9sa666hywxu9nzzmp7hyl7a55hvg769w2kz","validator_address":"cosmosvaloper12gm9sa666hywxu9nzzmp7hyl7a55hvg7l36l63","pubkey":"cosmosvalconspub1zcjduepqcf6dt4wct4uk93lu0nc4vp8x8le8tqfe3wcmys53jn6lfa3fqvwsqktz95","value":{"denom":"ustake","amount":"3000000"}}],"memo":"b02715f69ce88507acaa543f7de0d3f7e6cd20f8@172.17.0.2:26656"},"auth_info":{"signer_infos":[{"public_key":{"secp256k1":"AnFadRAdh6Fl7robHe8jywDMKSWQQjB7SlpoqGsX9Ghw"},"mode_info":{"single":{"mode":"SIGN_MODE_DIRECT"}}}],"fee":{"gas_limit":"200000"}},"signatures":["VdidVRYryEAL1v3bMIyHpwswMVSPJncCoC+7+VJdKwR5e8ymOeY+qG7q0QVcWj2x1Z72fw5O5w58anw9msnmzg=="]}

View File

@ -1 +1 @@
{"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"SBwYIjYkPgEdajIt1al+FUZOQ+vMri9xPkES1pDlVISVMV3aGAIFv9hQA0EDCe6NDWJopE6TCmnI+Pca65YSCw=="}}
{"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"U/ZIZ8dhWwNZ40ZZZZlI5ettatjzGea7fZDyarOl+dK5/6cEDqQV1yqDQ2mhK+m5zxyewIAuDKZOJaLsu10kgA=="}}

View File

@ -1,11 +1,11 @@
{
"address": "9B393572E82025BE3A6D2007304AAE69B55D62DC",
"address": "F828C78A9BF39831CE66D94A1AF09BBD81584A09",
"pub_key": {
"type": "tendermint/PubKeyEd25519",
"value": "wnTV1dhdeWLH/HzxVgTmP/J1gTmLsbJCkZT19PYpAx0="
"value": "bsGDFePtfbvbVOpF9SY5F9nDXSXsZUsL77hViyla2Zc="
},
"priv_key": {
"type": "tendermint/PrivKeyEd25519",
"value": "fPWqUiCrr+AlyHb29zpYglZ/9RLbz60fRQziZgVA+JjCdNXV2F15Ysf8fPFWBOY/8nWBOYuxskKRlPX09ikDHQ=="
"value": "7tnO0supEo6PVxhoe0VKNpFsEGVs0wBYqybN9O/bp+ZuwYMV4+19u9tU6kX1JjkX2cNdJexlSwvvuFWLKVrZlw=="
}
}

View File

@ -1,5 +1,5 @@
{
"height": "0",
"round": "0",
"round": 0,
"step": 0
}

View File

@ -1 +1 @@
$2a$10$2fI6FM3ObOD8pRF2.xRn8Op8SAzWw0PvhQZNwwDzzdf9mgmy1DFP.
$2a$10$ydoOKhJitSWzIjgZvIM8teHFVeXxuI2QcVg.p7oC7mLppNccQPpSO

View File

@ -1 +1 @@
eyJhbGciOiJQQkVTMi1IUzI1NitBMTI4S1ciLCJjcmVhdGVkIjoiMjAyMC0wOC0xMCAwNDozNDo1My44NDIzNDE2ICswMDAwIFVUQyBtPSswLjI3Nzg5MTQwMSIsImVuYyI6IkEyNTZHQ00iLCJwMmMiOjgxOTIsInAycyI6IkxGbnlSVzBhbGNWaVQ4U0wifQ.AapFS3IPSX9Bt9Vz-wFg5mfoRobwImw8NcC0HJfBBLV1lm_56_b9qw.u2l6d7qrmOBEXyD8.aaGsuy_GMH_pyqkMcK80nxBZsIOyMJLTlR4slViy9q0T0qo2mtJFNUwtOoaN6wxewNYBdOJDJQ3GDtUtNZW6s9EoBigrsUxP-gTaBMtARx5u4Hn_VDCidxZJbgmoneX_P5K71vV8lVJ9sKhqZyDeKcwUrKB7EztKlxGDYt04NmsbLJkK8CNYnj3dYL5sCCz46B09eNSx83_rIpyE141WEzgwgOEayu5Nz2V7lFGp2WZfdeeqslyqKNwHMiQJGdzLjc787fgMPqleYusmBKHfNveUa2eaNIexnLGmkHkao9YH4-nJIpGOSBIGQZeG1dcUckFvaesq64gKZRmOKp37vfJkyqmuP7STVgeko93YvwcVlU6r.TfQIMmIaSUx-eddwt9zahg
eyJhbGciOiJQQkVTMi1IUzI1NitBMTI4S1ciLCJjcmVhdGVkIjoiMjAyMC0xMC0xNCAxMzoyNzoxMS44MzI3NzY3MjYgKzAwMDAgVVRDIG09KzAuMTY5NTkwMjI3IiwiZW5jIjoiQTI1NkdDTSIsInAyYyI6ODE5MiwicDJzIjoiZ2FTODdpamFRZi1qekUwayJ9.HxLiSFput-6b3gHRct4S7Rsy8LjdEiy4WOBaxAJFhlmD4BAmaQNWjQ._b26hJJsFHwjf8vh.BRCG5wulPHtsW500x1Odh15kfngP1hF2SCIPejR9mMSzt6hfdYUdwPA-vDFbajeUQc3vA5EpqpH9aqhmtVM2R9PblSH7e0FWmOUSR1y3rD574RyLFJzXHM8YTsH5SpMnzdqz1lzedea3fM9E7nbkCRVQQITrQhvo3Y_8pkkgDUCUnZMH-IQ6NNCA60w_3rn-mTipnrNlTGbMKoGX790UZbM-XMpTpqZhBxWoq1D7qNZ1iCdIOdyC3JIUuYUV1y0E6DdAUFXosQUN5sBCytcqYh_iZG-YUpFHrHtPUnNJRlGmGpTQVHlZpsGNXd1oquhA1XKYejyJOjyLNwHwp4FF3Nl11rGY-TCImvMk372kZvynAafi.S2hGEHZ0enyqhX89vpb0hg