From 9e7adb2c2b5e6175d8dbd3ffdd89159a671d1bf7 Mon Sep 17 00:00:00 2001 From: Simon Warta Date: Wed, 9 Feb 2022 22:37:15 +0100 Subject: [PATCH] Set default gas limit for send transactions to 100k --- CHANGELOG.md | 2 ++ packages/cosmwasm-stargate/src/testutils.spec.ts | 2 +- packages/faucet/README.md | 2 +- packages/faucet/src/actions/help.ts | 2 +- packages/faucet/src/constants.ts | 4 +++- packages/stargate/src/testutils.spec.ts | 2 +- scripts/wasmd/send_first.js | 2 +- 7 files changed, 10 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c6eff36bf..f50346f6cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ and this project adheres to ### Changed - all: The TypeScript compilation target is now ES2018. +- @cosmjs/faucet: Set default value of `FAUCET_GAS_LIMIT` to 100_000 to better + support Cosmos SDK 0.45 chains. - @cosmjs/stargate: The `AminoTypes` now always requires an argument of type `AminoTypesOptions`. This is an object with a required `prefix` field. Before the prefix defaulted to "cosmos" but this is almost never the right choice for diff --git a/packages/cosmwasm-stargate/src/testutils.spec.ts b/packages/cosmwasm-stargate/src/testutils.spec.ts index 1a387d928a..163fe98d48 100644 --- a/packages/cosmwasm-stargate/src/testutils.spec.ts +++ b/packages/cosmwasm-stargate/src/testutils.spec.ts @@ -27,7 +27,7 @@ import { SigningCosmWasmClientOptions } from "./signingcosmwasmclient"; import hackatom from "./testdata/contract.json"; export const defaultGasPrice = GasPrice.fromString("0.025ucosm"); -export const defaultSendFee = calculateFee(200_000, defaultGasPrice); +export const defaultSendFee = calculateFee(100_000, defaultGasPrice); export const defaultUploadFee = calculateFee(1_500_000, defaultGasPrice); export const defaultInstantiateFee = calculateFee(500_000, defaultGasPrice); export const defaultExecuteFee = calculateFee(200_000, defaultGasPrice); diff --git a/packages/faucet/README.md b/packages/faucet/README.md index 1af4b071a8..66cab433c0 100644 --- a/packages/faucet/README.md +++ b/packages/faucet/README.md @@ -49,7 +49,7 @@ FAUCET_PORT Port of the webserver. Defaults to 8000. FAUCET_MEMO Memo for send transactions. Defaults to unset. FAUCET_GAS_PRICE Gas price for transactions as a comma separated list. Defaults to "0.025ucosm". -FAUCET_GAS_LIMIT Gas limit for send transactions. Defaults to 80000. +FAUCET_GAS_LIMIT Gas limit for send transactions. Defaults to 100000. FAUCET_MNEMONIC Secret mnemonic that serves as the base secret for the faucet HD accounts FAUCET_PATH_PATTERN The pattern of BIP32 paths for the faucet accounts. diff --git a/packages/faucet/src/actions/help.ts b/packages/faucet/src/actions/help.ts index 31834d2e7d..e018375332 100644 --- a/packages/faucet/src/actions/help.ts +++ b/packages/faucet/src/actions/help.ts @@ -22,7 +22,7 @@ FAUCET_PORT Port of the webserver. Defaults to 8000. FAUCET_MEMO Memo for send transactions. Defaults to unset. FAUCET_GAS_PRICE Gas price for transactions as a comma separated list. Defaults to "0.025ucosm". -FAUCET_GAS_LIMIT Gas limit for send transactions. Defaults to 80000. +FAUCET_GAS_LIMIT Gas limit for send transactions. Defaults to 100000. FAUCET_MNEMONIC Secret mnemonic that serves as the base secret for the faucet HD accounts FAUCET_PATH_PATTERN The pattern of BIP32 paths for the faucet accounts. diff --git a/packages/faucet/src/constants.ts b/packages/faucet/src/constants.ts index cfe5b46c80..a6f5350513 100644 --- a/packages/faucet/src/constants.ts +++ b/packages/faucet/src/constants.ts @@ -6,7 +6,9 @@ import { parseBankTokens } from "./tokens"; export const binaryName = "cosmos-faucet"; export const memo: string | undefined = process.env.FAUCET_MEMO; export const gasPrice = GasPrice.fromString(process.env.FAUCET_GAS_PRICE || "0.025ucosm"); -export const gasLimitSend = parseInt(process.env.FAUCET_GAS_LIMIT || "200000", 10); +export const gasLimitSend = process.env.FAUCET_GAS_LIMIT + ? parseInt(process.env.FAUCET_GAS_LIMIT, 10) + : 100_000; export const concurrency: number = Number.parseInt(process.env.FAUCET_CONCURRENCY || "", 10) || 5; export const port: number = Number.parseInt(process.env.FAUCET_PORT || "", 10) || 8000; export const mnemonic: string | undefined = process.env.FAUCET_MNEMONIC; diff --git a/packages/stargate/src/testutils.spec.ts b/packages/stargate/src/testutils.spec.ts index 5970efbb00..6935c6cb17 100644 --- a/packages/stargate/src/testutils.spec.ts +++ b/packages/stargate/src/testutils.spec.ts @@ -64,7 +64,7 @@ export function fromOneElementArray(elements: ArrayLike): T { } export const defaultGasPrice = GasPrice.fromString("0.025ucosm"); -export const defaultSendFee = calculateFee(80_000, defaultGasPrice); +export const defaultSendFee = calculateFee(100_000, defaultGasPrice); export const simapp = { tendermintUrl: "localhost:26658", diff --git a/scripts/wasmd/send_first.js b/scripts/wasmd/send_first.js index 25b2356f0f..b6b10aa680 100755 --- a/scripts/wasmd/send_first.js +++ b/scripts/wasmd/send_first.js @@ -25,7 +25,7 @@ async function main() { const client = await SigningStargateClient.connectWithSigner(rpcUrl, wallet, { prefix: prefix }); const recipient = Bech32.encode(prefix, Random.getBytes(20)); const amount = coins(226644, "ucosm"); - const fee = calculateFee(200_000, "0.025ucosm"); + const fee = calculateFee(100_000, "0.025ucosm"); const memo = "Ensure chain has my pubkey"; const sendResult = await client.sendTokens(faucet.address0, recipient, amount, fee, memo); assertIsDeliverTxSuccess(sendResult);