diff --git a/CHANGELOG.md b/CHANGELOG.md index 1bff6c915c..08c3c62ae2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,10 @@ and this project adheres to - @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. +- @cosmjs/cosmwasm-stargate: Reduce default gas multiplier for + `SigningCosmWasmClient.upload` to 1.1. ([#1360]) + +[#1360]: https://github.com/cosmos/cosmjs/issues/1360 ## [0.31.0] - 2023-06-22 diff --git a/packages/cosmwasm-stargate/src/signingcosmwasmclient.ts b/packages/cosmwasm-stargate/src/signingcosmwasmclient.ts index 14aeff24ee..a5d8ca3772 100644 --- a/packages/cosmwasm-stargate/src/signingcosmwasmclient.ts +++ b/packages/cosmwasm-stargate/src/signingcosmwasmclient.ts @@ -297,7 +297,11 @@ export class SigningCosmWasmClient extends CosmWasmClient { }), }; - const result = await this.signAndBroadcast(senderAddress, [storeCodeMsg], fee, memo); + // When uploading a contract, the simulation is only 1-2% away from the actual gas usage. + // So we have a smaller default gas multiplier than signAndBroadcast. + const usedFee = fee == "auto" ? 1.1 : fee; + + const result = await this.signAndBroadcast(senderAddress, [storeCodeMsg], usedFee, memo); if (isDeliverTxFailure(result)) { throw new Error(createDeliverTxResponseErrorMessage(result)); }