Skip to content

Commit

Permalink
Reduce SigningCosmWasmClient.upload multiplier to 1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
webmaster128 committed Aug 21, 2023
1 parent 5bb01b8 commit 9a57785
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 5 additions & 1 deletion packages/cosmwasm-stargate/src/signingcosmwasmclient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand Down

0 comments on commit 9a57785

Please sign in to comment.