diff --git a/packages/cosmwasm/src/cosmwasmclient.searchtx.spec.ts b/packages/cosmwasm/src/cosmwasmclient.searchtx.spec.ts index 6d902e95..be7f56ef 100644 --- a/packages/cosmwasm/src/cosmwasmclient.searchtx.spec.ts +++ b/packages/cosmwasm/src/cosmwasmclient.searchtx.spec.ts @@ -423,7 +423,7 @@ describe("CosmWasmClient.searchTx", () => { const first = fromOneElementArray(results[0].tx.value.msg); assert(isMsgInstantiateContract(first), "First contract search result must be an instantiation"); expect(first).toEqual({ - type: "wasm/instantiate", + type: "wasm/MsgInstantiateContract", value: { sender: alice.address0, code_id: deployedErc20.codeId.toString(), diff --git a/packages/cosmwasm/src/cosmwasmclient.spec.ts b/packages/cosmwasm/src/cosmwasmclient.spec.ts index 8873281c..8993909b 100644 --- a/packages/cosmwasm/src/cosmwasmclient.spec.ts +++ b/packages/cosmwasm/src/cosmwasmclient.spec.ts @@ -344,25 +344,6 @@ describe("CosmWasmClient", () => { creator: alice.address0, label: "HASH", admin: undefined, - initMsg: { - decimals: 5, - name: "Hash token", - symbol: "HASH", - initial_balances: jasmine.arrayContaining([ - { - address: alice.address0, - amount: "11", - }, - { - address: unused.address, - amount: "12812345", - }, - { - address: guest.address, - amount: "22004000000", - }, - ]), - }, }); }); diff --git a/packages/cosmwasm/src/cosmwasmclient.ts b/packages/cosmwasm/src/cosmwasmclient.ts index c16a8965..12c66d34 100644 --- a/packages/cosmwasm/src/cosmwasmclient.ts +++ b/packages/cosmwasm/src/cosmwasmclient.ts @@ -117,9 +117,10 @@ export interface Contract { readonly label: string; } -export interface ContractDetails extends Contract { - /** Argument passed on initialization of the contract */ - readonly initMsg: object; +export interface ContractCodeHistoryEntry { + readonly operation: string; + readonly codeId: number; + readonly msg: object; } export interface BlockHeader { @@ -389,7 +390,7 @@ export class CosmWasmClient { /** * Throws an error if no contract was found at the address */ - public async getContract(address: string): Promise { + public async getContract(address: string): Promise { const result = await this.lcdClient.wasm.getContractInfo(address); if (!result) throw new Error(`No contract found at address "${address}"`); return { @@ -398,9 +399,22 @@ export class CosmWasmClient { creator: result.creator, admin: result.admin, label: result.label, - initMsg: result.init_msg, }; } + /** + * Throws an error if no contract was found at the address + */ + public async getContractCodeHistory(address: string): Promise { + const result = await this.lcdClient.wasm.getContractCodeHistory(address); + if (!result) throw new Error(`No contract history found for address "${address}"`); + return result.map( + (entry): ContractCodeHistoryEntry => ({ + operation: entry.operation, + codeId: entry.code_id, + msg: entry.msg, + }), + ); + } /** * Returns the data at the key if present (raw contract dependent storage data) diff --git a/packages/cosmwasm/src/index.ts b/packages/cosmwasm/src/index.ts index e77ef6e9..eac6aba6 100644 --- a/packages/cosmwasm/src/index.ts +++ b/packages/cosmwasm/src/index.ts @@ -9,7 +9,6 @@ export { Code, CodeDetails, Contract, - ContractDetails, CosmWasmClient, GetSequenceResult, SearchByHeightQuery, diff --git a/packages/cosmwasm/src/lcdapi/wasm.spec.ts b/packages/cosmwasm/src/lcdapi/wasm.spec.ts index 868010a1..84f3e02f 100644 --- a/packages/cosmwasm/src/lcdapi/wasm.spec.ts +++ b/packages/cosmwasm/src/lcdapi/wasm.spec.ts @@ -52,7 +52,7 @@ async function uploadContract( ): Promise { const memo = "My first contract on chain"; const theMsg: MsgStoreCode = { - type: "wasm/store-code", + type: "wasm/MsgStoreCode", value: { sender: alice.address0, wasm_byte_code: toBase64(contract.data), @@ -86,7 +86,7 @@ async function instantiateContract( ): Promise { const memo = "Create an escrow instance"; const theMsg: MsgInstantiateContract = { - type: "wasm/instantiate", + type: "wasm/MsgInstantiateContract", value: { sender: alice.address0, code_id: codeId.toString(), @@ -123,7 +123,7 @@ async function executeContract( ): Promise { const memo = "Time for action"; const theMsg: MsgExecuteContract = { - type: "wasm/execute", + type: "wasm/MsgExecuteContract", value: { sender: alice.address0, contract: contractAddress, @@ -430,6 +430,56 @@ describe("wasm", () => { expect(await client.wasm.getContractInfo(nonExistentAddress)).toBeNull(); }); + it("can list contract history", async () => { + pendingWithoutWasmd(); + const wallet = await Secp256k1Wallet.fromMnemonic(alice.mnemonic); + const client = makeWasmClient(wasmd.endpoint); + const beneficiaryAddress = makeRandomAddress(); + const transferAmount: readonly Coin[] = [ + { + amount: "707707", + denom: "ucosm", + }, + ]; + + // reuse an existing contract, or upload if needed + let codeId: number; + const existingInfos = await client.wasm.listCodeInfo(); + if (existingInfos.length > 0) { + codeId = existingInfos[existingInfos.length - 1].id; + } else { + const uploadResult = await uploadContract(client, wallet, getHackatom()); + expect(uploadResult.code).toBeFalsy(); + const uploadLogs = parseLogs(uploadResult.logs); + const codeIdAttr = findAttribute(uploadLogs, "message", "code_id"); + codeId = Number.parseInt(codeIdAttr.value, 10); + } + + // create new instance and compare before and after + const result = await instantiateContract(client, wallet, codeId, beneficiaryAddress, transferAmount); + expect(result.code).toBeFalsy(); + const logs = parseLogs(result.logs); + const contractAddressAttr = findAttribute(logs, "message", "contract_address"); + const myAddress = contractAddressAttr.value; + + // check out history + const myHistory = await client.wasm.getContractCodeHistory(myAddress); + assert(myHistory); + expect(myHistory).toEqual( + jasmine.objectContaining({ + codeId: codeId, + operation: "Init", + msg: { + verifier: alice.address0, + beneficiary: beneficiaryAddress, + }, + }), + ); + // make sure random addresses don't give useful info + const nonExistentAddress = makeRandomAddress(); + expect(await client.wasm.getContractCodeHistory(nonExistentAddress)).toBeNull(); + }); + describe("contract state", () => { const client = makeWasmClient(wasmd.endpoint); const noContract = makeRandomAddress(); diff --git a/packages/cosmwasm/src/lcdapi/wasm.ts b/packages/cosmwasm/src/lcdapi/wasm.ts index 060e99fd..a4004f7e 100644 --- a/packages/cosmwasm/src/lcdapi/wasm.ts +++ b/packages/cosmwasm/src/lcdapi/wasm.ts @@ -52,9 +52,12 @@ export interface ContractInfo { readonly label: string; } -export interface ContractDetails extends ContractInfo { - /** Argument passed on initialization of the contract */ - readonly init_msg: object; +// An entry in the contracts code/ migration history +export interface ContractCodeHistoryEntry { + // operation can be "Init", "Migrate", "Genesis" + readonly operation: string; + readonly code_id: number; + readonly msg: object; } interface SmartQueryResponse { @@ -92,7 +95,7 @@ export interface WasmExtension { /** * Returns null when contract was not found at this address. */ - readonly getContractInfo: (address: string) => Promise; + readonly getContractInfo: (address: string) => Promise; /** * Returns all contract state. @@ -111,6 +114,11 @@ export interface WasmExtension { * Throws error if no such contract exists, the query format is invalid or the response is invalid. */ readonly queryContractSmart: (address: string, query: object) => Promise; + + /** + * Returns null when contract history was not found for this address. + */ + readonly getContractCodeHistory: (address: string) => Promise; }; } @@ -134,7 +142,12 @@ export function setupWasmExtension(base: LcdClient): WasmExtension { }, getContractInfo: async (address: string) => { const path = `/wasm/contract/${address}`; - const response = (await base.get(path)) as WasmResponse; + const response = (await base.get(path)) as WasmResponse; + return unwrapWasmResponse(response); + }, + getContractCodeHistory: async (address: string) => { + const path = `/wasm/contract/${address}/history`; + const response = (await base.get(path)) as WasmResponse; return unwrapWasmResponse(response); }, getAllContractState: async (address: string) => { diff --git a/packages/cosmwasm/src/msgs.ts b/packages/cosmwasm/src/msgs.ts index eef9bb0e..c8d02ed0 100644 --- a/packages/cosmwasm/src/msgs.ts +++ b/packages/cosmwasm/src/msgs.ts @@ -8,7 +8,7 @@ import { Coin, Msg } from "@cosmjs/sdk38"; * @see https://github.com/CosmWasm/wasmd/blob/v0.9.0-alpha4/x/wasm/internal/types/msg.go#L34 */ export interface MsgStoreCode extends Msg { - readonly type: "wasm/store-code"; + readonly type: "wasm/MsgStoreCode"; readonly value: { /** Bech32 account address */ readonly sender: string; @@ -22,7 +22,7 @@ export interface MsgStoreCode extends Msg { } export function isMsgStoreCode(msg: Msg): msg is MsgStoreCode { - return (msg as MsgStoreCode).type === "wasm/store-code"; + return (msg as MsgStoreCode).type === "wasm/MsgStoreCode"; } /** @@ -32,7 +32,7 @@ export function isMsgStoreCode(msg: Msg): msg is MsgStoreCode { * @see https://github.com/CosmWasm/wasmd/blob/v0.9.0-alpha4/x/wasm/internal/types/msg.go#L104 */ export interface MsgInstantiateContract extends Msg { - readonly type: "wasm/instantiate"; + readonly type: "wasm/MsgInstantiateContract"; readonly value: { /** Bech32 account address */ readonly sender: string; @@ -49,7 +49,7 @@ export interface MsgInstantiateContract extends Msg { } export function isMsgInstantiateContract(msg: Msg): msg is MsgInstantiateContract { - return (msg as MsgInstantiateContract).type === "wasm/instantiate"; + return (msg as MsgInstantiateContract).type === "wasm/MsgInstantiateContract"; } /** @@ -58,7 +58,7 @@ export function isMsgInstantiateContract(msg: Msg): msg is MsgInstantiateContrac * @see https://github.com/CosmWasm/wasmd/blob/v0.9.0-beta/x/wasm/internal/types/msg.go#L231 */ export interface MsgUpdateAdmin extends Msg { - readonly type: "wasm/update-contract-admin"; + readonly type: "wasm/MsgUpdateAdmin"; readonly value: { /** Bech32-encoded sender address. This must be the old admin. */ readonly sender: string; @@ -70,7 +70,7 @@ export interface MsgUpdateAdmin extends Msg { } export function isMsgUpdateAdmin(msg: Msg): msg is MsgUpdateAdmin { - return (msg as MsgUpdateAdmin).type === "wasm/update-contract-admin"; + return (msg as MsgUpdateAdmin).type === "wasm/MsgUpdateAdmin"; } /** @@ -79,7 +79,7 @@ export function isMsgUpdateAdmin(msg: Msg): msg is MsgUpdateAdmin { * @see https://github.com/CosmWasm/wasmd/blob/v0.9.0-beta/x/wasm/internal/types/msg.go#L269 */ export interface MsgClearAdmin extends Msg { - readonly type: "wasm/clear-contract-admin"; + readonly type: "wasm/MsgClearAdmin"; readonly value: { /** Bech32-encoded sender address. This must be the old admin. */ readonly sender: string; @@ -89,7 +89,7 @@ export interface MsgClearAdmin extends Msg { } export function isMsgClearAdmin(msg: Msg): msg is MsgClearAdmin { - return (msg as MsgClearAdmin).type === "wasm/clear-contract-admin"; + return (msg as MsgClearAdmin).type === "wasm/MsgClearAdmin"; } /** @@ -99,7 +99,7 @@ export function isMsgClearAdmin(msg: Msg): msg is MsgClearAdmin { * @see https://github.com/CosmWasm/wasmd/blob/v0.9.0-alpha4/x/wasm/internal/types/msg.go#L158 */ export interface MsgExecuteContract extends Msg { - readonly type: "wasm/execute"; + readonly type: "wasm/MsgExecuteContract"; readonly value: { /** Bech32 account address */ readonly sender: string; @@ -112,7 +112,7 @@ export interface MsgExecuteContract extends Msg { } export function isMsgExecuteContract(msg: Msg): msg is MsgExecuteContract { - return (msg as MsgExecuteContract).type === "wasm/execute"; + return (msg as MsgExecuteContract).type === "wasm/MsgExecuteContract"; } /** @@ -121,7 +121,7 @@ export function isMsgExecuteContract(msg: Msg): msg is MsgExecuteContract { * @see https://github.com/CosmWasm/wasmd/blob/v0.9.0-alpha4/x/wasm/internal/types/msg.go#L195 */ export interface MsgMigrateContract extends Msg { - readonly type: "wasm/migrate"; + readonly type: "wasm/MsgMigrateContract"; readonly value: { /** Bech32 account address */ readonly sender: string; @@ -135,5 +135,5 @@ export interface MsgMigrateContract extends Msg { } export function isMsgMigrateContract(msg: Msg): msg is MsgMigrateContract { - return (msg as MsgMigrateContract).type === "wasm/migrate"; + return (msg as MsgMigrateContract).type === "wasm/MsgMigrateContract"; } diff --git a/packages/cosmwasm/src/signingcosmwasmclient.ts b/packages/cosmwasm/src/signingcosmwasmclient.ts index 83715b26..392327ce 100644 --- a/packages/cosmwasm/src/signingcosmwasmclient.ts +++ b/packages/cosmwasm/src/signingcosmwasmclient.ts @@ -208,7 +208,7 @@ export class SigningCosmWasmClient extends CosmWasmClient { const compressed = pako.gzip(wasmCode, { level: 9 }); const storeCodeMsg: MsgStoreCode = { - type: "wasm/store-code", + type: "wasm/MsgStoreCode", value: { sender: this.senderAddress, wasm_byte_code: toBase64(compressed), @@ -239,7 +239,7 @@ export class SigningCosmWasmClient extends CosmWasmClient { options: InstantiateOptions = {}, ): Promise { const instantiateMsg: MsgInstantiateContract = { - type: "wasm/instantiate", + type: "wasm/MsgInstantiateContract", value: { sender: this.senderAddress, code_id: new Uint53(codeId).toString(), @@ -263,7 +263,7 @@ export class SigningCosmWasmClient extends CosmWasmClient { public async updateAdmin(contractAddress: string, newAdmin: string, memo = ""): Promise { const updateAdminMsg: MsgUpdateAdmin = { - type: "wasm/update-contract-admin", + type: "wasm/MsgUpdateAdmin", value: { sender: this.senderAddress, contract: contractAddress, @@ -282,7 +282,7 @@ export class SigningCosmWasmClient extends CosmWasmClient { public async clearAdmin(contractAddress: string, memo = ""): Promise { const clearAdminMsg: MsgClearAdmin = { - type: "wasm/clear-contract-admin", + type: "wasm/MsgClearAdmin", value: { sender: this.senderAddress, contract: contractAddress, @@ -305,7 +305,7 @@ export class SigningCosmWasmClient extends CosmWasmClient { memo = "", ): Promise { const msg: MsgMigrateContract = { - type: "wasm/migrate", + type: "wasm/MsgMigrateContract", value: { sender: this.senderAddress, contract: contractAddress, @@ -330,7 +330,7 @@ export class SigningCosmWasmClient extends CosmWasmClient { transferAmount?: readonly Coin[], ): Promise { const executeMsg: MsgExecuteContract = { - type: "wasm/execute", + type: "wasm/MsgExecuteContract", value: { sender: this.senderAddress, contract: contractAddress, diff --git a/packages/cosmwasm/types/cosmwasmclient.d.ts b/packages/cosmwasm/types/cosmwasmclient.d.ts index ed3b6689..6fb051bd 100644 --- a/packages/cosmwasm/types/cosmwasmclient.d.ts +++ b/packages/cosmwasm/types/cosmwasmclient.d.ts @@ -84,9 +84,10 @@ export interface Contract { readonly admin: string | undefined; readonly label: string; } -export interface ContractDetails extends Contract { - /** Argument passed on initialization of the contract */ - readonly initMsg: object; +export interface ContractCodeHistoryEntry { + readonly operation: string; + readonly codeId: number; + readonly msg: object; } export interface BlockHeader { readonly version: { @@ -154,7 +155,11 @@ export declare class CosmWasmClient { /** * Throws an error if no contract was found at the address */ - getContract(address: string): Promise; + getContract(address: string): Promise; + /** + * Throws an error if no contract was found at the address + */ + getContractCodeHistory(address: string): Promise; /** * Returns the data at the key if present (raw contract dependent storage data) * or null if no data at this key. diff --git a/packages/cosmwasm/types/index.d.ts b/packages/cosmwasm/types/index.d.ts index 517e261b..dc587558 100644 --- a/packages/cosmwasm/types/index.d.ts +++ b/packages/cosmwasm/types/index.d.ts @@ -8,7 +8,6 @@ export { Code, CodeDetails, Contract, - ContractDetails, CosmWasmClient, GetSequenceResult, SearchByHeightQuery, diff --git a/packages/cosmwasm/types/lcdapi/wasm.d.ts b/packages/cosmwasm/types/lcdapi/wasm.d.ts index 4f3b06a1..8c755270 100644 --- a/packages/cosmwasm/types/lcdapi/wasm.d.ts +++ b/packages/cosmwasm/types/lcdapi/wasm.d.ts @@ -33,9 +33,10 @@ export interface ContractInfo { readonly admin?: string; readonly label: string; } -export interface ContractDetails extends ContractInfo { - /** Argument passed on initialization of the contract */ - readonly init_msg: object; +export interface ContractCodeHistoryEntry { + readonly operation: string; + readonly code_id: number; + readonly msg: object; } /** * @see https://github.com/cosmwasm/wasmd/blob/master/x/wasm/client/rest/query.go#L19-L27 @@ -53,7 +54,7 @@ export interface WasmExtension { /** * Returns null when contract was not found at this address. */ - readonly getContractInfo: (address: string) => Promise; + readonly getContractInfo: (address: string) => Promise; /** * Returns all contract state. * This is an empty array if no such contract, or contract has no data. @@ -69,6 +70,10 @@ export interface WasmExtension { * Throws error if no such contract exists, the query format is invalid or the response is invalid. */ readonly queryContractSmart: (address: string, query: object) => Promise; + /** + * Returns null when contract history was not found for this address. + */ + readonly getContractCodeHistory: (address: string) => Promise; }; } export declare function setupWasmExtension(base: LcdClient): WasmExtension; diff --git a/packages/cosmwasm/types/msgs.d.ts b/packages/cosmwasm/types/msgs.d.ts index 5250100b..8a72e4c9 100644 --- a/packages/cosmwasm/types/msgs.d.ts +++ b/packages/cosmwasm/types/msgs.d.ts @@ -6,7 +6,7 @@ import { Coin, Msg } from "@cosmjs/sdk38"; * @see https://github.com/CosmWasm/wasmd/blob/v0.9.0-alpha4/x/wasm/internal/types/msg.go#L34 */ export interface MsgStoreCode extends Msg { - readonly type: "wasm/store-code"; + readonly type: "wasm/MsgStoreCode"; readonly value: { /** Bech32 account address */ readonly sender: string; @@ -26,7 +26,7 @@ export declare function isMsgStoreCode(msg: Msg): msg is MsgStoreCode; * @see https://github.com/CosmWasm/wasmd/blob/v0.9.0-alpha4/x/wasm/internal/types/msg.go#L104 */ export interface MsgInstantiateContract extends Msg { - readonly type: "wasm/instantiate"; + readonly type: "wasm/MsgInstantiateContract"; readonly value: { /** Bech32 account address */ readonly sender: string; @@ -48,7 +48,7 @@ export declare function isMsgInstantiateContract(msg: Msg): msg is MsgInstantiat * @see https://github.com/CosmWasm/wasmd/blob/v0.9.0-beta/x/wasm/internal/types/msg.go#L231 */ export interface MsgUpdateAdmin extends Msg { - readonly type: "wasm/update-contract-admin"; + readonly type: "wasm/MsgUpdateAdmin"; readonly value: { /** Bech32-encoded sender address. This must be the old admin. */ readonly sender: string; @@ -65,7 +65,7 @@ export declare function isMsgUpdateAdmin(msg: Msg): msg is MsgUpdateAdmin; * @see https://github.com/CosmWasm/wasmd/blob/v0.9.0-beta/x/wasm/internal/types/msg.go#L269 */ export interface MsgClearAdmin extends Msg { - readonly type: "wasm/clear-contract-admin"; + readonly type: "wasm/MsgClearAdmin"; readonly value: { /** Bech32-encoded sender address. This must be the old admin. */ readonly sender: string; @@ -81,7 +81,7 @@ export declare function isMsgClearAdmin(msg: Msg): msg is MsgClearAdmin; * @see https://github.com/CosmWasm/wasmd/blob/v0.9.0-alpha4/x/wasm/internal/types/msg.go#L158 */ export interface MsgExecuteContract extends Msg { - readonly type: "wasm/execute"; + readonly type: "wasm/MsgExecuteContract"; readonly value: { /** Bech32 account address */ readonly sender: string; @@ -99,7 +99,7 @@ export declare function isMsgExecuteContract(msg: Msg): msg is MsgExecuteContrac * @see https://github.com/CosmWasm/wasmd/blob/v0.9.0-alpha4/x/wasm/internal/types/msg.go#L195 */ export interface MsgMigrateContract extends Msg { - readonly type: "wasm/migrate"; + readonly type: "wasm/MsgMigrateContract"; readonly value: { /** Bech32 account address */ readonly sender: string; diff --git a/scripts/wasmd/.gaiacli/config/config.toml b/scripts/wasmd/.gaiacli/config/config.toml deleted file mode 100644 index a87339da..00000000 --- a/scripts/wasmd/.gaiacli/config/config.toml +++ /dev/null @@ -1,3 +0,0 @@ -chain-id = "testing" -node = "tcp://localhost:46657" -trust-node = true diff --git a/scripts/wasmd/.gaiad/config/addrbook.json b/scripts/wasmd/.gaiad/config/addrbook.json deleted file mode 100644 index 852eb97d..00000000 --- a/scripts/wasmd/.gaiad/config/addrbook.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "key": "84524d4c173831437f628f5d", - "addrs": [] -} \ No newline at end of file diff --git a/scripts/wasmd/.gaiad/config/app.toml b/scripts/wasmd/.gaiad/config/app.toml deleted file mode 100644 index 5b42ddfe..00000000 --- a/scripts/wasmd/.gaiad/config/app.toml +++ /dev/null @@ -1,24 +0,0 @@ -# This is a TOML config file. -# For more information, see https://github.com/toml-lang/toml - -##### main base config options ##### - -# The minimum gas prices a validator is willing to accept for processing a -# transaction. A transaction's fees must meet the minimum of any denomination -# specified in this config (e.g. 0.25token1;0.0001token2). -minimum-gas-prices = "" - -# HaltHeight contains a non-zero block height at which a node will gracefully -# halt and shutdown that can be used to assist upgrades and testing. -# -# Note: State will not be committed on the corresponding height and any logs -# indicating such can be safely ignored. -halt-height = 0 - -# HaltTime contains a non-zero minimum block time (in Unix seconds) at which -# a node will gracefully halt and shutdown that can be used to assist upgrades -# and testing. -# -# Note: State will not be committed on the corresponding height and any logs -# indicating such can be safely ignored. -halt-time = 0 diff --git a/scripts/wasmd/.gaiad/config/config.toml b/scripts/wasmd/.gaiad/config/config.toml deleted file mode 100644 index 061e5b40..00000000 --- a/scripts/wasmd/.gaiad/config/config.toml +++ /dev/null @@ -1,312 +0,0 @@ -# This is a TOML config file. -# For more information, see https://github.com/toml-lang/toml - -##### 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 -proxy_app = "tcp://127.0.0.1:26658" - -# A custom human readable name for this node -moniker = "testing" - -# If this node is many blocks behind the tip of the chain, FastSync -# allows them to catchup quickly by downloading blocks in parallel -# and verifying their commits -fast_sync = true - -# Database backend: goleveldb | cleveldb | boltdb -# * goleveldb (github.com/syndtr/goleveldb - most popular implementation) -# - pure go -# - stable -# * cleveldb (uses levigo wrapper) -# - fast -# - requires gcc -# - use cleveldb build tag (go build -tags cleveldb) -# * boltdb (uses etcd's fork of bolt - github.com/etcd-io/bbolt) -# - EXPERIMENTAL -# - may be faster is some use-cases (random reads - indexer) -# - use boltdb build tag (go build -tags boltdb) -db_backend = "goleveldb" - -# Database directory -db_dir = "data" - -# Output level for logging, including package level options -log_level = "main:info,state:info,*:error" - -# Output format: 'plain' (colored text) or 'json' -log_format = "plain" - -##### additional base config options ##### - -# Path to the JSON file containing the initial validator set and other meta data -genesis_file = "config/genesis.json" - -# Path to the JSON file containing the private key to use as a validator in the consensus protocol -priv_validator_key_file = "config/priv_validator_key.json" - -# Path to the JSON file containing the last sign state of a validator -priv_validator_state_file = "data/priv_validator_state.json" - -# TCP or UNIX socket address for Tendermint to listen on for -# connections from an external PrivValidator process -priv_validator_laddr = "" - -# Path to the JSON file containing the private key to use for node authentication in the p2p protocol -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 ##### -[rpc] - -# TCP or UNIX socket address for the RPC server to listen on -laddr = "tcp://127.0.0.1:26657" - -# A list of origins a cross-domain request can be executed from -# Default value '[]' disables cors support -# Use '["*"]' to allow any origin -cors_allowed_origins = [] - -# A list of methods the client is allowed to use with cross-domain requests -cors_allowed_methods = ["HEAD", "GET", "POST", ] - -# A list of non simple headers the client is allowed to use with cross-domain requests -cors_allowed_headers = ["Origin", "Accept", "Content-Type", "X-Requested-With", "X-Server-Time", ] - -# TCP or UNIX socket address for the gRPC server to listen on -# NOTE: This server only supports /broadcast_tx_commit -grpc_laddr = "" - -# Maximum number of simultaneous connections. -# Does not include RPC (HTTP&WebSocket) connections. See max_open_connections -# If you want to accept a larger number than the default, make sure -# you increase your OS limits. -# 0 - unlimited. -# Should be < {ulimit -Sn} - {MaxNumInboundPeers} - {MaxNumOutboundPeers} - {N of wal, db and other open files} -# 1024 - 40 - 10 - 50 = 924 = ~900 -grpc_max_open_connections = 900 - -# Activate unsafe RPC commands like /dial_seeds and /unsafe_flush_mempool -unsafe = false - -# Maximum number of simultaneous connections (including WebSocket). -# Does not include gRPC connections. See grpc_max_open_connections -# If you want to accept a larger number than the default, make sure -# you increase your OS limits. -# 0 - unlimited. -# Should be < {ulimit -Sn} - {MaxNumInboundPeers} - {MaxNumOutboundPeers} - {N of wal, db and other open files} -# 1024 - 40 - 10 - 50 = 924 = ~900 -max_open_connections = 900 - -# Maximum number of unique clientIDs that can /subscribe -# If you're using /broadcast_tx_commit, set to the estimated maximum number -# of broadcast_tx_commit calls per block. -max_subscription_clients = 100 - -# Maximum number of unique queries a given client can /subscribe to -# If you're using GRPC (or Local RPC client) and /broadcast_tx_commit, set to -# the estimated # maximum number of broadcast_tx_commit calls per block. -max_subscriptions_per_client = 5 - -# How long to wait for a tx to be committed during /broadcast_tx_commit. -# WARNING: Using a value larger than 10s will result in increasing the -# global HTTP write timeout, which applies to all connections and endpoints. -# See https://github.com/tendermint/tendermint/issues/3435 -timeout_broadcast_tx_commit = "10s" - -# Maximum size of request body, in bytes -max_body_bytes = 1000000 - -# Maximum size of request header, in bytes -max_header_bytes = 1048576 - -# The path to a file containing certificate that is used to create the HTTPS server. -# Migth be either absolute path or path related to tendermint's config directory. -# If the certificate is signed by a certificate authority, -# the certFile should be the concatenation of the server's certificate, any intermediates, -# and the CA's certificate. -# NOTE: both tls_cert_file and tls_key_file must be present for Tendermint to create HTTPS server. Otherwise, HTTP server is run. -tls_cert_file = "" - -# The path to a file containing matching private key that is used to create the HTTPS server. -# Migth be either absolute path or path related to tendermint's config directory. -# NOTE: both tls_cert_file and tls_key_file must be present for Tendermint to create HTTPS server. Otherwise, HTTP server is run. -tls_key_file = "" - -##### peer to peer configuration options ##### -[p2p] - -# Address to listen for incoming connections -laddr = "tcp://0.0.0.0:26656" - -# Address to advertise to peers for them to dial -# If empty, will use the same port as the laddr, -# and will introspect on the listener or use UPnP -# to figure out the address. -external_address = "" - -# Comma separated list of seed nodes to connect to -seeds = "" - -# Comma separated list of nodes to keep persistent connections to -persistent_peers = "" - -# UPNP port forwarding -upnp = false - -# Path to address book -addr_book_file = "config/addrbook.json" - -# Set true for strict address routability rules -# Set false for private or local networks -addr_book_strict = true - -# Maximum number of inbound peers -max_num_inbound_peers = 40 - -# Maximum number of outbound peers to connect to, excluding persistent peers -max_num_outbound_peers = 10 - -# Time to wait before flushing messages out on the connection -flush_throttle_timeout = "100ms" - -# Maximum size of a message packet payload, in bytes -max_packet_msg_payload_size = 1024 - -# Rate at which packets can be sent, in bytes/second -send_rate = 5120000 - -# Rate at which packets can be received, in bytes/second -recv_rate = 5120000 - -# Set true to enable the peer-exchange reactor -pex = true - -# Seed mode, in which node constantly crawls the network and looks for -# peers. If another node asks it for addresses, it responds and disconnects. -# -# Does not work if the peer-exchange reactor is disabled. -seed_mode = false - -# Comma separated list of peer IDs to keep private (will not be gossiped to other peers) -private_peer_ids = "" - -# Toggle to disable guard against peers connecting from the same ip. -allow_duplicate_ip = false - -# Peer connection configuration. -handshake_timeout = "20s" -dial_timeout = "3s" - -##### mempool configuration options ##### -[mempool] - -recheck = true -broadcast = true -wal_dir = "" - -# Maximum number of transactions in the mempool -size = 5000 - -# Limit the total size of all txs in the mempool. -# This only accounts for raw transactions (e.g. given 1MB transactions and -# max_txs_bytes=5MB, mempool will only accept 5 transactions). -max_txs_bytes = 1073741824 - -# Size of the cache (used to filter transactions we saw earlier) in transactions -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}. -max_tx_bytes = 1048576 - -##### fast sync configuration options ##### -[fastsync] - -# Fast Sync version to use: -# 1) "v0" (default) - the legacy fast sync implementation -# 2) "v1" - refactor of v0 version for better testability -version = "v0" - -##### consensus configuration options ##### -[consensus] - -wal_file = "data/cs.wal/wal" - -timeout_propose = "3s" -timeout_propose_delta = "500ms" -timeout_prevote = "1s" -timeout_prevote_delta = "500ms" -timeout_precommit = "1s" -timeout_precommit_delta = "500ms" -timeout_commit = "5s" - -# Make progress as soon as we have all the precommits (as if TimeoutCommit = 0) -skip_timeout_commit = false - -# EmptyBlocks mode and possible interval between empty blocks -create_empty_blocks = true -create_empty_blocks_interval = "0s" - -# Reactor sleep duration parameters -peer_gossip_sleep_duration = "100ms" -peer_query_maj23_sleep_duration = "2s" - -##### transactions indexer configuration options ##### -[tx_index] - -# What indexer to use for transactions -# -# Options: -# 1) "null" -# 2) "kv" (default) - the simplest possible indexer, backed by key-value storage (defaults to levelDB; see DBBackend). -indexer = "kv" - -# Comma-separated list of tags to index (by default the only tag is "tx.hash") -# -# You can also index transactions by height by adding "tx.height" tag here. -# -# It's recommended to index only a subset of tags due to possible memory -# bloat. This is, of course, depends on the indexer's DB and the volume of -# transactions. -index_tags = "" - -# When set to true, tells indexer to index all tags (predefined tags: -# "tx.hash", "tx.height" and all tags from DeliverTx responses). -# -# Note this may be not desirable (see the comment above). IndexTags has a -# precedence over IndexAllTags (i.e. when given both, IndexTags will be -# indexed). -index_all_tags = true - -##### instrumentation configuration options ##### -[instrumentation] - -# When true, Prometheus metrics are served under /metrics on -# PrometheusListenAddr. -# Check out the documentation for the list of available metrics. -prometheus = false - -# Address to listen for Prometheus collector(s) connections -prometheus_listen_addr = ":26660" - -# Maximum number of simultaneous connections. -# If you want to accept a larger number than the default, make sure -# you increase your OS limits. -# 0 - unlimited. -max_open_connections = 3 - -# Instrumentation namespace -namespace = "tendermint" diff --git a/scripts/wasmd/.gaiad/config/genesis.json b/scripts/wasmd/.gaiad/config/genesis.json deleted file mode 100644 index e2a008c2..00000000 --- a/scripts/wasmd/.gaiad/config/genesis.json +++ /dev/null @@ -1,196 +0,0 @@ -{ - "genesis_time": "2019-09-26T13:28:58.047804Z", - "chain_id": "testing", - "consensus_params": { - "block": { - "max_bytes": "22020096", - "max_gas": "-1", - "time_iota_ms": "1000" - }, - "evidence": { - "max_age": "100000" - }, - "validator": { - "pub_key_types": ["ed25519"] - } - }, - "app_hash": "", - "app_state": { - "bank": { - "send_enabled": true - }, - "genutil": { - "gentxs": [ - { - "type": "cosmos-sdk/StdTx", - "value": { - "msg": [ - { - "type": "cosmos-sdk/MsgCreateValidator", - "value": { - "description": { - "moniker": "testing", - "identity": "", - "website": "", - "details": "" - }, - "commission": { - "rate": "0.100000000000000000", - "max_rate": "0.200000000000000000", - "max_change_rate": "0.010000000000000000" - }, - "min_self_delegation": "1", - "delegator_address": "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6", - "validator_address": "cosmosvaloper1pkptre7fdkl6gfrzlesjjvhxhlc3r4gm7znkuf", - "pubkey": "cosmosvalconspub1zcjduepqmktrr4rjkp8lje2lxcpdkf27tpyfv8w74czsasvthr3qc4encahsj85lva", - "value": { - "denom": "stake", - "amount": "100000000" - } - } - } - ], - "fee": { - "amount": [], - "gas": "200000" - }, - "signatures": [ - { - "pub_key": { - "type": "tendermint/PubKeySecp256k1", - "value": "A08EGB7ro1ORuFhjOnZcSgwYlpe0DSFjVNUIkNNQxwKQ" - }, - "signature": "7yxA/j9y58XGRMv336J75p8CCfCDtslpr0hk9FA2GCIsvqgimwrUJ2sXMPbkx6EYj7gpvrrPZ9MY6pnIC2M9YQ==" - } - ], - "memo": "223aedddd9442bcf16641858ca85837f27997d0d@192.168.178.20:26656" - } - } - ] - }, - "auth": { - "params": { - "max_memo_characters": "256", - "tx_sig_limit": "7", - "tx_size_cost_per_byte": "10", - "sig_verify_cost_ed25519": "590", - "sig_verify_cost_secp256k1": "1000" - } - }, - "slashing": { - "params": { - "max_evidence_age": "120000000000", - "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": {} - }, - "mint": { - "minter": { - "inflation": "0.130000000000000000", - "annual_provisions": "0.000000000000000000" - }, - "params": { - "mint_denom": "stake", - "inflation_rate_change": "0.130000000000000000", - "inflation_max": "0.200000000000000000", - "inflation_min": "0.070000000000000000", - "goal_bonded": "0.670000000000000000", - "blocks_per_year": "6311520" - } - }, - "staking": { - "params": { - "unbonding_time": "1814400000000000", - "max_validators": 100, - "max_entries": 7, - "bond_denom": "stake" - }, - "last_total_power": "0", - "last_validator_powers": null, - "validators": null, - "delegations": null, - "unbonding_delegations": null, - "redelegations": null, - "exported": false - }, - "distribution": { - "fee_pool": { - "community_pool": [] - }, - "community_tax": "0.020000000000000000", - "base_proposer_reward": "0.010000000000000000", - "bonus_proposer_reward": "0.040000000000000000", - "withdraw_addr_enabled": true, - "delegator_withdraw_infos": [], - "previous_proposer": "", - "outstanding_rewards": [], - "validator_accumulated_commissions": [], - "validator_historical_rewards": [], - "validator_current_rewards": [], - "delegator_starting_infos": [], - "validator_slash_events": [] - }, - "gov": { - "starting_proposal_id": "1", - "deposits": null, - "votes": null, - "proposals": null, - "deposit_params": { - "min_deposit": [ - { - "denom": "stake", - "amount": "10000000" - } - ], - "max_deposit_period": "172800000000000" - }, - "voting_params": { - "voting_period": "172800000000000" - }, - "tally_params": { - "quorum": "0.334000000000000000", - "threshold": "0.500000000000000000", - "veto": "0.334000000000000000" - } - }, - "crisis": { - "constant_fee": { - "denom": "stake", - "amount": "1000" - } - }, - "accounts": [ - { - "address": "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6", - "coins": [ - { - "denom": "stake", - "amount": "1000000000" - }, - { - "denom": "uatom", - "amount": "1000000000" - } - ], - "sequence_number": "0", - "account_number": "0", - "original_vesting": [], - "delegated_free": [], - "delegated_vesting": [], - "start_time": "0", - "end_time": "0", - "module_name": "", - "module_permissions": [""] - } - ], - "params": null, - "supply": { - "supply": [] - } - } -} diff --git a/scripts/wasmd/.gaiad/config/gentx/gentx-223aedddd9442bcf16641858ca85837f27997d0d.json b/scripts/wasmd/.gaiad/config/gentx/gentx-223aedddd9442bcf16641858ca85837f27997d0d.json deleted file mode 100644 index 81024488..00000000 --- a/scripts/wasmd/.gaiad/config/gentx/gentx-223aedddd9442bcf16641858ca85837f27997d0d.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "type": "cosmos-sdk/StdTx", - "value": { - "msg": [ - { - "type": "cosmos-sdk/MsgCreateValidator", - "value": { - "description": { - "moniker": "testing", - "identity": "", - "website": "", - "details": "" - }, - "commission": { - "rate": "0.100000000000000000", - "max_rate": "0.200000000000000000", - "max_change_rate": "0.010000000000000000" - }, - "min_self_delegation": "1", - "delegator_address": "cosmos1pkptre7fdkl6gfrzlesjjvhxhlc3r4gmmk8rs6", - "validator_address": "cosmosvaloper1pkptre7fdkl6gfrzlesjjvhxhlc3r4gm7znkuf", - "pubkey": "cosmosvalconspub1zcjduepqmktrr4rjkp8lje2lxcpdkf27tpyfv8w74czsasvthr3qc4encahsj85lva", - "value": { "denom": "stake", "amount": "100000000" } - } - } - ], - "fee": { "amount": [], "gas": "200000" }, - "signatures": [ - { - "pub_key": { - "type": "tendermint/PubKeySecp256k1", - "value": "A08EGB7ro1ORuFhjOnZcSgwYlpe0DSFjVNUIkNNQxwKQ" - }, - "signature": "7yxA/j9y58XGRMv336J75p8CCfCDtslpr0hk9FA2GCIsvqgimwrUJ2sXMPbkx6EYj7gpvrrPZ9MY6pnIC2M9YQ==" - } - ], - "memo": "223aedddd9442bcf16641858ca85837f27997d0d@192.168.178.20:26656" - } -} diff --git a/scripts/wasmd/.gaiad/config/node_key.json b/scripts/wasmd/.gaiad/config/node_key.json deleted file mode 100644 index 0fd599b7..00000000 --- a/scripts/wasmd/.gaiad/config/node_key.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "priv_key": { - "type": "tendermint/PrivKeyEd25519", - "value": "JBAVpjZD9g6ihHLpAaNFTHAx9muE38CGycyrJh+6TUvW28k/EVCKNEbYgqol7jvGRDv1kb2gw/HDH/P4nHG+wQ==" - } -} diff --git a/scripts/wasmd/.gaiad/config/priv_validator_key.json b/scripts/wasmd/.gaiad/config/priv_validator_key.json deleted file mode 100644 index 41def821..00000000 --- a/scripts/wasmd/.gaiad/config/priv_validator_key.json +++ /dev/null @@ -1,11 +0,0 @@ -{ - "address": "3A7EBE1A9E333146AE5D9FCB765B88BDD4D2859A", - "pub_key": { - "type": "tendermint/PubKeyEd25519", - "value": "3ZYx1HKwT/llXzYC2yVeWEiWHd6uBQ7Bi7jiDFczx28=" - }, - "priv_key": { - "type": "tendermint/PrivKeyEd25519", - "value": "MijGfx+4vztrhMdzGY20nPqriHUgqbwYLdM5Rtft11XdljHUcrBP+WVfNgLbJV5YSJYd3q4FDsGLuOIMVzPHbw==" - } -} diff --git a/scripts/wasmd/template/.wasmd/config/genesis.json b/scripts/wasmd/template/.wasmd/config/genesis.json index 3ab703f0..ac7341b5 100644 --- a/scripts/wasmd/template/.wasmd/config/genesis.json +++ b/scripts/wasmd/template/.wasmd/config/genesis.json @@ -103,8 +103,12 @@ "supply": [] }, "wasm": { - "codes": null, - "contracts": null + "params": { + "code_upload_access": { + "permission": "Everybody" + }, + "instantiate_default_permission": "Everybody" + } }, "auth": { "params": { @@ -530,4 +534,4 @@ }, "upgrade": {} } -} \ No newline at end of file +}