diff --git a/CHANGELOG.md b/CHANGELOG.md index 152e6db8..1bff6c91 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,12 @@ and this project adheres to - @cosmjs/tendermint-rpc: Add missing `earliest_*` fields to `SyncInfo` record returned from the `/status` RPC endpoint ([#1448]). +### Changed + +- @cosmjs/stargate, @cosmjs/cosmwasm-stargate: Change default multiplier for gas + simulation from 1.3 to 1.4 to avoid out of case cases starting with Cosmos SDK + 0.47. + ## [0.31.0] - 2023-06-22 ### Fixed diff --git a/packages/cli/examples/simulate.ts b/packages/cli/examples/simulate.ts index 2a5f3b74..255f44cd 100644 --- a/packages/cli/examples/simulate.ts +++ b/packages/cli/examples/simulate.ts @@ -95,7 +95,7 @@ const client = await SigningStargateClient.connectWithSigner(rpcEndpoint, wallet }, }; const memo = "With simulate"; - const result = await client.signAndBroadcast(account.address, [sendMsg], 1.4, memo); + const result = await client.signAndBroadcast(account.address, [sendMsg], 1.55, memo); assertIsDeliverTxSuccess(result); console.log("Successfully broadcasted:", result); } diff --git a/packages/cosmwasm-stargate/src/signingcosmwasmclient.ts b/packages/cosmwasm-stargate/src/signingcosmwasmclient.ts index e21b66ed..14aeff24 100644 --- a/packages/cosmwasm-stargate/src/signingcosmwasmclient.ts +++ b/packages/cosmwasm-stargate/src/signingcosmwasmclient.ts @@ -604,7 +604,9 @@ export class SigningCosmWasmClient extends CosmWasmClient { if (fee == "auto" || typeof fee === "number") { assertDefined(this.gasPrice, "Gas price must be set in the client options when auto gas is used."); const gasEstimation = await this.simulate(signerAddress, messages, memo); - const multiplier = typeof fee === "number" ? fee : 1.3; + // Starting with Cosmos SDK 0.47, we see many cases in which 1.3 is not enough anymore + // E.g. https://github.com/cosmos/cosmos-sdk/issues/16020 + const multiplier = typeof fee === "number" ? fee : 1.4; usedFee = calculateFee(Math.round(gasEstimation * multiplier), this.gasPrice); } else { usedFee = fee; diff --git a/packages/stargate/src/signingstargateclient.ts b/packages/stargate/src/signingstargateclient.ts index a255629c..a064d164 100644 --- a/packages/stargate/src/signingstargateclient.ts +++ b/packages/stargate/src/signingstargateclient.ts @@ -318,7 +318,9 @@ export class SigningStargateClient extends StargateClient { if (fee == "auto" || typeof fee === "number") { assertDefined(this.gasPrice, "Gas price must be set in the client options when auto gas is used."); const gasEstimation = await this.simulate(signerAddress, messages, memo); - const multiplier = typeof fee === "number" ? fee : 1.3; + // Starting with Cosmos SDK 0.47, we see many cases in which 1.3 is not enough anymore + // E.g. https://github.com/cosmos/cosmos-sdk/issues/16020 + const multiplier = typeof fee === "number" ? fee : 1.4; usedFee = calculateFee(Math.round(gasEstimation * multiplier), this.gasPrice); } else { usedFee = fee;