diff --git a/packages/bcp/src/cosmwasmconnection.spec.ts b/packages/bcp/src/cosmwasmconnection.spec.ts index 7c08d49c..4f4b716f 100644 --- a/packages/bcp/src/cosmwasmconnection.spec.ts +++ b/packages/bcp/src/cosmwasmconnection.spec.ts @@ -44,7 +44,7 @@ function makeRandomAddress(): Address { const faucet = { mnemonic: "economy stock theory fatal elder harbor betray wasp final emotion task crumble siren bottom lizard educate guess current outdoor pair theory focus wife stone", - path: HdPaths.cosmos(0), + path: HdPaths.cosmosHub(0), pubkey: { algo: Algorithm.Secp256k1, data: fromBase64("A08EGB7ro1ORuFhjOnZcSgwYlpe0DSFjVNUIkNNQxwKQ") as PubkeyBytes, @@ -52,6 +52,21 @@ const faucet = { address: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6" as Address, }; +/** + * We use a different test account than the faucet, since BCP errors when transactions + * with multiple messages are found. + */ +const bob = { + mnemonic: + "economy stock theory fatal elder harbor betray wasp final emotion task crumble siren bottom lizard educate guess current outdoor pair theory focus wife stone", + path: HdPaths.cosmosHub(4), + pubkey: { + algo: Algorithm.Secp256k1, + data: fromBase64("Aum2063ub/ErUnIUB36sK55LktGUStgcbSiaAnL1wadu") as PubkeyBytes, + }, + address: "cosmos1hsm76p4ahyhl5yh3ve9ur49r5kemhp2r0dcjvx" as Address, +}; + describe("CosmWasmConnection", () => { const cosm = "COSM" as TokenTicker; const isa = "ISA" as TokenTicker; @@ -318,8 +333,8 @@ describe("CosmWasmConnection", () => { }); const profile = new UserProfile(); - const wallet = profile.addWallet(Secp256k1HdWallet.fromMnemonic(faucet.mnemonic)); - const sender = await profile.createIdentity(wallet.id, defaultChainId, faucet.path); + const wallet = profile.addWallet(Secp256k1HdWallet.fromMnemonic(bob.mnemonic)); + const sender = await profile.createIdentity(wallet.id, defaultChainId, bob.path); const senderAddress = connection.codec.identityToAddress(sender); for (const i of [0, 1]) { @@ -346,8 +361,8 @@ describe("CosmWasmConnection", () => { pendingWithoutWasmd(); const connection = await CosmWasmConnection.establish(httpUrl, defaultAddressPrefix, defaultConfig); const profile = new UserProfile(); - const wallet = profile.addWallet(Secp256k1HdWallet.fromMnemonic(faucet.mnemonic)); - const senderIdentity = await profile.createIdentity(wallet.id, defaultChainId, faucet.path); + const wallet = profile.addWallet(Secp256k1HdWallet.fromMnemonic(bob.mnemonic)); + const senderIdentity = await profile.createIdentity(wallet.id, defaultChainId, bob.path); const senderAddress = connection.codec.identityToAddress(senderIdentity); const unsigned = await connection.withDefaultFee({ @@ -397,8 +412,8 @@ describe("CosmWasmConnection", () => { pendingWithoutWasmd(); const connection = await CosmWasmConnection.establish(httpUrl, defaultAddressPrefix, defaultConfig); const profile = new UserProfile(); - const wallet = profile.addWallet(Secp256k1HdWallet.fromMnemonic(faucet.mnemonic)); - const senderIdentity = await profile.createIdentity(wallet.id, defaultChainId, faucet.path); + const wallet = profile.addWallet(Secp256k1HdWallet.fromMnemonic(bob.mnemonic)); + const senderIdentity = await profile.createIdentity(wallet.id, defaultChainId, bob.path); const senderAddress = connection.codec.identityToAddress(senderIdentity); const unsigned = await connection.withDefaultFee({ @@ -447,7 +462,7 @@ describe("CosmWasmConnection", () => { pendingWithoutWasmd(); const connection = await CosmWasmConnection.establish(httpUrl, defaultAddressPrefix, defaultConfig); - const results = await connection.searchTx({ sentFromOrTo: faucet.address }); + const results = await connection.searchTx({ sentFromOrTo: bob.address }); const firstSearchResult = results.find(() => true); assert(firstSearchResult, "At least one transaction sent by the faucet must be available."); assert(isConfirmedTransaction(firstSearchResult), "Transaction must be confirmed."); @@ -503,8 +518,8 @@ describe("CosmWasmConnection", () => { pendingWithoutWasmd(); const connection = await CosmWasmConnection.establish(httpUrl, defaultAddressPrefix, defaultConfig); const profile = new UserProfile(); - const wallet = profile.addWallet(Secp256k1HdWallet.fromMnemonic(faucet.mnemonic)); - const sender = await profile.createIdentity(wallet.id, defaultChainId, faucet.path); + const wallet = profile.addWallet(Secp256k1HdWallet.fromMnemonic(bob.mnemonic)); + const sender = await profile.createIdentity(wallet.id, defaultChainId, bob.path); const senderAddress = connection.codec.identityToAddress(sender); const unsigned = await connection.withDefaultFee({ @@ -593,8 +608,8 @@ describe("CosmWasmConnection", () => { pendingWithoutWasmd(); const connection = await CosmWasmConnection.establish(httpUrl, defaultAddressPrefix, defaultConfig); const profile = new UserProfile(); - const wallet = profile.addWallet(Secp256k1HdWallet.fromMnemonic(faucet.mnemonic)); - const sender = await profile.createIdentity(wallet.id, defaultChainId, faucet.path); + const wallet = profile.addWallet(Secp256k1HdWallet.fromMnemonic(bob.mnemonic)); + const sender = await profile.createIdentity(wallet.id, defaultChainId, bob.path); const senderAddress = connection.codec.identityToAddress(sender); const recipient = makeRandomAddress(); @@ -711,8 +726,8 @@ describe("CosmWasmConnection", () => { pendingWithoutWasmd(); const connection = await CosmWasmConnection.establish(httpUrl, defaultAddressPrefix, defaultConfig); const profile = new UserProfile(); - const wallet = profile.addWallet(Secp256k1HdWallet.fromMnemonic(faucet.mnemonic)); - const sender = await profile.createIdentity(wallet.id, defaultChainId, faucet.path); + const wallet = profile.addWallet(Secp256k1HdWallet.fromMnemonic(bob.mnemonic)); + const sender = await profile.createIdentity(wallet.id, defaultChainId, bob.path); const senderAddress = connection.codec.identityToAddress(sender); const recipient = makeRandomAddress(); @@ -923,8 +938,8 @@ describe("CosmWasmConnection", () => { const connection = await CosmWasmConnection.establish(httpUrl, defaultAddressPrefix, defaultConfig); const profile = new UserProfile(); - const wallet = profile.addWallet(Secp256k1HdWallet.fromMnemonic(faucet.mnemonic)); - const sender = await profile.createIdentity(wallet.id, defaultChainId, faucet.path); + const wallet = profile.addWallet(Secp256k1HdWallet.fromMnemonic(bob.mnemonic)); + const sender = await profile.createIdentity(wallet.id, defaultChainId, bob.path); // send transactions @@ -1006,8 +1021,8 @@ describe("CosmWasmConnection", () => { const connection = await CosmWasmConnection.establish(httpUrl, defaultAddressPrefix, defaultConfig); const profile = new UserProfile(); - const wallet = profile.addWallet(Secp256k1HdWallet.fromMnemonic(faucet.mnemonic)); - const sender = await profile.createIdentity(wallet.id, defaultChainId, faucet.path); + const wallet = profile.addWallet(Secp256k1HdWallet.fromMnemonic(bob.mnemonic)); + const sender = await profile.createIdentity(wallet.id, defaultChainId, bob.path); const recipientAddress = makeRandomAddress(); const send = await connection.withDefaultFee({ @@ -1056,8 +1071,8 @@ describe("CosmWasmConnection", () => { const connection = await CosmWasmConnection.establish(httpUrl, defaultAddressPrefix, defaultConfig); const profile = new UserProfile(); - const wallet = profile.addWallet(Secp256k1HdWallet.fromMnemonic(faucet.mnemonic)); - const sender = await profile.createIdentity(wallet.id, defaultChainId, faucet.path); + const wallet = profile.addWallet(Secp256k1HdWallet.fromMnemonic(bob.mnemonic)); + const sender = await profile.createIdentity(wallet.id, defaultChainId, bob.path); // send transactions diff --git a/packages/cli/examples/faucet_addresses.ts b/packages/cli/examples/faucet_addresses.ts new file mode 100644 index 00000000..a7be953b --- /dev/null +++ b/packages/cli/examples/faucet_addresses.ts @@ -0,0 +1,9 @@ +const mnemonic = "economy stock theory fatal elder harbor betray wasp final emotion task crumble siren bottom lizard educate guess current outdoor pair theory focus wife stone"; + +for (let i of [0, 1, 2, 3, 4]) { + const pen = await Secp256k1Pen.fromMnemonic(mnemonic, makeCosmoshubPath(i)); + const pubkey = toBase64(pen.pubkey); + const address = pubkeyToAddress(encodeSecp256k1Pubkey(pen.pubkey), "cosmos"); + console.info(`Address ${i}: ${address}`); + console.info(`Pubkey ${i}: ${pubkey}`); +} diff --git a/packages/cli/src/cli.ts b/packages/cli/src/cli.ts index dd220fa2..d31b0eac 100644 --- a/packages/cli/src/cli.ts +++ b/packages/cli/src/cli.ts @@ -35,6 +35,7 @@ export function main(originalArgs: readonly string[]): void { "encodeSecp256k1Pubkey", "encodeSecp256k1Signature", "logs", + "makeCosmoshubPath", "makeSignBytes", "marshalTx", "Pen", @@ -151,7 +152,7 @@ export function main(originalArgs: readonly string[]): void { assert(Decimal.fromAtomics("12870000", 6).toString() === "12.87"); const mnemonic = Bip39.encode(Random.getBytes(16)).toString(); - const pen = await Secp256k1Pen.fromMnemonic(mnemonic); + const pen = await Secp256k1Pen.fromMnemonic(mnemonic, makeCosmoshubPath(0)); const pubkey = encodeSecp256k1Pubkey(pen.pubkey); const address = pubkeyToAddress(pubkey, "cosmos"); const data = Encoding.toAscii("foo bar"); diff --git a/packages/sdk/src/address.ts b/packages/sdk/src/address.ts index 58ec7da3..126d8fb8 100644 --- a/packages/sdk/src/address.ts +++ b/packages/sdk/src/address.ts @@ -5,18 +5,22 @@ import { PubKey, pubkeyType } from "./types"; const { fromBase64 } = Encoding; +export function rawSecp256k1PubkeyToAddress(pubkeyRaw: Uint8Array, prefix: string): string { + if (pubkeyRaw.length !== 33) { + throw new Error(`Invalid Secp256k1 pubkey length (compressed): ${pubkeyRaw.length}`); + } + const hash1 = new Sha256(pubkeyRaw).digest(); + const hash2 = new Ripemd160(hash1).digest(); + return Bech32.encode(prefix, hash2); +} + // See https://github.com/tendermint/tendermint/blob/f2ada0a604b4c0763bda2f64fac53d506d3beca7/docs/spec/blockchain/encoding.md#public-key-cryptography // This assumes we already have a cosmos-compressed pubkey export function pubkeyToAddress(pubkey: PubKey, prefix: string): string { const pubkeyBytes = fromBase64(pubkey.value); switch (pubkey.type) { case pubkeyType.secp256k1: { - if (pubkeyBytes.length !== 33) { - throw new Error(`Invalid Secp256k1 pubkey length (compressed): ${pubkeyBytes.length}`); - } - const hash1 = new Sha256(pubkeyBytes).digest(); - const hash2 = new Ripemd160(hash1).digest(); - return Bech32.encode(prefix, hash2); + return rawSecp256k1PubkeyToAddress(pubkeyBytes, prefix); } case pubkeyType.ed25519: { if (pubkeyBytes.length !== 32) { diff --git a/packages/sdk/src/cosmwasmclient.searchtx.spec.ts b/packages/sdk/src/cosmwasmclient.searchtx.spec.ts index a2daa062..29de30ee 100644 --- a/packages/sdk/src/cosmwasmclient.searchtx.spec.ts +++ b/packages/sdk/src/cosmwasmclient.searchtx.spec.ts @@ -271,11 +271,13 @@ describe("CosmWasmClient.searchTx", () => { // Check basic structure of all results for (const result of results) { - const msg = fromOneElementArray(result.tx.value.msg); - assert(isMsgSend(msg), `${result.hash} (height ${result.height}) is not a bank send transaction`); - expect( - msg.value.to_address === sendSuccessful.sender || msg.value.from_address == sendSuccessful.sender, - ).toEqual(true); + const containsMsgWithSender = !!result.tx.value.msg.find( + (msg) => isMsgSend(msg) && msg.value.from_address == sendSuccessful!.sender, + ); + const containsMsgWithRecipient = !!result.tx.value.msg.find( + (msg) => isMsgSend(msg) && msg.value.to_address === sendSuccessful!.sender, + ); + expect(containsMsgWithSender || containsMsgWithRecipient).toEqual(true); } // Check details of most recent result diff --git a/packages/sdk/src/cosmwasmclient.spec.ts b/packages/sdk/src/cosmwasmclient.spec.ts index 84f016fe..f177424e 100644 --- a/packages/sdk/src/cosmwasmclient.spec.ts +++ b/packages/sdk/src/cosmwasmclient.spec.ts @@ -17,6 +17,7 @@ import { makeRandomAddress, pendingWithoutWasmd, tendermintIdMatcher, + unused, wasmd, wasmdEnabled, } from "./testutils.spec"; @@ -24,10 +25,6 @@ import { MsgSend, StdFee } from "./types"; const { fromAscii, fromHex, fromUtf8, toAscii, toBase64 } = Encoding; -const unused = { - address: "cosmos1cjsxept9rkggzxztslae9ndgpdyt2408lk850u", -}; - const guest = { address: "cosmos17d0jcz59jf68g52vq38tuuncmwwjk42u6mcxej", }; @@ -113,8 +110,8 @@ describe("CosmWasmClient", () => { pendingWithoutWasmd(); const client = new CosmWasmClient(wasmd.endpoint); expect(await client.getNonce(unused.address)).toEqual({ - accountNumber: 5, - sequence: 0, + accountNumber: unused.accountNumber, + sequence: unused.sequence, }); }); @@ -135,8 +132,8 @@ describe("CosmWasmClient", () => { const client = new CosmWasmClient(wasmd.endpoint); expect(await client.getAccount(unused.address)).toEqual({ address: unused.address, - accountNumber: 5, - sequence: 0, + accountNumber: unused.accountNumber, + sequence: unused.sequence, pubkey: undefined, balance: [ { denom: "ucosm", amount: "1000000000" }, @@ -345,7 +342,7 @@ describe("CosmWasmClient", () => { decimals: 5, name: "Hash token", symbol: "HASH", - initial_balances: [ + initial_balances: jasmine.arrayContaining([ { address: faucet.address, amount: "11", @@ -358,7 +355,7 @@ describe("CosmWasmClient", () => { address: guest.address, amount: "22004000000", }, - ], + ]), }, }); }); diff --git a/packages/sdk/src/restclient.spec.ts b/packages/sdk/src/restclient.spec.ts index 3bd46333..38163c0d 100644 --- a/packages/sdk/src/restclient.spec.ts +++ b/packages/sdk/src/restclient.spec.ts @@ -4,9 +4,10 @@ import { Encoding } from "@iov/encoding"; import { assert, sleep } from "@iov/utils"; import { ReadonlyDate } from "readonly-date"; +import { rawSecp256k1PubkeyToAddress } from "./address"; import { makeSignBytes } from "./encoding"; import { findAttribute, parseLogs } from "./logs"; -import { Pen, Secp256k1Pen } from "./pen"; +import { makeCosmoshubPath, Pen, Secp256k1Pen } from "./pen"; import { encodeBech32Pubkey } from "./pubkey"; import { PostTxsResponse, RestClient, TxsResponse } from "./restclient"; import { SigningCosmWasmClient } from "./signingcosmwasmclient"; @@ -25,6 +26,7 @@ import { tendermintIdMatcher, tendermintOptionalIdMatcher, tendermintShortHashMatcher, + unused, wasmd, wasmdEnabled, } from "./testutils.spec"; @@ -45,9 +47,6 @@ import { const { fromAscii, fromBase64, fromHex, toAscii, toBase64, toHex } = Encoding; const emptyAddress = "cosmos1ltkhnmdcqemmd2tkhnx7qx66tq7e0wykw2j85k"; -const unusedAccount = { - address: "cosmos1cjsxept9rkggzxztslae9ndgpdyt2408lk850u", -}; function makeSignedTx(firstMsg: Msg, fee: StdFee, memo: string, firstSignature: StdSignature): StdTx { return { @@ -176,12 +175,12 @@ describe("RestClient", () => { it("works for unused account without pubkey", async () => { pendingWithoutWasmd(); const client = new RestClient(wasmd.endpoint); - const { height, result } = await client.authAccounts(unusedAccount.address); + const { height, result } = await client.authAccounts(unused.address); expect(height).toMatch(nonNegativeIntegerMatcher); expect(result).toEqual({ type: "cosmos-sdk/Account", value: { - address: unusedAccount.address, + address: unused.address, public_key: "", // not known to the chain coins: [ { @@ -193,7 +192,7 @@ describe("RestClient", () => { denom: "ustake", }, ], - account_number: 5, + account_number: unused.accountNumber, sequence: 0, }, }); @@ -807,6 +806,319 @@ describe("RestClient", () => { }); }); + it("can't send transaction with additional signatures", async () => { + pendingWithoutWasmd(); + const account1 = await Secp256k1Pen.fromMnemonic(faucet.mnemonic, makeCosmoshubPath(0)); + const account2 = await Secp256k1Pen.fromMnemonic(faucet.mnemonic, makeCosmoshubPath(1)); + const account3 = await Secp256k1Pen.fromMnemonic(faucet.mnemonic, makeCosmoshubPath(2)); + const address1 = rawSecp256k1PubkeyToAddress(account1.pubkey, "cosmos"); + const address2 = rawSecp256k1PubkeyToAddress(account2.pubkey, "cosmos"); + const address3 = rawSecp256k1PubkeyToAddress(account3.pubkey, "cosmos"); + + const memo = "My first contract on chain"; + const theMsg: MsgSend = { + type: "cosmos-sdk/MsgSend", + value: { + from_address: address1, + to_address: emptyAddress, + amount: [ + { + denom: "ucosm", + amount: "1234567", + }, + ], + }, + }; + + const fee: StdFee = { + amount: [ + { + amount: "5000", + denom: "ucosm", + }, + ], + gas: "890000", + }; + + const client = new RestClient(wasmd.endpoint); + const { account_number: an1, sequence: sequence1 } = (await client.authAccounts(address1)).result.value; + const { account_number: an2, sequence: sequence2 } = (await client.authAccounts(address2)).result.value; + const { account_number: an3, sequence: sequence3 } = (await client.authAccounts(address3)).result.value; + + const signBytes1 = makeSignBytes([theMsg], fee, wasmd.chainId, memo, an1, sequence1); + const signBytes2 = makeSignBytes([theMsg], fee, wasmd.chainId, memo, an2, sequence2); + const signBytes3 = makeSignBytes([theMsg], fee, wasmd.chainId, memo, an3, sequence3); + const signature1 = await account1.sign(signBytes1); + const signature2 = await account2.sign(signBytes2); + const signature3 = await account3.sign(signBytes3); + const signedTx = { + msg: [theMsg], + fee: fee, + memo: memo, + signatures: [signature1, signature2, signature3], + }; + const postResult = await client.postTx(signedTx); + // console.log(postResult.raw_log); + expect(postResult.code).toEqual(4); + expect(postResult.raw_log).toContain("wrong number of signers"); + }); + + it("can send multiple messages with one signature", async () => { + pendingWithoutWasmd(); + const account1 = await Secp256k1Pen.fromMnemonic(faucet.mnemonic, makeCosmoshubPath(0)); + const address1 = rawSecp256k1PubkeyToAddress(account1.pubkey, "cosmos"); + + const memo = "My first contract on chain"; + const msg1: MsgSend = { + type: "cosmos-sdk/MsgSend", + value: { + from_address: address1, + to_address: emptyAddress, + amount: [ + { + denom: "ucosm", + amount: "1234567", + }, + ], + }, + }; + const msg2: MsgSend = { + type: "cosmos-sdk/MsgSend", + value: { + from_address: address1, + to_address: emptyAddress, + amount: [ + { + denom: "ucosm", + amount: "7654321", + }, + ], + }, + }; + + const fee: StdFee = { + amount: [ + { + amount: "5000", + denom: "ucosm", + }, + ], + gas: "890000", + }; + + const client = new RestClient(wasmd.endpoint); + const { account_number, sequence } = (await client.authAccounts(address1)).result.value; + + const signBytes = makeSignBytes([msg1, msg2], fee, wasmd.chainId, memo, account_number, sequence); + const signature1 = await account1.sign(signBytes); + const signedTx = { + msg: [msg1, msg2], + fee: fee, + memo: memo, + signatures: [signature1], + }; + const postResult = await client.postTx(signedTx); + // console.log(postResult.raw_log); + expect(postResult.code).toBeUndefined(); + }); + + it("can send multiple messages with multiple signatures", async () => { + pendingWithoutWasmd(); + const account1 = await Secp256k1Pen.fromMnemonic(faucet.mnemonic, makeCosmoshubPath(0)); + const account2 = await Secp256k1Pen.fromMnemonic(faucet.mnemonic, makeCosmoshubPath(1)); + const address1 = rawSecp256k1PubkeyToAddress(account1.pubkey, "cosmos"); + const address2 = rawSecp256k1PubkeyToAddress(account2.pubkey, "cosmos"); + + const memo = "My first contract on chain"; + const msg1: MsgSend = { + type: "cosmos-sdk/MsgSend", + value: { + from_address: address1, + to_address: emptyAddress, + amount: [ + { + denom: "ucosm", + amount: "1234567", + }, + ], + }, + }; + const msg2: MsgSend = { + type: "cosmos-sdk/MsgSend", + value: { + from_address: address2, + to_address: emptyAddress, + amount: [ + { + denom: "ucosm", + amount: "7654321", + }, + ], + }, + }; + + const fee: StdFee = { + amount: [ + { + amount: "5000", + denom: "ucosm", + }, + ], + gas: "890000", + }; + + const client = new RestClient(wasmd.endpoint); + const { account_number: an1, sequence: sequence1 } = (await client.authAccounts(address1)).result.value; + const { account_number: an2, sequence: sequence2 } = (await client.authAccounts(address2)).result.value; + + const signBytes1 = makeSignBytes([msg2, msg1], fee, wasmd.chainId, memo, an1, sequence1); + const signBytes2 = makeSignBytes([msg2, msg1], fee, wasmd.chainId, memo, an2, sequence2); + const signature1 = await account1.sign(signBytes1); + const signature2 = await account2.sign(signBytes2); + const signedTx = { + msg: [msg2, msg1], + fee: fee, + memo: memo, + signatures: [signature2, signature1], + }; + const postResult = await client.postTx(signedTx); + // console.log(postResult.raw_log); + expect(postResult.code).toBeUndefined(); + + await sleep(500); + const searched = await client.txsQuery(`tx.hash=${postResult.txhash}`); + expect(searched.txs.length).toEqual(1); + expect(searched.txs[0].tx.value.signatures).toEqual([signature2, signature1]); + }); + + it("can't send transaction with wrong signature order (1)", async () => { + pendingWithoutWasmd(); + const account1 = await Secp256k1Pen.fromMnemonic(faucet.mnemonic, makeCosmoshubPath(0)); + const account2 = await Secp256k1Pen.fromMnemonic(faucet.mnemonic, makeCosmoshubPath(1)); + const address1 = rawSecp256k1PubkeyToAddress(account1.pubkey, "cosmos"); + const address2 = rawSecp256k1PubkeyToAddress(account2.pubkey, "cosmos"); + + const memo = "My first contract on chain"; + const msg1: MsgSend = { + type: "cosmos-sdk/MsgSend", + value: { + from_address: address1, + to_address: emptyAddress, + amount: [ + { + denom: "ucosm", + amount: "1234567", + }, + ], + }, + }; + const msg2: MsgSend = { + type: "cosmos-sdk/MsgSend", + value: { + from_address: address2, + to_address: emptyAddress, + amount: [ + { + denom: "ucosm", + amount: "7654321", + }, + ], + }, + }; + + const fee: StdFee = { + amount: [ + { + amount: "5000", + denom: "ucosm", + }, + ], + gas: "890000", + }; + + const client = new RestClient(wasmd.endpoint); + const { account_number: an1, sequence: sequence1 } = (await client.authAccounts(address1)).result.value; + const { account_number: an2, sequence: sequence2 } = (await client.authAccounts(address2)).result.value; + + const signBytes1 = makeSignBytes([msg1, msg2], fee, wasmd.chainId, memo, an1, sequence1); + const signBytes2 = makeSignBytes([msg1, msg2], fee, wasmd.chainId, memo, an2, sequence2); + const signature1 = await account1.sign(signBytes1); + const signature2 = await account2.sign(signBytes2); + const signedTx = { + msg: [msg1, msg2], + fee: fee, + memo: memo, + signatures: [signature2, signature1], + }; + const postResult = await client.postTx(signedTx); + // console.log(postResult.raw_log); + expect(postResult.code).toEqual(8); + }); + + it("can't send transaction with wrong signature order (2)", async () => { + pendingWithoutWasmd(); + const account1 = await Secp256k1Pen.fromMnemonic(faucet.mnemonic, makeCosmoshubPath(0)); + const account2 = await Secp256k1Pen.fromMnemonic(faucet.mnemonic, makeCosmoshubPath(1)); + const address1 = rawSecp256k1PubkeyToAddress(account1.pubkey, "cosmos"); + const address2 = rawSecp256k1PubkeyToAddress(account2.pubkey, "cosmos"); + + const memo = "My first contract on chain"; + const msg1: MsgSend = { + type: "cosmos-sdk/MsgSend", + value: { + from_address: address1, + to_address: emptyAddress, + amount: [ + { + denom: "ucosm", + amount: "1234567", + }, + ], + }, + }; + const msg2: MsgSend = { + type: "cosmos-sdk/MsgSend", + value: { + from_address: address2, + to_address: emptyAddress, + amount: [ + { + denom: "ucosm", + amount: "7654321", + }, + ], + }, + }; + + const fee: StdFee = { + amount: [ + { + amount: "5000", + denom: "ucosm", + }, + ], + gas: "890000", + }; + + const client = new RestClient(wasmd.endpoint); + const { account_number: an1, sequence: sequence1 } = (await client.authAccounts(address1)).result.value; + const { account_number: an2, sequence: sequence2 } = (await client.authAccounts(address2)).result.value; + + const signBytes1 = makeSignBytes([msg2, msg1], fee, wasmd.chainId, memo, an1, sequence1); + const signBytes2 = makeSignBytes([msg2, msg1], fee, wasmd.chainId, memo, an2, sequence2); + const signature1 = await account1.sign(signBytes1); + const signature2 = await account2.sign(signBytes2); + const signedTx = { + msg: [msg2, msg1], + fee: fee, + memo: memo, + signatures: [signature1, signature2], + }; + const postResult = await client.postTx(signedTx); + // console.log(postResult.raw_log); + expect(postResult.code).toEqual(8); + }); + it("can upload, instantiate and execute wasm", async () => { pendingWithoutWasmd(); const pen = await Secp256k1Pen.fromMnemonic(faucet.mnemonic); diff --git a/packages/sdk/src/testutils.spec.ts b/packages/sdk/src/testutils.spec.ts index ac6980af..dbbafa9e 100644 --- a/packages/sdk/src/testutils.spec.ts +++ b/packages/sdk/src/testutils.spec.ts @@ -49,6 +49,17 @@ export const faucet = { address: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6", }; +/** Unused account */ +export const unused = { + pubkey: { + type: "tendermint/PubKeySecp256k1", + value: "ArkCaFUJ/IH+vKBmNRCdUVl3mCAhbopk9jjW4Ko4OfRQ", + }, + address: "cosmos1cjsxept9rkggzxztslae9ndgpdyt2408lk850u", + accountNumber: 9, + sequence: 0, +}; + export function wasmdEnabled(): boolean { return !!process.env.WASMD_ENABLED; } diff --git a/packages/sdk/types/address.d.ts b/packages/sdk/types/address.d.ts index a8f251fb..9eb5af82 100644 --- a/packages/sdk/types/address.d.ts +++ b/packages/sdk/types/address.d.ts @@ -1,2 +1,3 @@ import { PubKey } from "./types"; +export declare function rawSecp256k1PubkeyToAddress(pubkeyRaw: Uint8Array, prefix: string): string; export declare function pubkeyToAddress(pubkey: PubKey, prefix: string): string; diff --git a/scripts/wasmd/README.md b/scripts/wasmd/README.md index 6fab941b..664ad900 100644 --- a/scripts/wasmd/README.md +++ b/scripts/wasmd/README.md @@ -84,8 +84,16 @@ You should get output matching the following: 1. Faucet
economy stock theory fatal elder harbor betray wasp final emotion task crumble siren bottom lizard educate guess current outdoor pair theory focus wife stone
- A08EGB7ro1ORuFhjOnZcSgwYlpe0DSFjVNUIkNNQxwKQ
- cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6 + Address 0: cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6
+ Address 1: cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5
+ Address 2: cosmos1xy4yqngt0nlkdcenxymg8tenrghmek4nmqm28k
+ Address 3: cosmos142u9fgcjdlycfcez3lw8x6x5h7rfjlnfhpw2lx
+ Address 4: cosmos1hsm76p4ahyhl5yh3ve9ur49r5kemhp2r0dcjvx
+ Pubkey 0: A08EGB7ro1ORuFhjOnZcSgwYlpe0DSFjVNUIkNNQxwKQ
+ Pubkey 1: AiDosfIbBi54XJ1QjCeApumcy/FjdtF+YhywPf3DKTx7
+ Pubkey 2: AzQg33JZqH7vSsm09esZY5bZvmzYwE/SY78cA0iLxpD7
+ Pubkey 3: A3gOAlB6aiRTCPvWMQg2+ZbGYNsLd8qlvV28m8p2UhY2
+ Pubkey 4: Aum2063ub/ErUnIUB36sK55LktGUStgcbSiaAnL1wadu
2. Unused: for testing account state; this account never changes balances or nonces
oyster design unusual machine spread century engine gravity focus cave carry slot
ArkCaFUJ/IH+vKBmNRCdUVl3mCAhbopk9jjW4Ko4OfRQ
diff --git a/scripts/wasmd/deploy_erc20.js b/scripts/wasmd/deploy_erc20.js index 84e8b6cc..c138d93f 100755 --- a/scripts/wasmd/deploy_erc20.js +++ b/scripts/wasmd/deploy_erc20.js @@ -8,7 +8,11 @@ const httpUrl = "http://localhost:1317"; const faucet = { mnemonic: "economy stock theory fatal elder harbor betray wasp final emotion task crumble siren bottom lizard educate guess current outdoor pair theory focus wife stone", - address: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6", + address0: "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6", + address1: "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5", + address2: "cosmos1xy4yqngt0nlkdcenxymg8tenrghmek4nmqm28k", + address3: "cosmos142u9fgcjdlycfcez3lw8x6x5h7rfjlnfhpw2lx", + address4: "cosmos1hsm76p4ahyhl5yh3ve9ur49r5kemhp2r0dcjvx", }; const unused = { address: "cosmos1cjsxept9rkggzxztslae9ndgpdyt2408lk850u", @@ -28,7 +32,23 @@ const initMsgHash = { symbol: "HASH", initial_balances: [ { - address: faucet.address, + address: faucet.address0, + amount: "11", + }, + { + address: faucet.address1, + amount: "11", + }, + { + address: faucet.address2, + amount: "11", + }, + { + address: faucet.address3, + amount: "11", + }, + { + address: faucet.address4, amount: "11", }, { @@ -47,7 +67,23 @@ const initMsgIsa = { symbol: "ISA", initial_balances: [ { - address: faucet.address, + address: faucet.address0, + amount: "999999999", + }, + { + address: faucet.address1, + amount: "999999999", + }, + { + address: faucet.address2, + amount: "999999999", + }, + { + address: faucet.address3, + amount: "999999999", + }, + { + address: faucet.address4, amount: "999999999", }, { @@ -62,7 +98,23 @@ const initMsgJade = { symbol: "JADE", initial_balances: [ { - address: faucet.address, + address: faucet.address0, + amount: "189189189000000000000000000", // 189189189 JADE + }, + { + address: faucet.address1, + amount: "189189189000000000000000000", // 189189189 JADE + }, + { + address: faucet.address2, + amount: "189189189000000000000000000", // 189189189 JADE + }, + { + address: faucet.address3, + amount: "189189189000000000000000000", // 189189189 JADE + }, + { + address: faucet.address4, amount: "189189189000000000000000000", // 189189189 JADE }, { @@ -74,7 +126,7 @@ const initMsgJade = { async function main() { const pen = await Secp256k1Pen.fromMnemonic(faucet.mnemonic); - const client = new SigningCosmWasmClient(httpUrl, faucet.address, (signBytes) => pen.sign(signBytes)); + const client = new SigningCosmWasmClient(httpUrl, faucet.address0, (signBytes) => pen.sign(signBytes)); const wasm = fs.readFileSync(__dirname + "/contracts/cw-erc20.wasm"); const uploadReceipt = await client.upload(wasm, codeMeta, "Upload ERC20 contract"); diff --git a/scripts/wasmd/generate_template.sh b/scripts/wasmd/generate_template.sh index 63eb9f80..fd9e8522 100755 --- a/scripts/wasmd/generate_template.sh +++ b/scripts/wasmd/generate_template.sh @@ -16,7 +16,9 @@ docker run --rm \ --mount type=bind,source="$SCRIPT_DIR/template",target=/root \ "$REPOSITORY:$VERSION" \ ./setup.sh \ - cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6 cosmos1cjsxept9rkggzxztslae9ndgpdyt2408lk850u cosmos17d0jcz59jf68g52vq38tuuncmwwjk42u6mcxej + cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6 cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5 cosmos1xy4yqngt0nlkdcenxymg8tenrghmek4nmqm28k cosmos142u9fgcjdlycfcez3lw8x6x5h7rfjlnfhpw2lx cosmos1hsm76p4ahyhl5yh3ve9ur49r5kemhp2r0dcjvx \ + cosmos1cjsxept9rkggzxztslae9ndgpdyt2408lk850u \ + cosmos17d0jcz59jf68g52vq38tuuncmwwjk42u6mcxej # The ./template folder is created by the docker daemon's user (root on Linux, current user # when using Docker Desktop on macOS), let's make it ours if needed diff --git a/scripts/wasmd/template/.wasmcli/cosmos1ea5cpmcj2vf5d0xwurncx7zdnmkuc6eql3wzfw.address b/scripts/wasmd/template/.wasmcli/cosmos1ea5cpmcj2vf5d0xwurncx7zdnmkuc6eql3wzfw.address new file mode 100644 index 00000000..8046d5cd --- /dev/null +++ b/scripts/wasmd/template/.wasmcli/cosmos1ea5cpmcj2vf5d0xwurncx7zdnmkuc6eql3wzfw.address @@ -0,0 +1 @@ +eyJhbGciOiJQQkVTMi1IUzI1NitBMTI4S1ciLCJjcmVhdGVkIjoiMjAyMC0wNS0wNyAwODozODoxNi40ODAzMjU3ICswMDAwIFVUQyBtPSswLjIyNDM1NjAwMSIsImVuYyI6IkEyNTZHQ00iLCJwMmMiOjgxOTIsInAycyI6IlFMeko4Q0F6ajBmWlBnZE8ifQ.7SBxLhnzZOmyPoIr83s8TXrHIJEBM0ejlF1Kr9fx_P5rfO822P3Deg.R_CIZSVj1I-wAqLr.IvSYNTrZl-h-itJKTjXnlFD_zrONKMVcxOP4S1rjCX10B-qwPFmmihf5mWVGYtg9F5DZ7_pw1UWUojd3943dfWDyZcLm5NQ5pPGiG1pmiFvcL1bQU7xUuJTfmyaY-jt_A1A05icIDHhnoJhfMRC1lMuEq-Jhel48KpVcN7x5-tHwLkPvLGa84gdjVwpAyApFqTKqOyAKftfwWx6ykAPN_6eNZ5g0jc45gcQdF75jlepHxnS3r302s6O9E4ac4gM.WW-84SVBxe5v_8o3Zh-ozg \ No newline at end of file diff --git a/scripts/wasmd/template/.wasmcli/cosmos1pmsqxz755ul9u7mm6naqr8z57vpwygzg4dr7ng.address b/scripts/wasmd/template/.wasmcli/cosmos1pmsqxz755ul9u7mm6naqr8z57vpwygzg4dr7ng.address deleted file mode 100644 index 0c9744ea..00000000 --- a/scripts/wasmd/template/.wasmcli/cosmos1pmsqxz755ul9u7mm6naqr8z57vpwygzg4dr7ng.address +++ /dev/null @@ -1 +0,0 @@ -eyJhbGciOiJQQkVTMi1IUzI1NitBMTI4S1ciLCJjcmVhdGVkIjoiMjAyMC0wMi0xOCAxNToxMjowNC4xMDQxNjI1ICswMDAwIFVUQyBtPSswLjMyMDEwNDEwMSIsImVuYyI6IkEyNTZHQ00iLCJwMmMiOjgxOTIsInAycyI6Ik5XdGp5MmZGR0RNV0xiTjIifQ.-kj99E7nORiGyJ7RzSDNlkA9VSZr2azZcBP8MWi1OfHxfyE5O0sw5A.F6v3B_uBKWw2ULK5.5R8ihTadacZcRL-qwRbAXIHfFqqg8sP_1_BuLQeGkKLBzV3buzeBNjNoh_4qtym1LJuzsIbof8wavzLL8MkBVINIW0Z9S2uS4_O759gEBCvnHv0hOd4iSfUI9MG8645PkZv6GNnC2ORYMAZJvUpnWHEZm7NRAHWj-dCdpthWX36Nj-UiibjnDN4bsCEtLmo6gbzOA-M85Y5Qyj0o3-l16X7triiqKzY9OZP8rAnx8RC3BxBR_9E9bWumJ5OdRw4.ZtcbN7CvBsCnH6G9UY5x6Q \ No newline at end of file diff --git a/scripts/wasmd/template/.wasmcli/keyhash b/scripts/wasmd/template/.wasmcli/keyhash index 5e2ac784..aedbe8b9 100755 --- a/scripts/wasmd/template/.wasmcli/keyhash +++ b/scripts/wasmd/template/.wasmcli/keyhash @@ -1 +1 @@ -$2a$10$KBpztuuiI6ifCrIwZV3dpOvJ.Wcv0D5NNQRDCCAkK5C9EzlAMAT/2 \ No newline at end of file +$2a$10$UJ32gZBsFnrfrTrpSTDpTOU2oXeWrTrJ3z.sKb.AYSL/aFCjlfZPy \ No newline at end of file diff --git a/scripts/wasmd/template/.wasmcli/validator.info b/scripts/wasmd/template/.wasmcli/validator.info index 2e4743bf..07149721 100644 --- a/scripts/wasmd/template/.wasmcli/validator.info +++ b/scripts/wasmd/template/.wasmcli/validator.info @@ -1 +1 @@ -eyJhbGciOiJQQkVTMi1IUzI1NitBMTI4S1ciLCJjcmVhdGVkIjoiMjAyMC0wMi0xOCAxNToxMjowNC4wNjIzNTQ0ICswMDAwIFVUQyBtPSswLjI3ODMwMTAwMSIsImVuYyI6IkEyNTZHQ00iLCJwMmMiOjgxOTIsInAycyI6InBTaWpUWjdZdWMzRUtIWmkifQ.7Eeibj2aQsJ6CFFqQc8IZCbNu7CyS3nbY2mD39Ipy-YsFxjecBUrfA.D04K3EtsF9wL_eqU.TKHX_2FqZ6QZTYs3FwavdSJWybVSngtS7K9awvS_GPxliB8XxMqmlpqUPO8B6nFjtAlE4NRgFAWhIUjf_GSzdS385RS14_bQ9zGajnVs3TBCCEP2c8SP7EImakkjnlGQ8u8gOMboB92tGEQIdPxQFGs7JmMzeJvk3LbAMgQAYnbUowLsdU3c5bUEIK5kyLqnUf7IgIjQfHzipJR227aQC-jjPSQ7QWmnM2EozQ7KFeKbL7m1uw4fhFGcajzpGkeS2p3UvY_q4EHJCX5VL1sqGIe-DFhcaw6ZqnePQl__LVtG-PBmVMLAGC3uYYbAb0hINHjnd9pNzqV-NaobSzFXi8Oi2QomYi9IDgdsoWwwQQnw6auO.QBap3Xg9mTu9I2tyFpzGIA \ No newline at end of file +eyJhbGciOiJQQkVTMi1IUzI1NitBMTI4S1ciLCJjcmVhdGVkIjoiMjAyMC0wNS0wNyAwODozODoxNi40NjY2MDA1ICswMDAwIFVUQyBtPSswLjIxMDYyOTQwMSIsImVuYyI6IkEyNTZHQ00iLCJwMmMiOjgxOTIsInAycyI6IkVHU3VZU2dOcXlYWDRPWTEifQ.Kbly0p7Z_07PNvdVDOs7uza9xA8kvxyR5VYpNiGWmNaG0G-b3Rr3UA.YQdmwWHZj9mwpFYa.EduAyotMKtLXF-wcCuceZTwFO-gKJvwFWeU5vj-BHkwsitav9g8o2Wg72Nl6XeHc_Mf4c2dKU9ewFtxG-az5W3A5oo7jO7h2JcR2dhPBBDdCwBHesabAZFnOwu2orQxHfpqKPRIY7-FloYm6DL08E4BL74yQxfcbG8PbgjXUruXa9AlpUvhlS_oNkrjJooGzMkndo4OxhAQn8VPHEkKo_8b0E33md-7eWxn5elKpyFBiPRY-hhUO7opTnoGyVO9FJPbQKLOFxs5-ujkljwv9SeAcpLuIEFWUcGlGIkgYnn20WE73T1p_HGTDAY0CGTJx_nH9fy6H6qmkzkmq82mZtxrb0dALtRxjuUPndV4V05CajFxP.k5d3ilCgkAgOD8pW0SRAYA \ No newline at end of file diff --git a/scripts/wasmd/template/.wasmd/config/genesis.json b/scripts/wasmd/template/.wasmd/config/genesis.json index 4e5bf893..befc7440 100644 --- a/scripts/wasmd/template/.wasmd/config/genesis.json +++ b/scripts/wasmd/template/.wasmd/config/genesis.json @@ -1,5 +1,5 @@ { - "genesis_time": "2020-02-18T15:12:03.6027603Z", + "genesis_time": "2020-05-07T08:38:16.2062323Z", "chain_id": "testing", "consensus_params": { "block": { @@ -19,16 +19,96 @@ }, "app_hash": "", "app_state": { - "slashing": { - "params": { - "signed_blocks_window": "100", - "min_signed_per_window": "0.500000000000000000", - "downtime_jail_duration": "600000000000", - "slash_fraction_double_sign": "0.050000000000000000", - "slash_fraction_downtime": "0.010000000000000000" + "crisis": { + "constant_fee": { + "denom": "ustake", + "amount": "1000" + } + }, + "params": null, + "gov": { + "starting_proposal_id": "1", + "deposits": null, + "votes": null, + "proposals": null, + "deposit_params": { + "min_deposit": [ + { + "denom": "ustake", + "amount": "10000000" + } + ], + "max_deposit_period": "172800000000000" }, - "signing_infos": {}, - "missed_blocks": {} + "voting_params": { + "voting_period": "172800000000000" + }, + "tally_params": { + "quorum": "0.334000000000000000", + "threshold": "0.500000000000000000", + "veto": "0.334000000000000000" + } + }, + "wasm": { + "codes": null, + "contracts": null + }, + "evidence": { + "params": { + "max_evidence_age": "120000000000" + }, + "evidence": [] + }, + "upgrade": {}, + "genutil": { + "gentxs": [ + { + "type": "cosmos-sdk/StdTx", + "value": { + "msg": [ + { + "type": "cosmos-sdk/MsgCreateValidator", + "value": { + "description": { + "moniker": "testing", + "identity": "", + "website": "", + "security_contact": "", + "details": "" + }, + "commission": { + "rate": "0.100000000000000000", + "max_rate": "0.200000000000000000", + "max_change_rate": "0.010000000000000000" + }, + "min_self_delegation": "1", + "delegator_address": "cosmos1ea5cpmcj2vf5d0xwurncx7zdnmkuc6eql3wzfw", + "validator_address": "cosmosvaloper1ea5cpmcj2vf5d0xwurncx7zdnmkuc6eq696h9a", + "pubkey": "cosmosvalconspub1zcjduepqmclspfdyzvncwpthrz9je2ap3pc9hnzf335uguxaf4xv4cd246jqv3360q", + "value": { + "denom": "ustake", + "amount": "250000000" + } + } + } + ], + "fee": { + "amount": [], + "gas": "200000" + }, + "signatures": [ + { + "pub_key": { + "type": "tendermint/PubKeySecp256k1", + "value": "A6BMOgVABSbSQfCTEE0FuVk5C3hEAs7+SskyD6cvwSh2" + }, + "signature": "qpCjRu0eGSyNLlMiT+HOli7r3GN/hPQPM1KmiE0eQlowllX3EGyBo0dj5r1MFsHKL98Q16wxUnsHZbzFtT3BAw==" + } + ], + "memo": "b1917ea1ed45b406564fb5c8adb531e4314f086c@172.17.0.3:26656" + } + } + ] }, "auth": { "params": { @@ -42,7 +122,7 @@ { "type": "cosmos-sdk/Account", "value": { - "address": "cosmos1pmsqxz755ul9u7mm6naqr8z57vpwygzg4dr7ng", + "address": "cosmos1ea5cpmcj2vf5d0xwurncx7zdnmkuc6eql3wzfw", "coins": [ { "denom": "ucosm", @@ -77,6 +157,82 @@ "sequence": 0 } }, + { + "type": "cosmos-sdk/Account", + "value": { + "address": "cosmos10dyr9899g6t0pelew4nvf4j5c3jcgv0r73qga5", + "coins": [ + { + "denom": "ucosm", + "amount": "1000000000" + }, + { + "denom": "ustake", + "amount": "1000000000" + } + ], + "public_key": "", + "account_number": 0, + "sequence": 0 + } + }, + { + "type": "cosmos-sdk/Account", + "value": { + "address": "cosmos1xy4yqngt0nlkdcenxymg8tenrghmek4nmqm28k", + "coins": [ + { + "denom": "ucosm", + "amount": "1000000000" + }, + { + "denom": "ustake", + "amount": "1000000000" + } + ], + "public_key": "", + "account_number": 0, + "sequence": 0 + } + }, + { + "type": "cosmos-sdk/Account", + "value": { + "address": "cosmos142u9fgcjdlycfcez3lw8x6x5h7rfjlnfhpw2lx", + "coins": [ + { + "denom": "ucosm", + "amount": "1000000000" + }, + { + "denom": "ustake", + "amount": "1000000000" + } + ], + "public_key": "", + "account_number": 0, + "sequence": 0 + } + }, + { + "type": "cosmos-sdk/Account", + "value": { + "address": "cosmos1hsm76p4ahyhl5yh3ve9ur49r5kemhp2r0dcjvx", + "coins": [ + { + "denom": "ucosm", + "amount": "1000000000" + }, + { + "denom": "ustake", + "amount": "1000000000" + } + ], + "public_key": "", + "account_number": 0, + "sequence": 0 + } + }, { "type": "cosmos-sdk/Account", "value": { @@ -117,124 +273,6 @@ } ] }, - "params": null, - "genutil": { - "gentxs": [ - { - "type": "cosmos-sdk/StdTx", - "value": { - "msg": [ - { - "type": "cosmos-sdk/MsgCreateValidator", - "value": { - "description": { - "moniker": "testing", - "identity": "", - "website": "", - "security_contact": "", - "details": "" - }, - "commission": { - "rate": "0.100000000000000000", - "max_rate": "0.200000000000000000", - "max_change_rate": "0.010000000000000000" - }, - "min_self_delegation": "1", - "delegator_address": "cosmos1pmsqxz755ul9u7mm6naqr8z57vpwygzg4dr7ng", - "validator_address": "cosmosvaloper1pmsqxz755ul9u7mm6naqr8z57vpwygzgsehtlm", - "pubkey": "cosmosvalconspub1zcjduepqsy5ztk6n6a78w9lhf8vew4fpylcgtlt989dfz84jhgmqy2qk0zjqesfvtx", - "value": { - "denom": "ustake", - "amount": "250000000" - } - } - } - ], - "fee": { - "amount": [], - "gas": "200000" - }, - "signatures": [ - { - "pub_key": { - "type": "tendermint/PubKeySecp256k1", - "value": "A/iVJJOJPgTk5Pb8YBfa1+x067H2FNMXZltax6K6YSx6" - }, - "signature": "YDNKqJwbCHvvvOAKdLFaQDdvdXI9Kweq6etRX0HVJcUFj1EANs2oJ48FvxlVA7H6lJJgxeB7rZvE+HPjdUhJwQ==" - } - ], - "memo": "c064858c45bd94c7ed875736014ae30dfc4cb232@172.17.0.11:26656" - } - } - ] - }, - "bank": { - "send_enabled": true - }, - "gov": { - "starting_proposal_id": "1", - "deposits": null, - "votes": null, - "proposals": null, - "deposit_params": { - "min_deposit": [ - { - "denom": "ustake", - "amount": "10000000" - } - ], - "max_deposit_period": "172800000000000" - }, - "voting_params": { - "voting_period": "172800000000000" - }, - "tally_params": { - "quorum": "0.334000000000000000", - "threshold": "0.500000000000000000", - "veto": "0.334000000000000000" - } - }, - "mint": { - "minter": { - "inflation": "0.130000000000000000", - "annual_provisions": "0.000000000000000000" - }, - "params": { - "mint_denom": "ustake", - "inflation_rate_change": "0.130000000000000000", - "inflation_max": "0.200000000000000000", - "inflation_min": "0.070000000000000000", - "goal_bonded": "0.670000000000000000", - "blocks_per_year": "6311520" - } - }, - "upgrade": {}, - "staking": { - "params": { - "unbonding_time": "1814400000000000", - "max_validators": 100, - "max_entries": 7, - "historical_entries": 0, - "bond_denom": "ustake" - }, - "last_total_power": "0", - "last_validator_powers": null, - "validators": null, - "delegations": null, - "unbonding_delegations": null, - "redelegations": null, - "exported": false - }, - "evidence": { - "params": { - "max_evidence_age": "120000000000" - }, - "evidence": [] - }, - "wasm": { - "codes": null, - "contracts": null - }, "distribution": { "params": { "community_tax": "0.020000000000000000", @@ -254,14 +292,52 @@ "delegator_starting_infos": [], "validator_slash_events": [] }, - "crisis": { - "constant_fee": { - "denom": "ustake", - "amount": "1000" - } + "slashing": { + "params": { + "signed_blocks_window": "100", + "min_signed_per_window": "0.500000000000000000", + "downtime_jail_duration": "600000000000", + "slash_fraction_double_sign": "0.050000000000000000", + "slash_fraction_downtime": "0.010000000000000000" + }, + "signing_infos": {}, + "missed_blocks": {} }, "supply": { "supply": [] + }, + "bank": { + "send_enabled": true + }, + "staking": { + "params": { + "unbonding_time": "1814400000000000", + "max_validators": 100, + "max_entries": 7, + "historical_entries": 0, + "bond_denom": "ustake" + }, + "last_total_power": "0", + "last_validator_powers": null, + "validators": null, + "delegations": null, + "unbonding_delegations": null, + "redelegations": null, + "exported": false + }, + "mint": { + "minter": { + "inflation": "0.130000000000000000", + "annual_provisions": "0.000000000000000000" + }, + "params": { + "mint_denom": "ustake", + "inflation_rate_change": "0.130000000000000000", + "inflation_max": "0.200000000000000000", + "inflation_min": "0.070000000000000000", + "goal_bonded": "0.670000000000000000", + "blocks_per_year": "6311520" + } } } } \ No newline at end of file diff --git a/scripts/wasmd/template/.wasmd/config/gentx/gentx-b1917ea1ed45b406564fb5c8adb531e4314f086c.json b/scripts/wasmd/template/.wasmd/config/gentx/gentx-b1917ea1ed45b406564fb5c8adb531e4314f086c.json new file mode 100644 index 00000000..dd03d5be --- /dev/null +++ b/scripts/wasmd/template/.wasmd/config/gentx/gentx-b1917ea1ed45b406564fb5c8adb531e4314f086c.json @@ -0,0 +1 @@ +{"type":"cosmos-sdk/StdTx","value":{"msg":[{"type":"cosmos-sdk/MsgCreateValidator","value":{"description":{"moniker":"testing","identity":"","website":"","security_contact":"","details":""},"commission":{"rate":"0.100000000000000000","max_rate":"0.200000000000000000","max_change_rate":"0.010000000000000000"},"min_self_delegation":"1","delegator_address":"cosmos1ea5cpmcj2vf5d0xwurncx7zdnmkuc6eql3wzfw","validator_address":"cosmosvaloper1ea5cpmcj2vf5d0xwurncx7zdnmkuc6eq696h9a","pubkey":"cosmosvalconspub1zcjduepqmclspfdyzvncwpthrz9je2ap3pc9hnzf335uguxaf4xv4cd246jqv3360q","value":{"denom":"ustake","amount":"250000000"}}}],"fee":{"amount":[],"gas":"200000"},"signatures":[{"pub_key":{"type":"tendermint/PubKeySecp256k1","value":"A6BMOgVABSbSQfCTEE0FuVk5C3hEAs7+SskyD6cvwSh2"},"signature":"qpCjRu0eGSyNLlMiT+HOli7r3GN/hPQPM1KmiE0eQlowllX3EGyBo0dj5r1MFsHKL98Q16wxUnsHZbzFtT3BAw=="}],"memo":"b1917ea1ed45b406564fb5c8adb531e4314f086c@172.17.0.3:26656"}} diff --git a/scripts/wasmd/template/.wasmd/config/gentx/gentx-c064858c45bd94c7ed875736014ae30dfc4cb232.json b/scripts/wasmd/template/.wasmd/config/gentx/gentx-c064858c45bd94c7ed875736014ae30dfc4cb232.json deleted file mode 100644 index 9bccfe4a..00000000 --- a/scripts/wasmd/template/.wasmd/config/gentx/gentx-c064858c45bd94c7ed875736014ae30dfc4cb232.json +++ /dev/null @@ -1 +0,0 @@ -{"type":"cosmos-sdk/StdTx","value":{"msg":[{"type":"cosmos-sdk/MsgCreateValidator","value":{"description":{"moniker":"testing","identity":"","website":"","security_contact":"","details":""},"commission":{"rate":"0.100000000000000000","max_rate":"0.200000000000000000","max_change_rate":"0.010000000000000000"},"min_self_delegation":"1","delegator_address":"cosmos1pmsqxz755ul9u7mm6naqr8z57vpwygzg4dr7ng","validator_address":"cosmosvaloper1pmsqxz755ul9u7mm6naqr8z57vpwygzgsehtlm","pubkey":"cosmosvalconspub1zcjduepqsy5ztk6n6a78w9lhf8vew4fpylcgtlt989dfz84jhgmqy2qk0zjqesfvtx","value":{"denom":"ustake","amount":"250000000"}}}],"fee":{"amount":[],"gas":"200000"},"signatures":[{"pub_key":{"type":"tendermint/PubKeySecp256k1","value":"A/iVJJOJPgTk5Pb8YBfa1+x067H2FNMXZltax6K6YSx6"},"signature":"YDNKqJwbCHvvvOAKdLFaQDdvdXI9Kweq6etRX0HVJcUFj1EANs2oJ48FvxlVA7H6lJJgxeB7rZvE+HPjdUhJwQ=="}],"memo":"c064858c45bd94c7ed875736014ae30dfc4cb232@172.17.0.11:26656"}} diff --git a/scripts/wasmd/template/.wasmd/config/node_key.json b/scripts/wasmd/template/.wasmd/config/node_key.json index 3b894be9..b3e0dc46 100644 --- a/scripts/wasmd/template/.wasmd/config/node_key.json +++ b/scripts/wasmd/template/.wasmd/config/node_key.json @@ -1 +1 @@ -{"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"dJxiYKRVk5sGYnadvNtXJeNwwJXL027GAhZxfEqKITiK63NC/mtK2p+Xk7o17FxV3bEZgAMHpdKCfUid+8k4Eg=="}} \ No newline at end of file +{"priv_key":{"type":"tendermint/PrivKeyEd25519","value":"W2C/2ngeYVSOA7CNZOMDtMbd7e24iOmST4Iucmn5gPvADvb3X/6+18V6T8MYmKZC6l1ix/+ifmJJrVrnVrfTww=="}} \ No newline at end of file diff --git a/scripts/wasmd/template/.wasmd/config/priv_validator_key.json b/scripts/wasmd/template/.wasmd/config/priv_validator_key.json index b8d56435..bf7e764b 100644 --- a/scripts/wasmd/template/.wasmd/config/priv_validator_key.json +++ b/scripts/wasmd/template/.wasmd/config/priv_validator_key.json @@ -1,11 +1,11 @@ { - "address": "D8004608AFC0F2022DA49EB200FE6950D0991C01", + "address": "8BB488F76BC08121E01A5EEC7EB041FB1BC1FE31", "pub_key": { "type": "tendermint/PubKeyEd25519", - "value": "gSgl21PXfHcX90nZl1UhJ/CF/WU5WpEesro2AigWeKQ=" + "value": "3j8ApaQTJ4cFdxiLLKuhiHBbzEmMacRw3U1MyuGqrqQ=" }, "priv_key": { "type": "tendermint/PrivKeyEd25519", - "value": "/drcoXTemHTY+V9UDuWVsEB+elJ6EKUdnIhAFjmJJ2eBKCXbU9d8dxf3SdmXVSEn8IX9ZTlakR6yujYCKBZ4pA==" + "value": "2E+x3h2DDfQ2X1fBaTVi9LQMzkbpTxWm0gEy8ZJECJDePwClpBMnhwV3GIssq6GIcFvMSYxpxHDdTUzK4aqupA==" } } \ No newline at end of file