Reduce SigningCosmWasmClient.upload multiplier to 1.1

This commit is contained in:
Simon Warta 2023-08-21 09:37:10 +02:00
parent 5bb01b8a68
commit 9a57785ead
2 changed files with 9 additions and 1 deletions

View File

@ -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

View File

@ -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));
}