Skip to content

Commit da109eb

Browse files
committed
Updated gas multiplier
1 parent 501c9b6 commit da109eb

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/signingcyberclient.ts

+8-2
Original file line numberDiff line numberDiff line change
@@ -481,7 +481,11 @@ export class SigningCyberClient extends CyberClient {
481481
}),
482482
};
483483

484-
return this.signAndBroadcast(senderAddress, [storeCodeMsg], fee, memo);
484+
// When uploading a contract, the simulation is only 1-2% away from the actual gas usage.
485+
// So we have a smaller default gas multiplier than signAndBroadcast.
486+
const usedFee = fee == "auto" ? 1.1 : fee;
487+
488+
return this.signAndBroadcast(senderAddress, [storeCodeMsg], usedFee, memo);
485489
}
486490

487491
public async instantiate(
@@ -962,7 +966,9 @@ export class SigningCyberClient extends CyberClient {
962966
let usedFee: StdFee;
963967
if (fee == "auto" || typeof fee === "number") {
964968
const gasEstimation = await this.simulate(signerAddress, messages, memo);
965-
const multiplier = typeof fee === "number" ? fee : 1.3;
969+
// Starting with Cosmos SDK 0.47, we see many cases in which 1.3 is not enough anymore
970+
// E.g. https://github.com/cosmos/cosmos-sdk/issues/16020
971+
const multiplier = typeof fee === "number" ? fee : 1.4;
966972
usedFee = {
967973
amount: [],
968974
gas: Math.round(gasEstimation * multiplier).toString(),

0 commit comments

Comments
 (0)